MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: bad Mathieu functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108281] Re: bad Mathieu functions
  • From: gekko <pfalloon at gmail.com>
  • Date: Fri, 12 Mar 2010 07:12:26 -0500 (EST)
  • References: <hnakhc$5p5$1@smc.vnet.net>

On Mar 11, 10:35 pm, becko BECKO <becko... at hotmail.com> wrote:
> I am no expert in Mathieu functions, but I don't think this gives the right result:
>
> ce1[r_, q_, z_] := MathieuCPrime[MathieuCharacteristicA[r, q], q, z]
>
> Plot[I ce1[3, q, I], {q, 0, 1000}]
>
> In another system you get a smooth graph, making very small oscillations about zer o as q increases. I've read that Mathieu functions are difficult to deal with. I guess that Mathematica's implementation doesn't support arbitrary values of the parameters. I made a bug report in the WRI site. Maybe someone here has some comments to share? It would be nice if there were a package or something with more robust implementations of Mathieu functions.


Au contraire, Mathematica is one of the few systems that does support
arbitrary precision evaluation of all special for arbitrary values of
parameters. However, there is no getting around the fact that some
regions of parameter space are just hard to compute!

In the case of Mathieu functions, the series expansion by which they
are computed converges more slowly as the parameter q becomes larger.
As a consequence, to get meaningful values for large q you need to
work with higher precision.

Compare the following three cases (using your ce1 function):

In[179]:= {ce1[3, 1000., I], ce1[3, 1000`20, I], ce1[3, 1000`60, I]}

Out[179]= {0. + 1608.56 I, 0.*10^2 I, 7.293885910335973*10^-22 I}

In order, what's going on here is:

1. Machine-precision evaluation: all internal computations are done to
machine precision, which is insufficient in this case, and hence the
final answer is (machine-precision) garbage.

2. High-precision evaluation, using 20 significant digits: here
Mathematica pays attention to significant figures and correctly
returns a zero-precision result, since 20 digits is not enough to
compute the underlying sum.

3. High-precision evaluation, using 60 significant digits: here 60
digits is high enough to compute the sum and hence return a meaningful
answer. Notice that the final answer has far fewer significant digits
than the input, since precision is lost evaluating the sum.


Now, you could legitimately argue that Mathematica should be "smarter"
in cases 1 and 2 above. For case 1, I would say that the current
behaviour reasonable (and somewhat "expected") since it is a general
design decision that machine precision computation should be fast at
the expense of complete control over precision.

For case 2 I would tend to agree that Mathematica *could* be smarter:
there is no reason why the internal algorithm couldn't recognize that
the output has insufficient precision, and thus increase the internal
working precision.


In any case, to return to your original example: if you want to get
your plot "working", you can simply force it to use higher precision:

LogPlot[Abs[I ce1[3, SetPrecision[q,100], I]], {q, 0, 1000}, PlotRange-
>All]

Hope this helps.

Cheers, P.


  • Prev by Date: Re: ParametricPlot3D with three parameters
  • Next by Date: Re: Struggling with FindFit for a model which takes results from
  • Previous by thread: Re: Re: bad Mathieu functions
  • Next by thread: Re: Re: bad Mathieu functions