Re: Warning Message wrt NMinimize function

• To: mathgroup at smc.vnet.net
• Subject: [mg69746] Re: [mg69731] Warning Message wrt NMinimize function
• From: "Chris Chiasson" <chris at chiasson.name>
• Date: Fri, 22 Sep 2006 01:04:15 -0400 (EDT)
• References: <200609211132.HAA07874@smc.vnet.net>

```Maybe you should provide the expression for aa, bb, and n. Also, in
regular least squares curve fitting, there is no restriction on the
parameter space (no restriction on y).

In[1]:=
aa=Table[Random[],{20}]

Out[1]=
{0.303766,0.14977,0.225405,0.0994793,0.358193,0.137617,0.305444,0.0196565,0.\
418029,0.386865,0.416273,0.492426,0.207767,0.486231,0.426445,0.370501,0.\
191603,0.921002,0.481863,0.353564}

In[2]:=
bb=Table[y Random[],{20}]

Out[2]=
{0.227101 y,0.239582 y,0.0272011 y,0.286646 y,0.923335 y,0.0898122 y,
0.801797 y,0.187167 y,0.565142 y,0.952195 y,0.496352 y,0.16751 y,0.147113 y,
0.56533 y,0.0800794 y,0.675084 y,0.939346 y,0.0790994 y,0.653634 y,
0.304583 y}

In[3]:=
NMinimize[{Plus@@Table[(aa[[i]]-bb[[i]])^2,{i,Length@aa}],{y>0}},y,
Method\[Rule]"DifferentialEvolution"]

Out[3]=
{1.46278,{y\[Rule]0.530985}}

> Hello Everyone,
>
> I want to use NMinimize to solve an optimization problem. In essence, I'm
> trying to numerically minimize the "sum of a square of errors" for two
> lists, aa and bb (earlier generated lists of n elements or points), using
> the below syntax:
>
>  NMinimize[{Plus @@ Table[(aa[[i]] - bb[[i]])^2, {i, n}], {y> 0}}, y,
> Method -> "DifferentialEvolution"]
> This does not yield the intended result of, say, {minimumvalue, y->10.012}.
> I have been getting an expression (unevaluated "result" ) with a warning
> message such as:
>
> NMinimize::nnum : The function value {336.381} is not a number at {y}=
> {0.063703}. More...
>
> I then clicked on 'More' for help. I got the below message from the help
> browser:
>
> "General::nnum
>
> function::nnum: The function value `3` is not a number at `2` = `1`.
>
> Notes for this message have not yet been added."
>
> Has anyone experienced this before? Is anything wrong with my syntax above?
>
>
> John.
>
>
>
>
>
>
>

--
http://chris.chiasson.name/

```

• Prev by Date: Re: does the following code shut down anyone else's kernel? - why?
• Next by Date: Re: webMathematica, Packages, and hostSRV.com
• Previous by thread: Warning Message wrt NMinimize function
• Next by thread: Re: Warning Message wrt NMinimize function