Problems with order parameter of 'series' method
Hello, when applying the 'series' method to an expression which only constists of adds, muls and pows, the final order of the expansion does not seem to depend pretictably on the parameter 'order' of 'series', e.g. symbol eps("eps"); ex expr = (pow(eps, 8)*pow(pow(eps,3)+ pow(eps + pow(eps,3), 2),-2)) .series(eps==0, 6); cout << "expr: " << expr << endl; produces "expr: Order(eps^2)" and not as expected (by me) "expr: 1*eps^4+(-2)*eps^5+Order(eps^6)" The first order parameter the expansion works correctly with again is 9, then I get an expansion up to Order(eps^13)... Does anyone know how to remedy that or at least how to handle series of this quite general type of expressions predictably? Thanks! Holger Eberle
Hi. The series expansion in GiNaC has now been revised in favor of a more predictable expansion scheme. The given order parameter now determines the last exact term in the series. For example
symbol eps("eps"); ex expr = (pow(eps, 8)*pow(pow(eps,3)+ pow(eps + pow(eps,3), 2),-2)) .series(eps==0, 6); cout << "expr: " << expr << endl;
would give expr: 1*eps^4+(-2)*eps^5+(-1)*eps^6+Order(eps^7) The Order function's degree corresponds not nescessarily to the next-to-be term in the series expansion. For "simple" Taylor expansion it does, but if the expression is (or contains) something like f^(-a), where f is a not too simple expression, the Order function's degree does not. The code is momentarily only in CVS for GiNaC 1.1 (not CVS HEAD). You are welcome to participate in testing the new code, so that we get confident enough to put it in the next release :-) (*Note* that this change could result in your software giving wrong results, even if the series expansion is still mathematically correct, due to implicit expectations you might have put on the return value of the series method.) Bye, Jens
Hello Jens, On Tue, 17 Feb 2004, Jens Vollinga wrote:
The series expansion in GiNaC has now been revised in favor of a more predictable expansion scheme. The given order parameter now determines the last exact term in the series.
In principle this is good, but I think it is a very bad idea to let the order give the last exact term in the series. I think order-1 should be equal to the last exact term. The reason is that this is more compatible with what we are used to. I don't think you want to force your users to write f.series(x, version_micro>whatever ? order-1 : order), do you? Calculating an expression to an order that is one higher than is usefull, can easily result in a program taking an order of magnitude longer to finish. Also I found some bugs. I will report them as soon as is clear what series is supposed to do. Bye, Chris
Hi! On Tue, 17 Feb 2004, Chris Dams wrote:
I think order-1 should be equal to the last exact term.
Ok, that seems to have chaned in CVS now. When can the people that really live on the edge (i.e., the ones that use the 1.2.0 CVS-version) enjoy the benefits of this change? I always thought that introducing new features was the thing that happened at 1.2.0?
Also I found some bugs. I will report them as soon as is clear what series is supposed to do.
With this last change, also the bugs seem to have miraculously disappeared. This is just to great to be true... :-) Bye, Chris
Hi. After some bug fixes the new series expansion should work now. Chris' suggestions made sense (Thanks!) so we changed the scheme so that the order you give will be the order of the Order function, i.e the first non-exact term in the series. On Thu, Feb 19, 2004 at 12:31:59PM +0000, Chris Dams wrote:
Ok, that seems to have chaned in CVS now. When can the people that really live on the edge (i.e., the ones that use the 1.2.0 CVS-version) enjoy the benefits of this change? I always thought that introducing new features was the thing that happened at 1.2.0?
Well, it doesn't change the interface and is more like a bug-fix (or a feature-fix ;-)). Since 1.2.0 will not be available tomorrow and I have software that runs only with 1.1 (not 1.2) I thought it would be the best to start there. But of course, it will go into 1.2 soon after some consolidation time.
With this last change, also the bugs seem to have miraculously disappeared. This is just to great to be true... :-)
Sorry, I was hacking like 2 minutes too slow for this reply. But I appreciate your testing effort. Keep on testing! There might be new bug to discover ... Bye, Jens
participants (3)
-
Chris Dams
-
Holger Eberle
-
Jens Vollinga