Clear[x, y, expr]
expr = 5 x y - x^4 - y^4;
max = Maximize[expr, {x, y}]
{25/8, {x -> -(Sqrt[5]/2), y -> -(Sqrt[5]/2)}}
I would like to generate a Plot3D
and put a Ball
at the maximum point.
Show[
Plot3D[expr
, {x, -3, 3}, {y, -3, 3}
, PlotStyle -> Directive[Opacity[0.3], LightRed]
, BoxRatios -> {1, 1, 1}
]
, Graphics3D[{Red, AbsolutePointSize[12]
, Ball[{-(Sqrt[5]/2), -(Sqrt[5]/2), 25/8}, 0.5]
}]
]
This results in a squished disk so I try to restrict z-PlotRange.
Show[
Plot3D[expr
, {x, -3, 3}, {y, -3, 3}
, PlotStyle -> Directive[Opacity[0.3], LightRed]
, PlotRange -> {{-3, 3}, {-3, 3}, {-10, 10}}
]
, Graphics3D[{Red, AbsolutePointSize[12]
, Ball[{-(Sqrt[5]/2), -(Sqrt[5]/2), 25/8}, 0.5]
}
]
]
The two plots are shown below.
I have seen a similar post 157532 but it is about stretching/scaling the entire graphic. I want to ignore the rest of the elongated plot3D and focus on the part around the maximum point.
Question
I can put a Point
at the max location without any problems and it appears round. But how do I put a 3D primitive there such as a Ball
? Thanks for your time and your replies in advance.