Re: NDSolve with momentum
- To: mathgroup at smc.vnet.net
- Subject: [mg105466] Re: NDSolve with momentum
- From: dh <dh at metrohm.com>
- Date: Fri, 4 Dec 2009 04:31:02 -0500 (EST)
- References: <hf86m0$17g$1@smc.vnet.net>
Gareth Russell wrote: > Hi, > > Does anyone know how to use NDSolve to create the trajectory of motion > of a point following positive gradients on an arbitrary landscape (a > ListStreamPlot-like path), but with 'momentum'? The idea is that the > trajectory would not terminate on smaller local maxima, depending on > the momentum term. > > I don't know exactly how ListStreamPlot does its thing -- I would guess > it interpolates the array of gradient pairs, and then uses NDSolve to > find the paths. If so, is there way to modify that basic idea to > include a momentum-like term? Or would I need to do a full physics-type > model as if I were modelling a ball with mass, gravity, friction, etc.? > > Thanks, > Hi Garteh, if I understand correctly, you want something like simulated annealing. Thsi can be donme by: NMinimize[f, vars, Method -> "SimulatedAnnealing"]. On the other hand, if you want the momentum-friction approach, here is an example: Clear[mass, friction, x, y, pos, position, pot, grad]; mass = 1; friction = 0.3; tmax = 10; pot[pos_] := pos.pos; grad[{x_, y_}] = Evaluate[{D[pot[{#1, #2}], #1], D[pot[{#1, #2}], #2]}] & @@ {x, y}; position = pos /. NDSolve[{-grad[pos[t]] - friction (pos'[t].pos'[t]) == pos''[t] mass, pos[0] == {1, 0}, pos'[0] == {0, 1}}, pos, {t, 0, tmax}][[1]] ParametricPlot[position[t], {t, 0, tmax}, AspectRatio -> Automatic, PlotRange -> All] Daniel