MathGroup Archive 2006

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

Search the Archive

Re: Problem with NMaximize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68857] Re: Problem with NMaximize
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 21 Aug 2006 03:28:25 -0400 (EDT)
  • References: <ec97qm$4dt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you have to prevent symbolic evaluation with

  bigfunc[x_?NumericQ,y_?NumericQ,z_?NumericQ] :=
    Module[{vars here}, large function here;  Print[y]];

Regards
   Jens


Lee Newman wrote:
> 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
> 


  • Prev by Date: RE: Re: Re: Change CellTags with FrontEnd
  • Next by Date: Re: List Help Needed
  • Previous by thread: Re: Problem with NMaximize
  • Next by thread: Re: Problem with NMaximize