Ask Your Question
0

Similar limits give very different behavior

asked 2012-09-04 08:55:43 -0500

Andy gravatar image

The following code produces the expected right answer:

sage: var('x,h')
sage: f(x) = sin(x^2)
sage: lim((f(x+h)-f(x))/h, h=0)

The answer, of course, is 2xcos(x^2). However, the following code fails to complete:

sage: lim((f(pi+h)-f(pi))/h, h=0)

Sage just thinks and thinks and does not come up with an answer. This happens on two different versions I have access to, 5.2 and 5.0. What is happening?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2012-09-04 10:31:01 -0500

achrzesz gravatar image

updated 2012-09-04 10:34:21 -0500

sage: from sympy import Symbol, limit
sage: h=Symbol('h')
sage: limit((sin((pi+h)^2)-sin(pi^2))/h,h,0)
2*pi*cos(pi**2)
edit flag offensive delete link more
0

answered 2012-09-04 09:59:21 -0500

kcrisman gravatar image

For what it's worth, Maxima is the one causing the hang.

(%i1) limit( (sin((h + x)^2) - sin(x^2))/h, h, 0);
                                       2
(%o1)                             2 x cos(x )

(%i3) limit( (sin((%pi+h)^2)-sin(%pi^2))/h,h,0);

But I can't diagnose it any further than that. Replacing %pi with 2 or something does the same (well, unless x=0).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-09-04 08:55:43 -0500

Seen: 67 times

Last updated: Sep 04 '12