Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'FindMinimum NDSolve conflict' topicStudent Support Forum > General > "FindMinimum <-> NDSolve conflict"

< Previous CommentHelp | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'FindMinimum <-> NDSolve conflict')
Author Date Posted
FindMinimum <-> NDSolve conflict Enrico 09/10/12 2:46pm
Re: FindMinimum <-> NDSolve conflict Bill Simpson 09/15/12 2:53pm
Re: Re: FindMinimum <-> NDSolve conflict Enrico 09/16/12 05:03am
Re: Re: Re: FindMinimum <-> NDSolve conflict Bill Simpson 09/17/12 1:17pm
< Previous CommentHelp | Reply To Comment | Reply To Topic