Problem with NMaximize
- To: mathgroup at smc.vnet.net
- Subject: [mg68827] Problem with NMaximize
- From: Lee Newman <leenewm at umich.edu>
- Date: Sun, 20 Aug 2006 04:43:45 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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