Problem with order of evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg49940] Problem with order of evaluation
- From: Max Ulbrich <ulbrich at biochem.mpg.de>
- Date: Sat, 7 Aug 2004 03:51:33 -0400 (EDT)
- Organization: GWDG, Goettingen
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I want to find a minimum in dependence of an initial
condition of a differential eqaution. I can define a
function f[y]:
L=3.*^-9;
g[y_]=NDSolve[{p''[x]==-1.*^9(43418E^(-38p[x])-43418E^(38p[x])),p[0]==-0.13,p'[0]==y},p[x],{x,0,L}]
f[y_]:=((p[x]/.g[y]/.x->L)[[1]])^2
which evaluates properly:
f[0.22*^8]
However, Mathematica doesn't evaluate it properly when I try
NMimimize, FindRoot or whatever:
<<NumericalMath`NMinimize`
NMinimize[f[y],{y,0.1*^8,0.3*^8}]
How do I have to define f[y] that this works?
Thanks a lot,
Max