0
$\begingroup$
FindMaximum[1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, u}]

doesn't work. It gave me that :

FindMaximum::fmgz: Encountered a gradient that is effectively zero. The result returned may not be a maximum; it may be a minimum or a saddle point.

$\endgroup$
  • $\begingroup$ A ContourPlot would help at it appears there are two points that result in a maximum: ContourPlot[ 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, -4, 4}, {u, -4, 4}] $\endgroup$ – JimB Jul 25 '16 at 19:22
  • $\begingroup$ Try NMaximize[ 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, u}]. $\endgroup$ – Karsten 7. Jul 25 '16 at 19:34
  • $\begingroup$ NMaximize[ 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, u}, Method -> "RandomSearch"] finds the other one. $\endgroup$ – Karsten 7. Jul 25 '16 at 19:37
  • $\begingroup$ Maximize works as well, giving both solutions $\endgroup$ – george2079 Jul 25 '16 at 19:37
3
$\begingroup$

A DensityPlot helps in picking good starting values for FindMaximum:

DensityPlot[
 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, -5, 5}, 
 {u, -5, 5}, PlotRange -> All, PlotPoints -> 50, PlotLegends -> Automatic]

enter image description here

Then using the aproximate values from the DensityPlot FindMaximum locates one of the points

FindMaximum[
 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {{o, -1}, {u, 1}}]

{1., {o -> -0.840896, u -> 0.840896}}

And the other point is at the opposite sign of o and u

Another option is:

NMaximize[
 1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, u}]
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Alternatively, one could locate the extrema in this way: ContourPlot[Thread[D[((o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2))^2/2, {{o, u}}] == 0] // Evaluate, {o, -5, 5}, {u, -5, 5}] $\endgroup$ – J. M.'s technical difficulties Jul 25 '16 at 19:41
  • $\begingroup$ thank you so much , it works , i appreciate, thanks again $\endgroup$ – khalid Jul 25 '16 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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