Re: Problem to evaluate a function inside a function
- To: mathgroup at smc.vnet.net
- Subject: [mg64178] Re: Problem to evaluate a function inside a function
- From: dh <dh at metrohm.ch>
- Date: Sat, 4 Feb 2006 04:13:31 -0500 (EST)
- References: <dru7co$a3r$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Stephan,
I can not reproduce your problem.
The following works fine:
f1[x_, y_] := f2[x, y];
f2[x_, y_] := x^2 + y^2;
FindMinimum[f1[x, y], {{x, 1}, {y, 1}}]
Is your problem not where you think it is???
Maybe you should give a simple example of your problem that can be run.
Daniel
Stéphane Fay wrote:
> Dear everyone,
>
> I have defined a function chi2[¦¸m_, ¦Í_, ¦£_, data_] and when I compute
> chi2[0.27, -0.1, 0.1, data], it works well and I find 183.987. Now I
> try to find the minimum of this function by writting
>
> FindMinimum[chi2[¦¸m, ¦Í, ¦£, data], {{¦¸m, 0.25, 0.30}, {¦Í, -0.1, 0.2},
> {¦£, 0.1, 0.2}}]
>
> and get the error message
>
> NDSolve::ndnum: Encountered non-numerical value for a derivative at z == 0.`.
>
> Apparently the problem is the folowwing:
>
> Inside my function chi2[¦¸m_, ¦Í_, ¦£_, data_] I have another function
> ePhip[¦¸mp_, ¦Íp_, ¦£p_] that I try to compute with ePhi = ePhip[¦¸m, ¦Í,
> ¦£] but Mathematica do not evaluate ¦¸m, ¦Í and ¦£ in ePhip and thus get a
> non numerical value.
>
> I tried to solve the problem by using Evaluate or writing
> ePhip[¦¸mp_?NumericQ, ¦Íp_?NumericQ, ¦£p_?NumericQ] but nothing works.
>
> Does anybody has a solution?
>
> Thank you very much for your help
>
> Yours sincerely
>
> St¨¦phane
>