Author 
Comment/Response 
Robin Naidoo

09/30/00 07:26am
I am using FindMinimum to try and construct a ''shooting method'' algorithm for a problem where I have 4 coupled 1st order nonlinear ODE's, two having initial conditions and 2 having final conditions. Thus, I am trying to ''guess'' at the initial conditions that are missing, and then evaluate how close the end conditions using these guesses are to the correct end conditions. The pertinent part of the code is:
gridsearch[f_,
g_] := (solution =
NDSolve[{eqt1, eqt2, eqt3, eqt4, x[0] == 2,
B[0] == 3, Mu[0] == f, Lambda[0] == g}, {x[t],
B[t],Lambda[t], Mu[t]}, {t, 0, time}]; Mutable =
Table[Evaluate[Mu[t] /. solution, {t, 0, time}]];
Lambdatable = Table[Evaluate[Mu[t] /. solution, {t, 0, time}]];
(Extract[Lambdatable[[time]], 1] 
0)^2 + (Extract[Mutable[[time]], 1]  0)^2)
(*the last line of the function returns a measure of the difference between the correct end conditions and end conditions obtained using the current guess; the object is to minimize this  ideally so that it is 0)
FindMinimum[gridsearch[r,s], {r, 1}, {s, 1}, AccuracyGoal > 12,
PrecisionGoal > 12, WorkingPrecision > 15,
MaxIterations > 100]
When I run this I get the following error message:
FindMinimum::''fmgz'': ''Encountered a vanishing gradient. The result returned
may not be a minimum; it may be a maximum or a saddle point.''
{40.9321, {r > 1., s > 1.}}
What happens consistently, regardless of the initial values chosen, is no departure from the initial values.
The problem does not seem to be with the NDSolve portion of the code, as this works when run separately.
Any ideas?
Thanks a lot, Robin
URL: , 
