Hello, I've seen a thread last month from Martin Ettl, and I'm having the same problem but the solution proposed by Jens Volling does not work for me.

I need to derive expressions with variables that depend on others, for example: x(t)^2+sin(y(t)). I need to derive with respect to variable t.

The solution proposed by Jens was:
DECLARE_FUNCTION_1P(a)
DECLARE_FUNCTION_1P(b)
REGISTER_FUNCTION(a, dummy())
REGISTER_FUNCTION(b, dummy())

int main()
{
	symbol t("t");

	ex expr = a(t) * b(t);

	cout << expr << endl;
	cout << expr.diff(t,1) << endl;

	return 0;
}

This does not work with all kind of expressions, for example, with the one I wrote before... if I use this solution with: ex expr = a(t)^2 + sin(b(t)) it throws an error with the operator "^".

Any idea how can I do this king of derivations?

Thank you in advance!
Diego H.