Le vendredi 22 avril 2011 à 09:52 -0700, Tom Bachmann a écrit :
> > 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.
>
> Hm? nseries() works in master for me:
I thinks it's because we didn't do exactly the same test :
In [17]: exp(O(x)).nseries()
---------------------------------------------------------------------------
ValueError
[...]
ValueError: Could not calculate 6 terms for exp(O(x))
I can reproduce the following successes.
> >>> exp(O(x)).nseries(x)
> >>> exp(O(x)).nseries(x,n=6)
> >>> exp(O(x)).series(x,n=1)
I do not reproduce the following ValueError
> >>> exp(O(x)).series(x,n=2)
[...]
> ValueError: Could not calculate 2 terms for exp(O(x))
>
> I think it's a feature, except that passing no n at all should imho
> fail gracefully.
I suspect you edited your input, because I have :
In [24]: exp(O(x)).nseries(x,n=2)
Out[24]: 1 + O(x)
In [25]: exp(O(x)).nseries(n=2)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[...]
ValueError: Could not calculate 2 terms for exp(O(x))
So the pattern seems to be exp(O(x)).nseries(x,n=N) can raise a
ValueError when N is too big, while exp(O(x)).nseries(n=N) fails
gracefully. Is there any logic behind that ?
Fred
--
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.