Re: Limit problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg51102] Re: [mg51098] Limit problem*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Tue, 5 Oct 2004 04:36:45 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 4 Oct 2004, at 19:18, Mike Zeitzew wrote: > > Why is Limit giving me the wrong answer for this simple divided > difference? I am using 5.0.1.0 / > XP > > In[1]:= > Clear[f,h,x] > > In[2]:= > f[x_]:=Sin[12*x^2]/(3*x^2) > > In[3]:= Limit[(f[0.4 + h] - f[0.4])/h, h -> 0] > > Out[3]= > -∞ > > In[4]:= > f'[0.4] > > Out[4]= > -16.631 > In Mathemaitca 0.4 is an approximate number with Machine precision. It is not the same as 2/5. It is a good idea to avoid as much as possilbe the use of approximate numbers in symbolic computations since various algebraic identities, particulalry cancellations of common factors cannot be performed due to small differences between what ought to be identical expressions. This is exactly what happens in this case. If you use exact quantities there is no probem: In[1]:= f[x_] := Sin[12*x^2]/(3*x^2) In[2]:= Limit[(f[2/5 + h] - f[2/5])/h, h -> 0] Out[2]= 20*Cos[48/25] - (125/12)*Sin[48/25] In[3]:= N[%] Out[3]= -16.6309667072401 If you perfomr a Trace on your original input and the above you will see clearly what I mean. Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/