Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Constrained Optimization

  • To: mathgroup at
  • Subject: [mg57675] Re: Constrained Optimization
  • From: dh <dh at>
  • Date: Fri, 3 Jun 2005 05:35:04 -0400 (EDT)
  • References: <d7mj30$bqm$>
  • Sender: owner-wri-mathgroup at

Hi Caspar,
see below.
sincerely, Daniel

Caspar von Seckendorff wrote:
> Hi,
> 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]
Maximize is a numerical functions. Therefore, f[,] needs numeric input. 
However, y is so far a puer symbol and has no numerical value. If I 
understand your problem correctly, y is assumed to be a constant. But in 
this case the maximum value depends on the unspecified y.
Mathematica gives you a correct error message.
> 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...
> Thanks,
> -Caspar

  • Prev by Date: Re: Constrained Optimization
  • Next by Date: Re: Constrained Optimization
  • Previous by thread: Re: Constrained Optimization
  • Next by thread: Re: Constrained Optimization