Mathematica Minimum function path on a surface with Mathematica

AI Thread Summary
The discussion focuses on using Mathematica to find a minimum energy path (MEP) on a defined surface represented by a function f(a,b). The user, Evgeniy, seeks to plot a continuous path that starts from a specific point (a0, b0) and follows the minimum of f(a,b). Suggestions include using differential equations to model the trajectory or employing a looping method to iteratively find the minimum by evaluating points around the starting location. Evgeniy finds the latter approach effective and considers refining it by restricting the search area to a sector rather than a circle. The conversation highlights the importance of accurately representing the surface and the methods to achieve the desired path.
evgenx
Messages
14
Reaction score
0
Hello,

I am trying to solve the following problem using Mathematica:

I have (defined) a surface of two variables, say f(a,b). Now I want to
plot a path (a line) that corresponds to min[f(a,b)] starting from
certain valus of a and b (say a0,b0). In other words the path always proceeds through
the minimum of f(a,b), starting from f(a0,b0), but it should be continuous(!).

I will apreceate very very much any hint how to do it in Mathematica.
Many thanks!


Evgeniy
 
Physics news on Phys.org
It isn't clear to me how much of this you know how to do and what parts you need help with.

Are you able to find the {a,b} that correspond to the minimum of f[]?

Once you have that are you perhaps looking for a parametric equation that gives you {at,bt} where {at,bt}={a0,b0} when t=0 and {at,bt}={a,b} when t=1?

Am I anywhere near what you are looking for?

Either way, please give a more precise description of what you are looking for, what you know how to do, what you have already done and where you are stuck. A concrete example f and {a0,b0} would also help.
 
Hi,

thanks for your response. Here are some more details on the problem (sorry that
I didn't give them in the first post):

the surface is defined as follows:

surf=Interpolation[{
{{150.0, 150.0}, 3.096864},
{{150.0, 160.0}, 3.046994},
{{150.0, 170.0}, 3.009620},
{{150.0, 180.0}, 2.989012},
{{150.0, 190.0}, 2.986530},
{{150.0, 200.0}, 3.002286},
{{150.0, 210.0}, 3.035953},

{{160.0, 150.0}, 3.086955},
{{160.0, 160.0}, 3.034026},
{{160.0, 170.0}, 2.998120},
{{160.0, 180.0}, 2.981648},
{{160.0, 190.0}, 2.983551},
{{160.0, 200.0}, 3.003376},
{{160.0, 210.0}, 3.041179},

{{170.0, 150.0}, 3.071875},
{{170.0, 160.0}, 3.020885},
{{170.0, 170.0}, 2.987889},
{{170.0, 180.0}, 2.973381},
{{170.0, 190.0}, 2.978328},
{{170.0, 200.0}, 3.003711},
{{170.0, 210.0}, 3.046983},

{{180.0, 150.0}, 3.059369},
{{180.0, 160.0}, 3.011611},
{{180.0, 170.0}, 2.980452},
{{180.0, 180.0}, 2.968498},
{{180.0, 190.0}, 2.978878},
{{180.0, 200.0}, 3.008716},
{{180.0, 210.0}, 3.055378},

{{190.0, 150.0}, 3.050455},
{{190.0, 160.0}, 3.006078},
{{190.0, 170.0}, 2.979718},
{{190.0, 180.0}, 2.973050},
{{190.0, 190.0}, 2.985642},
{{190.0, 200.0}, 3.017429},
{{190.0, 210.0}, 3.067576},

{{200.0, 150.0}, 3.044132},
{{200.0, 160.0}, 3.005296},
{{200.0, 170.0}, 2.984163},
{{200.0, 180.0}, 2.980781},
{{200.0, 190.0}, 2.995990},
{{200.0, 200.0}, 3.030428},
{{200.0, 210.0}, 3.082939},

{{210.0, 150.0}, 3.038026},
{{210.0, 160.0}, 3.003644},
{{210.0, 170.0}, 2.986792},
{{210.0, 180.0}, 2.988001},
{{210.0, 190.0}, 3.007861},
{{210.0, 200.0}, 3.044050},
{{210.0, 210.0}, 3.093928}
},Method->Spline]

f=Function[{a,b},surf[a,b]]

The path (curve) I want to find (plot) can be looked upon as a trajectory for a particle
(m=1) that starts moving on the above surface from (a0=180.0 , b0=180.0) with some initial velocity v_init={0; v_b}, i.e. the particle has some initial impulse only along coordinate b; along coordinate a it is 0. At a certain v_init the particle should proceed along the so-called minimum energy path (MEP) for b, which I want to find. (f is basically the potential energy surface).

The surface f(a,b) is "bound" (has a parabolic form) from {180.0,180.0}
till {~198.9, ~159.8}. The latter point is an inflection point for coordinate a. I have defined the MEP for b from {180.0,180.0} till {~198.9, ~159.8} by simply finding
the minimum of f(a,b) for b varying from 180.0 till 159.8. For b<159.8 this doesn't work because here f is "unbound" with respect to a.

Well, I think the easeist way to find MEP for b is to run trajectories for a few different
v_init to find its optimimal value, i.e. the minimal value of v_init at which the particle
moves only forward along b.

(Sorry if it is still not entirely clear)


Evgeniy
 
I did a ListPlot3D on your data and the surface has a sawtooth appearance. I don't know whether your real surface has that appearance or whether the plot just appears this way because of the limited number of data points. If you look at that plot does that accurately represent your surface? A "smooth" surface might more easily yield a robust solution, but we deal with what you have.

Could you possibly express your problem in the form of a system of differential equations involving initial and final position, velocity and acceleration? If so then DSolve or NDSolve might be an approach. That is just my first idea for how to mount an attack on this.
 
Ok, think I have something: start with point zstart=a+bi. Now draw a small circle around that point and compute f(a,b) over those values. Find the mininum value, then let zstart=min. Loop.

Here's the quick code. I only let it go 10 iterations. Not sure how to stop it automatically. Maybe you can figure it out.

Code:
rdelta = 1; 
thepointTable = {}; 
zstart = 200 + 200*I; 
For[n = 1, n <= 10, n++, 
  mycircle = Table[{Re[z], Im[z], f[Re[z], Im[z]]} /. z -> zstart + rdelta*Exp[I*t], 
     {t, 0, 2*Pi, 0.25}]; themin = First[Position[mycircle, 
      Min[(#1[[3]] & ) /@ mycircle]]]; zstart = mycircle[[themin[[1]],1]] + 
     I*mycircle[[themin[[1]],2]]; thepointTable = Append[thepointTable, zstart]; ]
thepointTable
thevalues = ({Re[#1], Im[#1], f[Re[#1], Im[#1]]} & ) /@ thepointTable
myline = Graphics3D[{Thickness[0.01], Red, Line @@ {thevalues}}]
mystart = Graphics3D[{PointSize[0.02], Red, 
    Point[{Re[zstart], Im[zstart], f[Re[zstart], Im[zstart]]}]}]
myplot = Plot3D[f[a, b], {a, 150, 210}, {b, 150, 210}, PlotStyle -> Yellow]
Show[{myplot, mystart, myline}]
 
Hi Bill Simpson and Jackmell,

Thanks a lot for your replies. The surface actually looks smooth if you just plot
f[a,b]; I mean Plot3D[f[a,b],{a,160,210},{b,160,210}]. Well, to run trajectories
on that surface one should solve a set of 4 equations, i.e. two conjugated pairs
(coordinate and impulse): dq/dt=p/m and dp/dt=-(df[a,b]/dq). It will take some
time (at least for me) to implement it and I will postpone it for a while.

On the other hand, what Jackmell suggested is a very nice circumventing way to
find the minimum energy path (MEP). It seems to work quite well. In fact, the idea with
the circle is just smack. Well, I didn't know how to make a circle restriction and
your way is very elegant. Actually I am interested for the MEP that starts from
point (180,180) and goes kind of "uphill", i.e. "b" should increase (on average) or
keep the same value while "a" can take any value. I think to get this I should make
another restriction, namely instead of taking a circle I should specify a sector,
i.e. Exp[I*t],{t,Pi/2,Pi}. Looks like it works :)

Many thanks for your help once again!

Best wishes,
Evgeniy
 

Similar threads

Replies
1
Views
2K
Replies
4
Views
1K
Replies
1
Views
2K
Replies
1
Views
4K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Back
Top