Re: Tricky visualization of maximization problem
- To: mathgroup at smc.vnet.net
- Subject: [mg71009] Re: Tricky visualization of maximization problem
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 4 Nov 2006 23:07:03 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <eihm95$ov4$1@smc.vnet.net>
Uwe Ziegenhagen wrote:
> Hi,
>
> I want to maximize
>
> x1^2 + 4*x1*x2 + 3*x2^2 (eq.1)
>
> under the constraint
>
> x1^2 + x2^2 == 1 (eq. 2)
>
> So far no problem, Maximize gives me 2 + sqrt(5)
>
> But how can I display this visually?
>
> For eq. 1 I can use Plot3D[], for eq. 2 ImplicitPlot[] but how to have
> them in one picture?
>
>
> Thanks in advance,
>
>
> Uwe
>
DisplayTogether will plot both graphs.
eq1 = x1^2 + 4*x1*x2 + 3*x2^2;
eq2 = x1^2 + x2^2;
Maximize[{eq1, eq2 == 1}, {x1, x2}]
<< "Graphics`Graphics`"
g1 = Plot3D[eq1, {x1, -2, 2}, {x2, -2, 2}];
g2 = Plot3D[eq2, {x1, -2, 2}, {x2, -2, 2}];
DisplayTogether[g1, g2];
DisplayTogether[g1, g2, PlotRange -> All];
Regards,
Jean-Marc