Problem to evaluate a function inside a function
- To: mathgroup at smc.vnet.net
- Subject: [mg64156] Problem to evaluate a function inside a function
- From: Stéphane Fay <steph.fay at gmail.com>
- Date: Thu, 2 Feb 2006 19:09:08 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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