0
$\begingroup$

Given the function f : R^3 -> R defined by:

f(x, y, z) := x e^(y^2 + z^2)

you will determine the points of maximum and minimum for f constrained to:

D := { (x, y, z) \in R^3 : 0 <= x <= 1 - y^2 - z^2 }.

Now, analytically is all very simple, however, since f is not possible to draw the graph (need one 4-dimensional space) I thought to consider f as a function that at every point in 3D space associated with a temperature represented by a graduated scale colors.

I was wondering if someone could point a way to plot D in Wolfram Mathematica coloring each own point according to the function f, so you can find the minimum and the absolute maximum by colors.

Thank you!


I thought DensityPlot3D, but I think in Wolfram Mathematica 11.0 there is a problem:

enter image description here

and the same happens to me in the main window.

To you it does not happen on Windows 8.1, 64 bits? :(


Through code:

A = ImplicitRegion[0 <= x <= 1 - y^2 - z^2, {x, y, z}];
SliceDensityPlot3D[
 x E^(y^2 + z^2), {x == 0, x == 1 - y^2 - z^2}, {x, y, z} \[Element] 
  A, AxesLabel -> Automatic, ColorFunction -> "Rainbow", 
 PlotLegends -> Automatic]

I get:

enter image description here

which is almost what I want. How do I delete those nasty "holes"?

$\endgroup$
5
  • $\begingroup$ Have you seen DensityPlot3D[]? $\endgroup$ Jan 23, 2017 at 18:11
  • $\begingroup$ Then, please also include the OS you are using. $\endgroup$ Jan 23, 2017 at 18:21
  • $\begingroup$ If DensityPlot3D[] does not work for you because of bugs, you could consider using SliceContourPlot3D[] - at example: SliceContourPlot3D[ x*Exp[y^2 + z^2], {"YStackedPlanes", 10}, {x, y, z} \[Element] ImplicitRegion[0 <= x <= 1 - y^2 - z^2, {x, y, z}]] $\endgroup$ Jan 23, 2017 at 18:48
  • $\begingroup$ Have you tried disable anti-aliasing? $\endgroup$
    – Feyre
    Jan 23, 2017 at 19:09
  • $\begingroup$ I meant, disable it in the preferences. $\endgroup$
    – Feyre
    Jan 23, 2017 at 19:38

1 Answer 1

2
$\begingroup$

Use RegionPlot3D

RegionPlot3D[
 0 <= x <= 1 - y^2 - z^2 && -1 <= y <= 1 && -1 <= z <= 1,
 {x, 0, 1}, {y, -1, 1}, {z, -1, 1},
 AxesLabel ->
  (Style[#, 14, Bold] & /@ {x, y, z}),
 ColorFunction -> Function[{x, y, z},
   ColorData["Rainbow"][x E^(y^2 + z^2)]],
 ColorFunctionScaling -> False,
 MeshFunctions ->
  Function[{x, y, z}, x E^(y^2 + z^2)],
 BoxRatios -> {1, 1, 1},
 PlotPoints -> 75,
 PlotLegends -> BarLegend["Rainbow"]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.