Re: Re: Mathieu function zeros
- To: mathgroup at smc.vnet.net
- Subject: [mg108205] Re: [mg108166] Re: Mathieu function zeros
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 10 Mar 2010 01:47:39 -0500 (EST)
- References: <17743384.1268137940196.JavaMail.root@n11>
If I remember correctly Ted Ersek's RootSearch package (from the WRI site) does pick up non crossing zeros. However, the package has not been updated for Version 6 and 7. As a result it gives a warning message (that can be suppressed with Quiet) but otherwise works. Ted's routine is extremely convenient for searching for zeros along a real line. It gets all the zeros, crossing and non-crossing, in order within an interval. It is a specialized but common case of the FindRoot functionality and Mathematica has nothing like it. It really should be an optional method for FindRoot. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: becko BECKO [mailto:becko565 at hotmail.com] Thanks a lot. This is VERY useful. As you said, I extended it to handle the other Mathieu's and it worked very well. I think the only issue is that this method doesn't detect zeros where the graph doesn't cross the axis (it doesn't detect the zero of x^2, but it does detect the zero of x^3). This is not an issue with Mathieu functions. But it would be nice if one could exploit the inner workings of Plot a bit more to detect zeros that are not crossings. Any ideas? > Date: Thu, 4 Mar 2010 05:31:00 -0500 > From: pfalloon at gmail.com > Subject: [mg107987] Re: Mathieu function zeros > To: mathgroup at smc.vnet.net > > On Mar 3, 9:53 pm, becko BECKO <becko... at hotmail.com> wrote: > > Hi. I'm doing some work with Mathieu functions and I need to know the zeros > > of these functions (MathieuC, MathieuS, MathieuCPrime, MathieuSPrime). This doesn't seem to be implemented in Mathematica (as opposed to Bessel functions, where there is a package that calculates the zeros). > > > > Can someone tell me where can I find any implementation of this? > > > > Or perhaps point me in some direction as to how I can get started in implementing it myself? > > The built-in function FindRoot will readily compute the zeros to > whatever precision you need. You just need to specify one or two > starting guesses. > > If you need to find all zeros in a fixed domain (e.g. the interval 0 > <= x <= Pi), a neat trick is to leverage the Plot function's adaptive > capabilities (i.e. computing sufficient points to capture the > structure of interest) to get the approximate locations of the zeros, > then refine these using FindRoot. > > Here is a simple implementation: > > mathieuCZeros[r_,q_] := Module[{ce, lineElts, crossings, z}, > (* define ce function *) > ce[z_] := MathieuC[MathieuCharacteristicA[r,q], q, z]; > (* get line elements from plot *) > lineElts = Cases[Plot[ce[z], {z,0,Pi}], Line[___], Infinity][[1,1]]; > (* get x values on either side of all zero crossings *) > crossings = Select[Partition[lineElts,2,1], Sign[#[[1,2]]] == - > Sign[#[[2,2]]] &][[All,All,1]]; > (* find zeros between each crossing using secant method *) > z /. FindRoot[ce[z], {z,#1,#2}] & @@@ crossings > ]mathieuCZeros[r_,q_] := Module[{ce, lineElts, crossings, z}, > (* define ce function *) > ce[z_] := MathieuC[MathieuCharacteristicA[r,q], q, z]; > (* get line elements from plot *) > lineElts = Cases[Plot[ce[z], {z,0,Pi}], Line[___], Infinity][[1,1]]; > (* get x values on either side of all zero crossings *) > crossings = Select[Partition[lineElts,2,1], Sign[#[[1,2]]] == - > Sign[#[[2,2]]] &][[All,All,1]]; > (* find zeros between each crossing using secant method *) > z /. FindRoot[ce[z], {z,#1,#2}] & @@@ crossings > ] > > > This can be extended as required to handle MathieuS, other domains, > higher precision, possible zeros on boundaries, etc. > > Cheers, P.