[GiNaC-list] implicit differentiation

Felipe Bordeu felipe.bordeu at ec-nantes.fr
Wed Jun 2 15:16:18 CEST 2010


Hi everyone,

I created a class for GiNaC to treat implicit differentiation, here is 
an example:

     symbol x = get_symbol("x");                             ----> I use 
a factory
     ex A = dersymbol("A").dependent_of(x);        -----> my new class, 
and I tell that is dependent of x
     ex dAdx = A.diff(x);
     cout << A << endl;                                          -----> 
"A(x)"
     cout << "dA/dx : " << dAdx ;             -----> "A(x)_1x"
     cout << "d2A/dx2 : " << dAdx.diff(x) ;     -----> "A(x)_2x"
     cout << "dA/dy : " << A.diff(get_symbol("y")) ;   -----> "0"

Inside dersymbol I store the dependents variables and the degree of the 
differentiation.

now my problem is that I what to make the substitution of A to something 
else, like x^2:

cout << "dA/dx  with  A=x^2  is :  " << dAdx.subs(A==pow(x,2)) << endl;
(I know that the previous line is not correct)

to get something like :  "2*x"

Any ideas??

Thanks

(first time in this mailing list)

Felipe



More information about the GiNaC-list mailing list