Frédéric Grosshans-André wrote:
> Another strategy seems possible, and I think, simple enough for me to
> program. However, I'm not a programmer, and I don't know sympy well
> enough to know if my idea is stupid or not.
>
> I think about a parameter to series() to manually tell it should only
> return the best result obtained so far instead of raising an error ?
>
> Something like
> def series(self, x=None, x0=0, n=6, dir="+", nstrict=True)
> where inputting nstrict=False would not raise an error, while
> nstrict=True keeps the current behaviour.
>
I like that idea. lseries could be used to get the terms since it quits if the
end of the series is reached. Knowing the number of terms, then, the series
with the O-term could be requested internally and returned. Another keyword
option that is used in various places in sympy is 'exact'. Internally it might
look like this:
h[8] >>> s=exp(O(x)).series(n=None)
h[8] >>> did=0
h[8] >>> for i in range(6):
... try:
... t=s.next()
... if t:did+=1
... except StopIteration:
... break
...
h[8] >>> exp(O(x)).series(n=did)
1 + O(x)
Maybe there would be a way to compute the O() without having to redo the whole
series.
/c
--
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.