MathGroup Archive 2010

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

Search the Archive

Re: Mathieu function zeros

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107987] Re: Mathieu function zeros
  • From: gekko <pfalloon at gmail.com>
  • Date: Thu, 4 Mar 2010 05:31:00 -0500 (EST)
  • References: <hmlf2f$jt3$1@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.


  • Prev by Date: Re: Re: Select Maximum Value
  • Next by Date: Re: Re: learning calculus through mathematica
  • Previous by thread: Re: Mathieu function zeros
  • Next by thread: Re: Mathieu function zeros