Inability to compute limit.

44 views
Skip to first unread message

PavelY

unread,
Nov 8, 2013, 2:21:26 PM11/8/13
to sage-s...@googlegroups.com
I am trying to compute a limit with sage, and I get incorrect answers. 

Here is an example which should produce the result of 0 but does not. 

reset()
n = var('n')

assume(n>0)
series = -(3*n^2 + 1)*(-1)^n/sqrt(n^5 + 8*n^3 + 8)
working_series = -(7*n^2 + 8)*(-1)^n/sqrt(n^5 + 4*n^2 + 2)

print "Limit of series = "+str(limit(series, n=infinity))
print "Limit of working_series = "+str(limit(working_series, n=infinity))

This yields these results:

Limit of series = 38/25*pi^2*und
Limit of working_series = 0

Both Limits should be equal to zero. Removing the assumption of n>0 or adding assume(n,'integer') does not change the outcome. 

If someone is aware of why this is happening and/or knows a method to solving this; please let me know. 

Thank You,

Pavel Y.

kcrisman

unread,
Nov 8, 2013, 4:03:49 PM11/8/13
to sage-s...@googlegroups.com


On Friday, November 8, 2013 2:21:26 PM UTC-5, PavelY wrote:
I am trying to compute a limit with sage, and I get incorrect answers. 

Here is an example which should produce the result of 0 but does not. 

reset()
n = var('n')

assume(n>0)
series = -(3*n^2 + 1)*(-1)^n/sqrt(n^5 + 8*n^3 + 8)
working_series = -(7*n^2 + 8)*(-1)^n/sqrt(n^5 + 4*n^2 + 2)

print "Limit of series = "+str(limit(series, n=infinity))
print "Limit of working_series = "+str(limit(working_series, n=infinity))

This yields these results:

Limit of series = 38/25*pi^2*und


Note the "und" - undefined.  Maxima is probably noticing the (-1)^n piece...

PavelY

unread,
Nov 8, 2013, 4:13:22 PM11/8/13
to sage-s...@googlegroups.com
Looks like you are correct. When i took the absolute value of "series", it gave me the correct answer. (Although absolute value doesn't work 100% of the time.)

I'm currently doing (limit((series^2).simplify_full(), n=infinity))
It serves its purpose for now since I only want to know if the limit is equal to zero or not. 

Thanks for the info

On Friday, November 8, 2013 2:21:26 PM UTC-5, PavelY wrote:

Dan Drake

unread,
Nov 8, 2013, 4:31:34 PM11/8/13
to sage-s...@googlegroups.com
On Fri, 08 Nov 2013 at 01:03PM -0800, kcrisman wrote:
> Note the "und" - undefined. Maxima is probably noticing the (-1)^n piece...

I'm not sure it's the (-1)^n. I tried using cos(pi*n) instead and still
get "und":

sage: n = var('n')
sage: assume(n>0)
sage: series = -(3*n^2 + 1)*cos(pi*n)/sqrt(n^5 + 8*n^3 + 8)
sage: limit(series, n=infinity)
6/5*pi*und + 2/5*und

But observe:

sage: series = -(1)*cos(pi*n)/sqrt(n^5 + 8*n^3 + 8)
sage: limit(series, n=infinity)
0

(It also works with (-1)^n.)

It looks like Maxima is actually getting confused by the n^2 in the
denominator. Not sure what it's doing to find the limit.


Dan

--
--- Dan Drake
----- www.math.wisc.edu/~ddrake/
-------
signature.asc

kcrisman

unread,
Nov 8, 2013, 4:41:10 PM11/8/13
to sage-s...@googlegroups.com
Another interesting data point - in Maxima itself:

(%i6) display2d:false;

(%o6) false
(%i7) limit(-(3*n^2 + 1)*(-1)^n/sqrt(n^5 + 8*n^3 + 8),n,inf);

(%o7) -38*und*log(-1)^2/25

But in Sage

sage: log(-1)
I*pi

which presumably leads to this.

Dan, I'm on a train with horrible internet - can you open a ticket, post to the Maxima list, etc.?  Thanks!

Dan Drake

unread,
Nov 8, 2013, 4:58:34 PM11/8/13
to sage-s...@googlegroups.com
On Fri, 08 Nov 2013 at 01:41PM -0800, kcrisman wrote:
> Dan, I'm on a train with horrible internet - can you open a ticket, post to
> the Maxima list, etc.? Thanks!

This is now http://trac.sagemath.org/ticket/15386.
signature.asc
Reply all
Reply to author
Forward
0 new messages