Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2009

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

Search the Archive

Re: Maximizing function which defines a routine

  • To: mathgroup at
  • Subject: [mg95329] Re: Maximizing function which defines a routine
  • From: dh <dh at>
  • Date: Thu, 15 Jan 2009 06:14:08 -0500 (EST)
  • References: <gkkf2v$gp1$>

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:


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


  • Prev by Date: Re: passing initial point to LinearProgramming
  • Next by Date: Re: How to modify an Excel file
  • Previous by thread: Maximizing function which defines a routine
  • Next by thread: Re: Maximizing function which defines a routine