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 tried the following but plotting the function clearly reveals that there is a global maximum around $r = 7$ (here $a = 0.53$)

FindMaximum [{r^2*(Exp[-(r)/(3 a)]* (27 a^2 - 18 a r + 2 r^2)/(9 a^2))^2 ,
              0 <= r < Infinity}  , {r, 0}]

{0.253131, {r -> 0.39222}}

I tried NMaximum, Max, MaxValue, Maximize, FindMaxValue, FindMaximum but nothing works!

(..I wonder why there are so many maxima finding functions anyway!..)

share|improve this question

closed as too localized by Oleksandr R., Silvia, Sjoerd C. de Vries, m_goldberg, Yves Klett Apr 30 '13 at 6:34

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Why don't you do it the calculus way: find those r's that zero the first derivative of the function? –  Spawn1701D Apr 19 '13 at 2:36
    
"(...I wonder why there are so many maxima finding functions anyway!...)" - because some of the functions are intended for local optima, and some of them attempt to find global optima. –  J. M. Apr 19 '13 at 2:47
    
possible duplicate of How to find all the local minima/maxima in a range –  Silvia Apr 29 '13 at 18:50
add comment

1 Answer 1

According to the documentation, don't use floating point numbers when finding global maxima:

a = 53/100;
Maximize[{r^2*(Exp[-(r)/(3 a)]*(27 a^2 - 18 a r + 2 r^2)/(9 a^2))^2, 
0 <= r < Infinity}, r] // N

(* {1.73265, {r -> 6.92924}} *)
share|improve this answer
    
Thanks! But why is this "//N" important? I am getting some "garbage" if I remove that. –  user6818 Apr 19 '13 at 3:23
5  
It's not garbage, it's the exact symbolic solution. The //N converts the exact solution to a floating point number. –  Mike Z. Apr 19 '13 at 3:27
    
Z I get this - (how is this a "symbolic solution") - {(1/639128961) E^(-(200/159) Root[-12059037 + 37921500 #1 - 19080000 #1^2 + 2000000 #1^3 &, 3]) Root[-12059037 + 37921500 #1 - 19080000 #1^2 + 2000000 #1^3 &, 3]^2 (75843 - 95400 Root[-12059037 + 37921500 #1 - 19080000 #1^2 + 2000000 #1^3 &, 3] + 20000 Root[-12059037 + 37921500 #1 - 19080000 #1^2 + 2000000 #1^3 &, 3]^2)^2, {r -> Root[-12059037 + 37921500 #1 - 19080000 #1^2 + 2000000 #1^3 &, 3]}} –  user6818 Apr 21 '13 at 21:37
    
Also how can I tweak it to tell me all the local maxima and that as a function of "a". Without having to assign any particular value of "a"? (just that a is always some real number) –  user6818 Apr 21 '13 at 21:39
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.