Re: Maximizing function which defines a routine

*To*: mathgroup at smc.vnet.net*Subject*: [mg95329] Re: Maximizing function which defines a routine*From*: dh <dh at metrohm.com>*Date*: Thu, 15 Jan 2009 06:14:08 -0500 (EST)*References*: <gkkf2v$gp1$1@smc.vnet.net>

Hi Mark, assuming that you have G[x,y] that returns: {a,b,c}, you may maximize G over x with e.g. y=1 by: NMaximize[G[x,1][[1]],x Here is a simplified example: G[x_] := {-(x - 1)^2, 1}; NMaximize[G[x][[1]], x]] hope this helps, Daniel Mark wrote: > (Apologies up front for my utter lack of programming ability--the only language Ive ever really programmed in is Basic and I havent even done much of that) > > I have a function "G" in two arguments (x,y) which uses a loop (Im using label/goto for this loop if that gives any idea of my programming abilities) to alter the values of three "state" variables (a,b,c). The output of this function is to store the final values of these three variables a,b,c, (globally). > > Is it possible in Mathematica to use Maximize or NMaximize on this function, in order to, for example, find the "x" which maximizes "a" (given y)? > > Thanks in advance for any help (and please let me know if this question is too vague or too poorly worded), > Mark >