Ask Your Question

# Similar limits give very different behavior

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 close merge delete

## 2 Answers

Sort by » oldest newest most voted
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)

more

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

more

## Your Answer

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

Add Answer

## Stats

Asked: 2012-09-04 15:55:43 +0200

Seen: 120 times

Last updated: Sep 04 '12