How to use NMinimize with a numerical function
- To: mathgroup at smc.vnet.net
- Subject: [mg65362] How to use NMinimize with a numerical function
- From: Marco Gabiccini <m.gabiccini at ing.unipi.it>
- Date: Tue, 28 Mar 2006 04:05:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, I wanted to test NMinimize[] with a numerical function whose return value is the result of another NMinimize. I defined the intersection with the abscissa of the parabola y=ax^2+bx+c as f[a,b,c] and I want to find one set of values {a,b,c} for which that intersection is reached at x=-2. I defined f[a_, b_, c_] := Module[{x}, NMinimize[{(a x^2 + b x + c)^2}, x][[2, 1, 2]]] and I would like to find that particular value of {a,b,c} for which f[a,b,c]=-2, that is why I call FindMinimum[(f[r, s, t] + 2.0)^2, {{r, -5, 5}, {s, -5, 5}, {t, -5, 5}}] but I get this error message 1760692.jpg [Attachments are not permitted. Please contact the author to obtain this - moderator] It seems that the latter FindMinimum[] keeps the r,s,t unevaluated when calling f in the first FindMinimum. Is there a way to switch the order of evaluation? Can anybody help me? Marco