MathGroup Archive 2010

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

Search the Archive

Re: problems with NMinimize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109406] Re: problems with NMinimize
  • From: Joe Hays <hays.joe at gmail.com>
  • Date: Sun, 25 Apr 2010 06:25:55 -0400 (EDT)

I agree with Ingolf.

On Sat, Apr 24, 2010 at 4:01 AM, Ingolf Dahl <ingolf.dahl at physics.gu.se>wrote:

> Is there any serious Mathematica user in this forum, which has not stumbled
> on this problem one or several times, when NMinimize, or some other
> function, tries to evaluate a numeric function symbolically first, before
> inserting the numbers? Sometimes it would be nice to have an option,
> SymbolicEvaluation->False, which could be set for NMinimize in these cases.
> It is not always so convenient to have to define an extra function just to
> take care of this. I think there is a whole group of commands acting
> similarly to NMinimize.
>
> Ingolf Dahl
> Sweden
>
>
>
> -----Original Message-----
> From: Bob Hanlon [mailto:hanlonr at cox.net]
> Sent: den 23 april 2010 09:51
> To: mathgroup at smc.vnet.net
> Subject: [mg109376] [mg109370] Re: problems with NMinimize
>
>
> Define a function that only evaluates for numeric arguments
>
> f[a_?NumericQ, b_?NumericQ] :=
>  Abs[NIntegrate[Sin[x], {x, -a, b}]]^2
>
> NMinimize[f[a, b], {a, b}]
>
> {7.56317*10^-19,{a->0.131888,b->-0.131888}}
>
>
> Bob Hanlon
>
> ---- Neil Broderick <ngb at ecs.soton.ac.uk> wrote:
>
> =============
> Hi,
> I am trying to use NMinimize to find the solutions to various numerical
> equations and I keep getting error
> messages concerning non-numerical values. For example consider the
> following:
>
> In[2]:= NMinimize[Abs[NIntegrate[Sin[x], {x, -a, b}]]^2, {a, b}]
>
> During evaluation of In[2]:= NIntegrate::nlim: x = -1. a is not a valid
> limit of integration. >>
>
> During evaluation of In[2]:= NIntegrate::nlim: x = -1. a is not a valid
> limit of integration. >>
>
> During evaluation of In[2]:= NIntegrate::nlim: x = -1. a is not a valid
> limit of integration. >>
>
> During evaluation of In[2]:= General::stop: Further output of
> NIntegrate::nlim will be suppressed during this calculation. >>
>
> Out[2]= {5.08978*10^-24, {a -> 0.0994414, b -> 0.0994414}}
>
> My actual problem involves taking Fourier transforms of lists of numbers
> but
> you get the picture. Why is
> NMinimize putting variables into the function rather than just numbers and
> is the likely to cause a problem
> in some cases?
>
> regards,
> Neil=
>
>


  • Prev by Date: Re: Function to detect presence of a variable in
  • Next by Date: Re: Kernel crash, version 7.0, windows XP, when using
  • Previous by thread: Re: problems with NMinimize
  • Next by thread: Re: problems with NMinimize