| Author |
Comment/Response |
Bill Simpson
|
09/17/12 1:17pm
In Response To 'Re: Re: FindMinimum <-> NDSolve conflict' --------- I still feel this is a very very bad way of doing this, but I did get it to display some diagnostics as NMinimize crawls toward finding the t which minimizes the function and finding the b parameter which minimizes this.
In[1]:= testFct[b_?NumericQ]:=(
sol=y/.NDSolve[{y''[t]==10,y[0]==b^2+1,y'[0]==0},y,{t,-1,1}][[1]];
v=t/.NMinimize[sol[t],{t}][[2]];
Print[{b,v,sol[v]}];
sol[v]
);
NMinimize[testFct[b],{b}];Print[{b,v,sol[v]}];
<warnings, that worry me and I can't seem to get rid of, about Attributes snipped>
From In[1]:= {-0.9362, -1.5306*^-9, 1.87664}
From In[1]:= {0.2804, 3.6681*^-9, 1.0786}
From In[1]:= {0.4486, 3.6681*^-9, 1.2012}
...
From In[1]:= {-7.8836*^-9, 3.6681-9, 1.}
and finally the b parameter which minimizes the solution.
From In[1]:= {b, 3.6681*^-9, 1}
If you delete the inner Print you will remove the diagnostics information, but see no sign of progress while this grinds and grinds trying to find the solution.
It is perhaps not surprising that it seems so many users, myself included, do not really understand the depths of NDSolve[..., y, t] versus NDSolve[..., y[t], t], handling explicit functions versus InterpolatingFunction and the interactions involved in finding parameters which minimize solutions from DSolve and NDSolve.
URL: , |
|