Hello everybody I try to find ALL the maxima of a function and plot the points where the maxima are.
The Function is:
U[x_,y_,a_]:=-((1-a)/Sqrt[(x-a)^2+y^2])-a/Sqrt[(x+1-a)^2+y^2]- 0.5*(x^2+y^2);
Of course this is a 3D function but i satisfied also if someone give me a code to find all maxima with the 2D version of the function. I put a graph of the function.
points1=Table[{x, 2*U[x, 0, a]}, {x, -1.5, 1.5,0.005}];
ListPlot[points1, Joined->True,PlotRange->{{-1.5,1.5},{-5.5,-3.0}},
AxesLabel->{"x","cost. di Jacobi"}]
I saw a similar post but with a more complex function so i can't understand how modify the code: https://mathematica.stackexchange.com/questions/5575/how-to-find-all-the-local-minima-maxima-in-a-range .
Some one can help me? Thanks.