[Date Index]
[Thread Index]
[Author Index]
Re: Problems with FindMinimum
*To*: mathgroup at smc.vnet.net
*Subject*: [mg90724] Re: Problems with FindMinimum
*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
*Date*: Mon, 21 Jul 2008 04:29:40 -0400 (EDT)
*Organization*: The Open University, Milton Keynes, UK
*References*: <g5v5mf$ia9$1@smc.vnet.net>
teodorom at hotmail.com wrote:
> I'm having problems with the FindMinimum.
> I'm currently getting errors like this:
> FindMinimum::nrlnum: The function value {0.335521+43899.8 \
> [ImaginaryI],0.376043+43899.8 \[ImaginaryI],0.424669+43899.8 \
> [ImaginaryI],<<6>>,0.311208+46311.9 \[ImaginaryI],<<27>>} is not a
> list of real numbers with dimensions {37} at {x0,y0,x1,y1,hh0,hh1} =
> {0.00580647,-2.13969*10^20,-9.86301*10^-6,1.23875*10^20,-30574.3,19.6042}.
> I guess this happens because the function I'm trying to fit with
> experimantal data, gets imaginary values for some values of the
> parameters.
> How can I avoid this and get meaningful results ?
Hard to tell w/o more information about what your code actually is. It
would have been very helpful for the group if you had posted an small
self-contained fully-working example that reproduces the error and gives
the gist of what you are doing.
Anyway, the following tip might help you. Sometimes, it is a good idea
to write a model in a slightly different way to force Mathematica to use
real numbers only. For instance, evaluate and compare the following
expressions that all deal with the same function (cubic root of a
square) but written in different fashions. (The graphics have been deleted.)
In[1]:=
f = x^(2/3);
Plot[f, {x, -1, 1}]
FindMinimum[f, {x, 1}]
During evaluation of In[1]:= FindMinimum::nrnum:The function value
-0.381571+0.660901 I is not a real number at {x} = {-0.666667}.
Out[3]= {1., {x -> 1.}}
In[4]:=
f = (x^2)^(1/3);
Plot[f, {x, -1, 1}]
FindMinimum[f, {x, 1}, WorkingPrecision -> 20] // Chop
During evaluation of In[4]:= FindMinimum::lstol:The line search
decreased the step size to within tolerance specified by
AccuracyGoal and PrecisionGoal but was unable to find a sufficient
decrease in the function. You may need more than 20.` digits of
working precision to meet these tolerances.
Out[6]= {0, {x -> 0}}
Regards,
-- Jean-Marc
Prev by Date:
**Re: export eps**
Next by Date:
**Re: On default numerical precision**
Previous by thread:
**Re: Problems with FindMinimum**
Next by thread:
**RE: Problems with FindMinimum**
| |