Hello, I've tried to replicate calculations involving series expansions that I did with Mathematica. Here are some comments: The following program #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main() { symbol x("x"), a("a"); cout << (1 + a*x + Order(pow(x, 2))).series(x == 0, 2).diff(a) << endl; cout << (1 + Order(x) + Order(pow(x,2))).series(x == 0, 2) << endl; ex series1 = (a + Order(pow(x,2))).series(x == 0, 2); ex series2 = (1 + Order(x)).series(x == 0, 1); cout << series1.subs(a == series2) << endl; return 0; } prints out: 1+(a)*x+Order(x^2) 1+Order(x) (1+Order(x))+Order(x^2) I would like to obtain 'x+Order(x^2)' in the first line. That is what Mathematica does when differentiating a series with respect to some parameter. The second line is exactly what I expect but the third line should be the same as the second. Mathematica behaves in the same way as GiNaC so that I had to write an extra function 'SeriesUnnest' that would expand the third expression into the second. Unfortunatly I don't have time and skills to make an suggestion how to hande this situation in GiNaC... Greetings, Alexander Heide
Hi! On Wed, Aug 07, 2002 at 06:57:08PM +0200, Alexander Heide wrote:
cout << (1 + a*x + Order(pow(x, 2))).series(x == 0, 2).diff(a) << endl; [...] prints out: 1+(a)*x+Order(x^2)
It seems that no one has bothered to implement this, so I've done it now... Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Alexander Heide
-
Christian Bauer