Department of Mathematics

 MTH243 (Calculus for Functions of Several Variables) MATHEMATICA. Chapter 12: Functions of Several Variables Vladimir A. Dobrushkin,Lippitt Hall 202C, 874-5095,dobrush@uri.edu In this course we will use Mathematica computer algebra system (CAS), which is available in computer labs at URI. The Mathematica projects are created to help you learn new concepts. Mathematica is very useful in visualizing graphs and surfaces in three dimensions. Matlab (commercial software) is also available at engineeering labs. Its free version is called Octave. A student can also use free CASs: SymPy (based on Python), Maxima or Sage.

## Section 12.5. Functions of three Variables

Example 1. A particular case of ellipsoid is a ball:
ContourPlot3D[ 1 == x^2 + y^2 + z^2, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]
or
ContourPlot3D[(x^2)/(1^2) + (y^2)/(1^2) + (z^2)/(1^2) == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AxesOrigin -> {0, 0, 0}, PlotRange -> {-1, 1}, AxesLabel -> {x, y, z}]
ContourPlot3D[ x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Contours -> 3, MeshFunctions -> {#1 &}]
a = 3; b = 3; c = 3;
ContourPlot3D[ x^2/a^2 + y^2/b^2 + z^2/c^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, ContourStyle -> Green]
a = 1; b = 2; c = 3;
ContourPlot3D[ x^2/a^2 + y^2/b^2 + z^2/c^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, ColorFunction -> Hue]
ContourPlot3D[-1 + x^2 + y^2 + z^2 == 0, {x, -4., 4.}, {y, -4., 4.}, {z, -4., 4.}, Axes -> True, BoxRatios -> {1., 1., 1.}, ViewPoint -> {-1.64646, -2.30505, -0.987878}, PlotRange -> All, AxesLabel -> {"x", "y", "z"}, ContourStyle -> Directive[RGBColor[1, 0.8, 0.3], Specularity[RGBColor[0.2, 0.2, 0.7], 20]], Lighting -> "Neutral", ColorFunction -> None, BoxStyle -> GrayLevel[0, 0.35]]
ContourPlot3D[ x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Mesh -> None]
ParametricPlot3D[{Cos[t] Cos[s], 2 Sin[t] Cos[s], 3 Sin[s]}, {s, 0, 2 Pi}, {t, 0, 2 Pi}, PlotStyle -> Opacity[0.2]]

Example 2.

Example 3. Hyperboloid of one sheet

ContourPlot3D[ 1 == x^2 + y^2 - z^2, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]
or
ContourPlot3D[((x^2)/(1^2)) + ((y^2)/(1^2)) - ((z^2)/(1^2)) == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, AxesOrigin -> {0, 0, 0}, AxesLabel -> {x, y, z}]
ContourPlot3D[ x^2 + y^2 - z^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, MeshShading -> {LightBlue, Orange}, MeshFunctions -> {#2 &}]
a = 1.5; b = 2.0; c = 2.5;
ContourPlot3D[ x^2/a^2 + y^2/b^2 - z^2/c^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -2, 2}, ColorFunction -> Hue]
ContourPlot3D[ x^2 + y^2 - z^2 == 1, {x, -2, 2}, {y, -2, 2}, {z, -1, 1}, ContourStyle -> Purple]
ContourPlot3D[-1 + x^2 + y^2 - z^2 == 0, {x, -4., 4.}, {y, -4., 4.}, {z, -4., 4.}, Axes -> True, BoxRatios -> {1., 1., 1.}, ViewPoint -> {-1.64195, -2.50908, -0.092319}, PlotRange -> All, AxesLabel -> {"x", "y", "z"}, ContourStyle -> Directive[RGBColor[0.9, 0.8, 0.3], Specularity[RGBColor[0.2, 0.2, 0.7], 20]], Lighting -> "Neutral", ColorFunction -> None, BoxStyle -> GrayLevel[0.5, 0.7]]
ParametricPlot3D[{Cos[t] Cosh[s], Sin[t] Cosh[s], Sinh[s]}, {t, 0, 2 Pi}, {s, -1, 1}, PlotStyle -> Directive[Purple, Opacity[0.3]]]
ContourPlot3D[ x^2 + y^2 - z^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, MeshShading -> {Green, Red}, MeshFunctions -> {#3 &}]

Example 4.

Example 5.

Example. Now we plot a hyperboloid of two sheets:

ContourPlot3D[-1 == x^2 + y^2 - z^2, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]
ContourPlot3D[ x^2 + y^2 - z^2 == -1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, MeshShading -> { {White, Yellow, Green}}, MeshFunctions -> {#1 & , #2 & }]
a = 1.5; b = 1.5; c = 1;
ContourPlot3D[ x^2/a^2 + y^2/b^2 - z^2/c^2 == -1, {x, -3, 3}, {y, -3, 3}, {z, -2, 2}, ColorFunction -> Hue]
ContourPlot3D[ x^2 + y^2 - z^2 == -1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, ContourStyle -> LightBlue]
ContourPlot3D[(4 + x^2 + y^2 - 4*z^2)/4 == 0, {x, -3., 3.}, {y, -3., 3.}, {z, -5., 5.}, Axes -> True, BoxRatios -> {2., 2., 1.}, ViewPoint -> {-2.5, -3.5, -0.5}, PlotRange -> All, AxesLabel -> {"x", "y", "z"}, ContourStyle -> Directive[RGBColor[0.5, 0.8, 0.3], Specularity[RGBColor[0.2, 0.2, 0.7], 20]], Lighting -> "Neutral", ColorFunction -> None, BoxStyle -> GrayLevel[0.5, 0.3], AspectRatio -> 1]
We can also plot half of such hyperboloid:
ParametricPlot3D[{Cos[t] Sinh[s], Sin[t] Sinh[s], Cosh[s]}, {t, 0, 2 Pi}, {s, -1, 1}, PlotRange -> 2, Mesh -> None]
ContourPlot3D[ x^2 + y^2 - z^2 == -1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, MeshShading -> {Blue, LightBlue}, MeshFunctions -> {#2 &}]

Example.