MathGroup Archive 2004

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

Search the Archive

Re: Maximize function question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46254] Re: Maximize function question
  • From: drbob at bigfoot.com (Bobby R. Treat)
  • Date: Thu, 12 Feb 2004 22:46:14 -0500 (EST)
  • References: <c0fru2$c03$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try this for locating possible extrema:

grad[f_] := (D[f, #1] & ) /@ {k, l}
obj = a*k + w*l; 
condition = q == Sqrt[k] + Sqrt[l]; 
lagrange = obj + lambda*Subtract @@ condition
Append[Thread[grad[lagrange] == 0], condition]
Simplify[First[Solve[%, {k, l, lambda}]]]
PowerExpand /@ %
Simplify[%]

Bobby

"David" <nospam at nospam.com> wrote in message news:<c0fru2$c03$1 at smc.vnet.net>...
> Hello,
> 
> I am attempting to perform a constrained optimization in Mathematica 5.0 on
> the objective function:
> 
> f(K,L)=aK+wL s.t. K^0.5 + L^0.5=Q  where a,w,Q are constant.
> 
> I define:
>     objA[K_,L_]:=rK+wL
> and
>     constraintsA = {K^0.5+L^0.5==Q,K>=0, L>=0}
> 
> After which I try to evaluate
> 
>     Maximize[{objA[K,L],constraintsA},{K,L}]
> 
> However, I receive an error message that the objective function contains a
> nonconstant expression independent of variables {K,L}.
> 
> Though the calculation is trivial and is easy to do by hand, I would like to
> be able to figure out how to do these types of optimization problems not
> having to assign real numbers to the constants for future use.  Is there an
> elegent way to do this?
> 
> Your collective help is greatly appreciated.


  • Prev by Date: Re: Maximum Problem
  • Next by Date: Re: how to explain this weird effect? Integrate
  • Previous by thread: Maximize function question
  • Next by thread: Re: Maximize function question