implicit differentiation
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
On Wed, 02 Jun 2010 15:16:18 +0200, Felipe Bordeu <felipe.bordeu@ec-nantes.fr> said: FB> now my problem is that I what to make the substitution of A to FB> something else, like x^2:
FB> cout << "dA/dx with A=x^2 is : " << dAdx.subs(A==pow(x,2)) << FB> endl; (I know that the previous line is not correct) FB> to get something like : "2*x" I think, you need to rewrite method subs() for your class accordingly. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://www.maths.leeds.ac.uk/~kisilv/
participants (2)
-
Felipe Bordeu
-
Vladimir V. Kisil