I noticed that
Limit can return nonsense when using inexact parameters. In the following code,
a is my (exact/inexact) parameter, and I want to know the limit for
b -> 1 (or
b -> 1., this does not matter).
expr := Limit[(-b*Cos[a*b] Sin[a/2] + Sin[a*b] Cos[a/2])/(b^2 - 1), b -> 1]; a = 2. Pi; expr (* Returns -Infinity *) a = 2 Pi; expr (* Returns -Pi *)
I observe this behavior in Mathematica 8, 9, and 10.
I then turned to the documentation of
Limit, which states:
Limit may return an incorrect answer for an inexact input:
Limit[Log[1 - (Log[Exp[z]/z - 1] + Log[z])/z]/z, z -> 100.] (* -Infinity *)
The result is correct when an exact input is used:
Limit[Log[1 - (Log[Exp[z]/z - 1] + Log[z])/z]/z, z -> 100] (* 1/100 Log[1 - 1/100 Log[-100 + E^100]] *)
I can see why
Limit fails here: The subexpression
1 - 1/100*Log[-100 + E^100] evaluates to approximately 4*10^-44, which is prohibitively small (in single precision, but not in double - this confuses me a bit).
In my example, however, I can't see tiny or huge numbers that could cause this sort of problem. Can you help me see my error?
Edit: I found this problem when I was calculating the Fourier transform of an RF-pulse to find the maximum power density of its spectrum.