On 29 Apr., 19:17, Ronan Lamy <[email protected]> wrote:
> Le vendredi 29 avril 2011 à 09:50 -0700, Tom Bachmann a écrit :
> <snip>> I don't really think it's worth the hassle fixing this as long as we
> > can only do trivial cases anyway.
>
> I think limit() needs to get smarter, not gruntz(). It should be able to
> perform appropriate simplifications based on the information that the
> variable goes to the limit point.
>
> > On 29 Apr., 09:55, Tom Bachmann <[email protected]> wrote:
> > > Evidently neither gruntz nor limit play along particularly well with
> > > infinities. Clearly this should be nan. I'll try to look into the
> > > gruntz issue today.
>
> > > On 29 Apr., 09:25, smichr <[email protected]> wrote:
>
> > > > I would have expected NaN to be returned but I get:
>
> > > >     h[1] >>> limit(x-oo,x,oo)
> > > >     oo
> > > >     h[2] >>> limit(oo-x,x,oo)
> > > >     -oo
>
> I would argue that the correct results are limit(x - oo, x, oo) == -oo
> and limit(oo - x, x, oo) == oo.

That makes a lot of sense, but I would argue that calculating limits
in this extended system is not going to be trivial.

Wait. The following one-line patch seems to do exactly what it should
do:

diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py
index a175b45..4dd8455 100644
--- a/sympy/series/gruntz.py
+++ b/sympy/series/gruntz.py
@@ -322,7 +322,7 @@ def limitinf(e, x):
         # We make sure that x.is_positive is True so we
         # get all the correct mathematical bechavior from the
expression.
         # We need a fresh variable.
-        p = Dummy('p', positive=True)
+        p = Dummy('p', positive=True, bounded=True)
         e = e.subs(x, p)
         x = p
     c0, e0 = mrv_leadterm(e, x)


So my initial analysis was completely from the wrong perspective.
Sorry about that.

Does anyone see a problem with this code? Seems almost too easy.

-- 
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