Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

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

Search the Archive

Re: NMinimize problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132358] Re: NMinimize problem
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 19 Feb 2014 02:01:51 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

On 2/17/14 at 11:05 PM, reiser.paul at gmail.com (PAR123) wrote:

>I have a function f[x] which I want to minimize, but its rather
>involved, it will return a number for a numerical x, but if x is
>symbolic, it's not going to happen.

>Trying to use NMinimize, I get errors that are consistent with
>NMinimize calling f[] with a symbolic argument. Is there something
>simple I am doing wrong?

To prevent a function from evaluating with symbolic arguments
define it this way:

In[1]:= f[x_?NumericQ] := 2 x

In[2]:= f[4.7]

Out[2]= 9.4

In[3]:= f[y]

Out[3]= f(y)

Without more detail of your specific issue there isn't anything
I can suggest beyond defining the function to only evaluate with
numeric arguments.




  • Prev by Date: Re: Minimization problem
  • Next by Date: How to replace some variables and how to solve a differential equation?
  • Previous by thread: NMinimize problem
  • Next by thread: How to replace some variables and how to solve a differential equation?