MathGroup Archive 2006

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

Search the Archive

Problem to evaluate a function inside a function


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: 2D FT of f(r): Fast Hankel Transforms
  • Next by Date: Re: if I open multiple files in Mathematica
  • Previous by thread: Re: Re: 2D FT of f(r): Fast Hankel Transforms
  • Next by thread: Re: Problem to evaluate a function inside a function