MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem to evaluate a function inside a function

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.


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

  • Prev by Date: Re: Trigonometric form of complex numbers
  • Next by Date: Re: t-test question
  • Previous by thread: Problem to evaluate a function inside a function
  • Next by thread: Re: Problem to evaluate a function inside a function