automatic differentiation and change expression ordering
Christian Bauer
Christian.Bauer at Uni-Mainz.DE
Thu Nov 20 15:57:46 CET 2003
Hi!
On Wed, Nov 05, 2003 at 09:47:48PM +0200, Andrius Kurtinaitis wrote:
> int main()
> {
> symbol r("r");
> ex der1 = mul( diff( intensity(r), r ), r ).hold();
Don't use hold() here.
> ex deriv = der1.diff(r);
> cout << deriv << endl;
> return 0;
> }
>
> I get the following output:
> D[0,0](intensity)(r)*r+D[0](intensity)(r)
>
> But I would like to get something like this:
>
> D[0]( D[0](intensity)(r)*r )(r)
>
> Is it possible with ginac?
No. fderivative can only represent derivatives of symbolic functions, not
of general expressions.
> 2. What is the simplest way to change the order in multiplication so
> that the differential operators print after all other terms:
> r*D[0,0](intensity)(r)
> instead of
> D[0,0](intensity)(r)*r
You'd have to rewrite the output routine of the 'mul' class to rearrange
the terms. This is possible in GiNaC 1.2 without modifying GiNaC itself,
but it is not a trivial task.
> Is there maybe some work done to output fderivative in latex style?
Suggestions are welcome. :)
Bye,
Christian
--
/ Physics is an algorithm
\/ http://www.uni-mainz.de/~bauec002/
More information about the GiNaC-list
mailing list