Re: Tricky visualization of maximization problem

• To: mathgroup at smc.vnet.net
• Subject: [mg71007] Re: [mg71004] Tricky visualization of maximization problem
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 4 Nov 2006 23:07:01 -0500 (EST)

```expr=x1^2 + 4*x1*x2 + 3*x2^2;

sub1=x2->Sqrt[1-x1^2];

f1[x1_] = Simplify[expr/.sub1];

pts1={x1,f1[x1]}/.Solve[f1'[x1]==0,x1]//
Simplify

{{-Sqrt[(1/10)*(5 + Sqrt[5])], 2 - Sqrt[5]}, {Sqrt[(1/10)*(5 - Sqrt[5])], 2 + Sqrt[5]}}

Plot[f1[x1],{x1,-1,1},Epilog->
{Red,AbsolutePointSize[5],Point/@pts1}];

pt3D1=({x1,x2,expr}/.sub1)/.
{x1->pts1[[2,1]]}//Simplify

{Sqrt[(1/10)*(5 - Sqrt[5])], Sqrt[(1/10)*(5 + Sqrt[5])], 2 + Sqrt[5]}

sub2=x2->-Sqrt[1-x1^2];

f2[x1_] = Simplify[expr/.sub2];

pts2={x1,f2[x1]}/.Solve[f2'[x1]==0,x1]//
Simplify

{{Sqrt[(1/10)*(5 + Sqrt[5])], 2 - Sqrt[5]}, {-Sqrt[(1/10)*(5 - Sqrt[5])], 2 + Sqrt[5]}}

Plot[f2[x1],{x1,-1,1},Epilog->
{Red,AbsolutePointSize[5],Point/@pts2}];

pt3D2=({x1,x2,expr}/.sub2)/.
{x1->pts2[[2,1]]}//Simplify

{-Sqrt[(1/10)*(5 - Sqrt[5])], -Sqrt[(1/10)*(5 + Sqrt[5])], 2 + Sqrt[5]}

Needs["Graphics`"];

DisplayTogether[
Plot3D[expr*Boole[x1^2+x2^2<1],
{x1,-1,1},{x2,-1,1},
Mesh->False,PlotPoints->125],
Show[Graphics3D[{Red,AbsolutePointSize[6],
Point/@{pt3D1,pt3D2}}]]];

Bob Hanlon

---- Uwe Ziegenhagen <newsgroup at ziegenhagen.info> 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?
>
>
>
>
> Uwe
>

--

Bob Hanlon
hanlonr at cox.net

```

• Prev by Date: Re: Tricky visualization of maximization problem
• Next by Date: RE: Tricky visualization of maximization problem
• Previous by thread: Re: Tricky visualization of maximization problem
• Next by thread: RE: Tricky visualization of maximization problem