automatic differentiation and change expression ordering
Andrius Kurtinaitis
andrius.kurtinaitis at maf.vu.lt
Wed Nov 5 20:47:48 CET 2003
Hello,
I have two questions:
1. is it possible to prevent automatic differentiation of some
expression? For example, when I do (with ginac 1.1.4):
DECLARE_FUNCTION_1P( intensity )
static ex intensity_eval( const ex & r ) { return intensity(r).hold(); }
// here i tried to hold it :-)
REGISTER_FUNCTION( intensity, eval_func(intensity_eval) )
int main()
{
symbol r("r");
ex der1 = mul( diff( intensity(r), r ), r ).hold();
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?
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
And the third one ;-)
Is there maybe some work done to output fderivative in latex style?
Thanks in advance
Andrius
More information about the GiNaC-list
mailing list