MathGroup Archive 2006

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

Search the Archive

Re: Problem to evaluate a function inside a function

  • To: mathgroup at
  • Subject: [mg64188] Re: [mg64156] Problem to evaluate a function inside a function
  • From: Darren Glosemeyer <darreng at>
  • Date: Sat, 4 Feb 2006 04:13:43 -0500 (EST)
  • Sender: owner-wri-mathgroup at

It is tough to say for certain without seeing the actual example.  One 
possibility is that chi2 may also need ?NumericQ checks on its 
arguments.  Another possibility is that both definitions of ePhip existed 
at the same time.  If the ?NumericQ checks were added to ePhip without 
clearing the definition of ePhip that did not have ?NumericQ checks, the 
version without the ?NumericQ checks would still get evaluated first.

Darren Glosemeyer
Wolfram Research

At 07:09 PM 2/2/2006 -0500, =?GB2312?Q?St=A8=A6phane_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: Re: SetPrecision causes logical comparisons to fail in Mathematica 5.1 on Mac OS X?
  • Next by Date: Goedel Numbers
  • Previous by thread: Re: Problem to evaluate a function inside a function
  • Next by thread: FindFit and NormFunction