MathGroup Archive 2010

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

Search the Archive

Re: Mathieu function zeros

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108195] Re: Mathieu function zeros
  • From: gekko <pfalloon at gmail.com>
  • Date: Wed, 10 Mar 2010 01:45:49 -0500 (EST)
  • References: <hn5b5u$6v8$1@smc.vnet.net>

On Mar 9, 10:24 pm, becko BECKO <becko... at hotmail.com> wrote:
> 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?


One quick way would be too identify all local extrema within the plot
and test whether they are really zero. The following is a skeletal
implementation for minima (can be easily extended to cover maxima):

(* define a test function *)
f[x_] := Sin[x]^2

(* define domain *)
{xmin, xmax} = {0, 10*Pi};

(* get points from plot *)
pts = Cases[Plot[f[x], {x,xmin,xmax}], Line[___], Infinity][[1,1]];

(* define functions to test if middle point of a triple is a minimum
*)
minCheck = #[[2,2]]<#[[1,2]] && #[[2,2]]<#[[3,2]] &;

(* get local minima *)
minPts = Select[Partition[pts, 3, 1], minCheck][[All,All,1]];

(* refine minima to higher accuracy and get in the form (xmin, fmin)
*)
minSols = {x/.#[[2,1]], #[[1]]} & /@
	(FindMinimum[f[x], {x, #[[1]], #[[3]]}] & /@ minPts);

(* get a reference value to determine the "scale" of the function *)
refVal = Max[Abs[pts[[All,2]]]];

(* select those minima which are essentially zero according to the
scale of the plot *)
zeros = Select[minSols, PossibleZeroQ[#[[2]]+refVal-refVal] &][[All,
1]]

Plot[f[x], {x,xmin,xmax}, Epilog->{Red, PointSize[0.02], Point[{#,0}]&/
@zeros}]


Cheers, P.

PS: in my previous response I was remiss in neglecting to mention that
I originally got the idea of using Plot in this way from Paul Abbott:

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/1c124ca5e6a0d665/29c24748f126855e?lnk=gst&q=paul+abbott+rootsinrange#29c24748f126855e


  • Prev by Date: Re: Re: Why can't Mathematica tell when something is algebraically
  • Next by Date: Re: Conjugate of symbolic expressions
  • Previous by thread: Re: Mathieu function zeros
  • Next by thread: Re: Re: Mathieu function zeros