Re: Tricky visualization of maximization problem

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

```Here is an alternative approach using InequalityPlot3D

DisplayTogether[
InequalityPlot3D[{0.99expr < z < expr, x1^2 + x2^2 < 1},
{x1, -1, 1}, {x2, -1, 1}, {z, 0, 2 + Sqrt[5]},
BoxRatios -> {1, 1, 0.4}, PlotPoints -> 20],
InequalityPlot3D[{1.01expr < z < expr, x1^2 + x2^2 < 1},
{x1, -1, 1}, {x2, -1, 1}, {z, 2 - Sqrt[5], 0},
BoxRatios -> {1, 1, 0.4}, PlotPoints -> 20],
Show[Graphics3D[{Red, AbsolutePointSize[6],
Point /@ {pt3D1, pt3D2}}]], ImageSize -> 500];

Bob Hanlon

---- Bob Hanlon <hanlonr at cox.net> wrote:
> 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?
> >
> >
> > Thanks in advance,
> >
> >
> > Uwe
> >

```

• 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