Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2009

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

Search the Archive

Re: Labelling a plot with maximum

  • To: mathgroup at
  • Subject: [mg105175] Re: [mg105146] Labelling a plot with maximum
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Mon, 23 Nov 2009 06:52:59 -0500 (EST)

Hi, Shalin,
try this. Alexei

jinc[x_] := BesselJ[1, 2 \[Pi] x]/(2 \[Pi] x);
f[x_, \[CapitalDelta]_] :=
  4 Abs[jinc[x + \[CapitalDelta]] - jinc[x - \[CapitalDelta]]]^2;

  nmx = Dynamic[NMaximize[f[x, \[CapitalDelta]], x][[2, 1, 2]]];
       "\!\(\*SubscriptBox[\"x\", \"max\"]\)=\[PlusMinus]", Red, Bold,
        18], Style[nmx, Red, Bold, 18]}],
    Plot[f[x, \[CapitalDelta]], {x, -1.22, 1.22},
     PlotRange -> {{-0.5, 0.5}, {0, 1.5}}]}]], {\[CapitalDelta],
  0.125, 0.5}]

Hi everyone,

 I am very new to Mathematica. I wish to prepare a figure and a movie
where the maximum of the plot is labelled on the figure.

I am using Manipulate to animate a function as shown below:

jinc[x_] := BesselJ[1, 2 \[Pi] x]/(2 \[Pi] x);
f[x_, \[CapitalDelta]_] :=
  4 Abs[jinc[x + \[CapitalDelta]] - jinc[x - \[CapitalDelta]]]^2;
 Plot[f[x, \[CapitalDelta]], {x, -1.22, 1.22},
  PlotRange -> {{-0.5, 0.5}, {0, 1.5}}], {\[CapitalDelta], 0.125,

I find the maximum for different values of Delta using:
 NMaximize[f[x, \[CapitalDelta]], x], {\[CapitalDelta], 0.125,

Can someone please help with a code that can print the result returned
by NMaximize on (say) top-left of the Plot generated by the first
Manipulate above? The plot will look  neat if I can place a marker at
the X-position of maximum.

Also, I wish to have a Motion-JPEG compressed quicktime mov file
exported from this manipulate. How can that be achieved?

thanks in advance for any help.

Alexei Boulbitch, Dr., habil.
Senior Scientist

ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern

Phone: +352 2454 2566
Fax:   +352 2454 3566


This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

  • Prev by Date: Re: Labelling a plot with maximum
  • Next by Date: Re: Re: Mathematica scoping / contexts / variable localization
  • Previous by thread: Re: Labelling a plot with maximum
  • Next by thread: Re: Freeze Panes in Grid Expression (addendum)