Le vendredi 22 avril 2011 à 06:43 -0700, Tom Bachmann a écrit :

> On 22 Apr., 14:24, Frédéric Grosshans-André
> <[email protected]> wrote:
> > exp(O(x)).series() fails with the following ValueError: Could not
> > calculate 6 terms for exp(O(x)). On the other hand
exp(O(x)).series(n=1)
> > succeeds and give the expected result. Is this a feature preventing
me
> > to ask too precise Taylor expansion ?

> The problem is that series is trying to be clever and really give you
> 6 terms. In particular foo.series(x,n=N) is supposed to return
> something O(x**N). This is impossible here and series should probably
> fail gracefully, but the behaviour is not totally unexpected.

OK. Let says it's a feature. Making further test shows that we have a
graceful fail in 0.6.7 , where exp(O(x))==1+O(x) and an error in
0.6.7-git. A "progress" if it's a feature, a regression otherwise.

> 
> Note that you can always use nseries (for expansions about 0 from the
> right). This will always return a correct result, but not necessarily
> to the right order. E.g. (sin(x)/x).nseries(x, n=N) only returns
> O(x**(N-1)). What series does is to keep increasing the n passed to
> nseries until the result is O(x**N).

nseries() and series() behave the same way for exp(O(x)) (i.e. graceful
fail in 0.6.7 and error in 0.6.7-git). The difference is that nseries()
allows us to easily guess the value of n we should put.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to