MathGroup Archive 2006

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

Search the Archive

Re: Problem with NMaximize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68852] Re: Problem with NMaximize
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 21 Aug 2006 03:28:03 -0400 (EDT)
  • References: <ec97qm$4dt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Lee Newman schrieb:
> Dear Group,
> 
> I have function that I want to maximize.  The function calls many other 
> functions, and I have verified that on its own, it works as intended. 
> However, when I include the function in an NMaximize statement, I get 
> errors.  After including Print statements within the function (and the 
> functions that calls), it seems the problem is that the variable being 
> passed to the function by NMaximize is being treated as a undefined 
> symbol, rather than as the value currently being passed by NMaximize.
> 
> NMaximize[ {bigFunc[a,b,c]}, {{a,0,1},{b,0,2},{c,0,3}}, 
> Method->"NelderMead"];
> 
> bigfunc[x_,y_,z_] := Module[{vars here}, large function here;  Print[y]];
> 
> When called directly bigfunc[1,2,3], the print statement prints 2, the 
> correct value for argument y.
> When called within NMaximize (as above), the print statement returns b, 
> the symbolic value passed by NMaximize, and all the errors generated are 
> related to the fact that b is being treated as a undefined symbol rather 
> than a numeric value.
> 
> What am I doing wrong?
> 
> - Lee
> 
> ____________________________________________________
> L E E   N E W M A N               www.leenewman.org
>      d o c t o r a l   s t u d e n t
>           c o g n i t i v e   p s y c h o l o g y
>                c o m p u t e r   s c i e n c e
>                     u .  m i c h i g a n
>                          a n n   a r b o r
> ____________________________________________________
> 
>            Skylarks singing-
>            the farmer
>            makes a pillow of his hoe.
> 			
>                                          ISSA
> 

Hi Lee,

  what happens if you define

Nbig[params__?NumericQ]:=bigfun[params]

and use Nbig instead of bigfun in the call to NMaximize?
It _should_ work.

Peter


  • Prev by Date: Re: LegendPosition Problem
  • Next by Date: Re: Problems solving using Solve
  • Previous by thread: Problem with NMaximize
  • Next by thread: Re: Problem with NMaximize