MathGroup Archive 2005

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

Search the Archive

Constrained Optimization

  • To: mathgroup at
  • Subject: [mg57609] Constrained Optimization
  • From: Caspar von Seckendorff <seckendorff at>
  • Date: Thu, 2 Jun 2005 05:16:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


I'd like to do constrained optimization with Mathematica 5.1 on a 
function that is defined piecewise. Unfortunately Maximize[] does not 
work  as I expected. A short & simple example to illustrate:

f[x_,y_]:= (x-x^2) y
Maximize[{f[x, y], 1/5 <= x <= 2/5, y > 0}, x]

As a result I get:
"The objective function (x-x^2) y contains a nonconstant expression y 
independent of variables {x}."

Obviously for this Maximization, knowing that y > 0 I can do the 
following to get the desired value for x:

Maximize[{x-x^2, 1/5 <= x <= 2/5}, x]
Out[]= {6/25, {x -> 2/5}}

Is there a way to achieve this without manual intervention? The reason 
is, that the functions I want to Maximize are defined Piecewise with 
several constraints...



  • Prev by Date: Re: locating points in mathematica plots
  • Next by Date: Re: mml files
  • Previous by thread: Re: Re: Re: Re: Re: simple set operations
  • Next by thread: JLink /[] - ClassNotFoundException