[GiNaC-list] Symbolic Differentiation
Diego Ariel Hollmann
diegohollmann at gmail.com
Tue Aug 21 20:55:02 CEST 2012
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20120821/e808f98d/attachment.html>
More information about the GiNaC-list
mailing list