Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm studying the maximum value of the following function

k = hbar^2*rhoc/(2*m)

Esf2[x1_?NumericQ, zeta_?NumericQ] := 
    k*NIntegrate[(1. - r^2)*(Tanh[(1./zeta)*Sqrt[(4.*Log[2.] - 1.)/3.]*
    Sqrt[(1. - x1^2) (Abs[r Sin[t]]^2 + (x1 - r Cos[t])^2)]]^2 
    Tanh[(1./ zeta)*Sqrt[(4.*Log[2.] - 1.)/3.]* Sqrt[(1. - x1^2) 
    (Abs[ r Sin[t]]^2 + (x1 + r Cos[t])^2)]]^2)*((4 x1^2 (-1. + x1^2)^2 
    (1. + r^4 + 2 r^2 Cos[2. t]))/((r^2 + x1^2 - 2 r x1 Cos[t]) 
    (1. + r^2 x1^2 - 2 r x1 Cos[t])(r^2 + x1^2 + 2 r x1 Cos[t]) 
    (1. + r^2 x1^2 + 2 r x1 Cos[t]))),
    {r, 0., 1.}, {t, 0., 2.*Pi}]

with FindMaximum:

maxEvalue[zeta_?NumericQ] := FindMaximum[{Esf2[x1, zeta], 0 <= x1 < 1}, {x1, 0.02}]

The problem with FindMaximum is that it strongly depends on my starting point (in this case 0.02). For Example, if you run the following:

Do[Print[maxEwaarde[zeta]], {zeta, 0.01, 0.1, 0.01}]

you see that the maximum is always on the same x1 position. And if you plot the Esf function, you see that FindMaximum gives the wrong position!

zetac = 0.0311
Plot[Esf2[x1, zetac], {x1, -0.2, 0.2}, AxesOrigin -> Automatic]

When I use FindMaxValue, it looks like its giving me the right maximum, only now I can't study the evolution of the x position.

maxblabla[zeta_?NumericQ] := FindMaxValue[Esf2[x1, zeta], {x1, 0.001, 0.002}]

Does somebody now what I am doin wrong with FindMaximum? Or how i can get FindMaxValue to give me the x position?

Thanks a lot!!!

share|improve this question
From the help in FindMaxValue[] : FindArgMax gives the location of the maximum as a list: –  belisarius Apr 6 '13 at 18:03
Thanks, first i thought it was giving me the same problem as FindMaximum, but now i see you also can give 2 starting points to FindArgMax. So my problem with FindMaximum is the use of derivatives then? –  cherzieandkressy Apr 6 '13 at 18:12
@Sibylle Have you tried using NMaximize with various Method settings instead of FindMaximum? NMaximize has methods to find the global maximum. FindMaximum is faster, but it doesn't try as hard: it stops at the first local maximum found. (It's too late at night here for me to try now ...) –  Szabolcs Apr 7 '13 at 4:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.