3 D graphs

2 + 2

Off[General::"spell1"] ;
th1 = 0.007;

To see the graphs that I showed in class click the manu item Kernel, choose Evaluation, then choose Evaluate Notebook. Wait for Mathematica to finsh with evaluating the notebook. Then browse through the notebook. To see an animation, notice the bracket on the right side of the screen, then highlight the bracket which contains all the pictures in one animation, then press Ctrl-y

You can experiment with your own functions,  see Section Any function 1 for details.

Do not save the notebook with pictures. Before saving the notebook click the manu item Kernel, choose Delete All Output.

(x^2) + (y^2)

\(Show[
Graphics3D[{
{Red, 
            Thickness[th1], 
            Line[\({#, 0, #\^2} &\) /@ 
                Range[\(-3\), 3,  .1]]}, 
{Green, 
            Thickness[th1], 
            Line[\({0, #, #\^2} &\) /@ 
                Range[\(-3\), 
                  3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-1\), 
            5}}, 
BoxRatios -> \ {1, 1, 
          1}, 
Axes -> 
        True
]\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, y, #\^2 + y^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(- .5\), 
                5.5}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {y, 
          3, \(-3\), \(- .1\)}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[\({#, v, #\^2 + v^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {v, 3, 
                    y, \(- .1\)}]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(- .5\), 
                5.5}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {y, 
          3, \(-3\), \(- .1\)}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({x, #, x\^2 + #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(- .5\), 
                5.5}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 
          3,  .1}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Table[Line[\({u, #, u\^2 + #\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, \(-3\), 
                    x,  .1}]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(- .5\), 
                5.5}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 
          3,  .1}];\)\(
\)\(
\)
    \)\)

\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2 + 0\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, 0\^2 + #\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Red, 
                Thickness[th1], 
                Table[Line[\({#, u, #\^2 + u\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, 
                    3, \(-x\), \(- .1\)}]}, 
{Green, 
                Thickness[th1], 
                Table[Line[\({u, #, u\^2 + #\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, \(-3\), 
                    x,  .1}]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(- .5\), 
                5.5}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 3,  .1}];\)\)

Plot3D[(x^2) + (y^2), {x, -3, 3}, {y, -3, 3}];

Plot3D[(x^2) + (y^2), {x, -3, 3}, {y, -3, 3}, 
        BoxRatios ->  {1, 1, 2}];

(x^2) - (y^2)

\(\(\(Show[
Graphics3D[{
{Red, 
              Thickness[th1], 
              Line[\({#, 0, #\^2 - 0\^2} &\) /@ 
                  Range[\(-3\), 3,  .1]]}, 
{Green, 
              Thickness[th1], 
              Line[\({0, #, 0\^2 - #\^2} &\) /@ 
                  Range[\(-3\), 
                    3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
              9}}, 
BoxRatios -> \ {1, 1, 
            1}, 
Axes -> 
          True
];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, y, #\^2 - y^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, 0\^2 - #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
                9}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {y, 
          3, \(-3\), \(- .1\)}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[\({#, v, #\^2 - v^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {v, 3, 
                    y, \(- .1\)}]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, 0\^2 - #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
                9}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {y, 
          3, \(-3\), \(- .1\)}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2 - 0\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({x, #, x\^2 - #\^2} &\) /@ 
                    Range[\(-3\), 
                      3,  .1]]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
                9}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 
          3,  .1}];\)\(
\)\(
\)
    \)\)

\(\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2 - 0\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Table[Line[\({u, #, u\^2 - #\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, \(-3\), 
                    x,  .1}]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
                9}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 
          3,  .1}];\)\(
\)\(
\)
    \)\)

\(\(Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[\({#, 0, #\^2 - 0\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Green, 
                Thickness[th1], 
                Line[\({0, #, 0\^2 - #\^2} &\) /@ 
                    Range[\(-3\), 3,  .1]]}, 
{Red, 
                Thickness[th1], 
                Table[Line[\({#, u, #\^2 - u\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, 
                    3, \(-x\), \(- .1\)}]}, 
{Green, 
                Thickness[th1], 
                Table[Line[\({u, #, u\^2 - #\^2} &\) /@ 
                      Range[\(-3\), 3,  .1]], {u, \(-3\), 
                    x,  .1}]}
}], 
PlotRange -> \ {{\(-3\), 3}, {\(-3\), 3}, {\(-9\), 
                9}}, 
BoxRatios -> \ {1, 1, 
              1}, 
Axes -> 
            True
], {x, \(-3\), 3,  .1}];\)\)

Plot3D[(x^2) - (y^2), {x, -3, 3}, {y, -3, 3}, 
        BoxRatios ->  {1, 1, 2}];

Plot3D[(x^2) - (y^2), {x, -3, 3}, {y, -3, 3}, 
        PlotPoints -> 70, 
        PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}, 
        BoxRatios ->  {1, 1, 1}, ClipFill ->  None, 
        ImageSize -> 300];

Any function 1

The following cell defines a function to be explored and the range for the variables. You can experiment with your own functions just by changing the formula in the following cell and the values for xmin, xmax, ymin, ymax, zmin, zmax. The value of  st  determins how many cross sections are drown.  The value for  VP stands for the view point. It determins from which direction we look at the graph.

ff[x_, y_] := Cos[x] Sin[y];

    
xmin = -Pi; xmax = Pi; ymin = -Pi; ymax = Pi; zmin = -1; 
    zmax = 1; st = (Pi/24);  VP =  {2.517,  1.357,  1.376};

Show[
Graphics3D[{
{Red, 
              Thickness[th1], 
              Line[{#, 0, ff[#, 0]} & /@ 
                  Range[xmin, xmax, st]]}, 
{Green, 
              Thickness[th1], 
              Line[{0, #, ff[0, #]} & /@ 
                  Range[ymin, ymax, 
                    st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
              zmax}}, 
BoxRatios ->  {1, 1, 
            1}, 
Axes -> True, 
        ViewPoint ->  
          VP
];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, y, ff[#, y]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, y, 
                    st}]}, 
{Green, Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{x, #, ff[x, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, 
          xmax,  .1}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, x, 
                    st}]}, 
{Green, Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Plot3D[ff[x, y], {x, xmin, xmax}, {y, ymin, ymax}];

Any function 2

ff[x_, y_] :=  2 - x - y;

    
xmin = -3; xmax = 3; ymin = -3; ymax = 3; zmin = -3; 
    zmax = 3; st =  .1;  VP =  {2.517,  1.357,  1.376};

Show[
Graphics3D[{
{Red, 
              Thickness[th1], 
              Line[{#, 0, ff[#, 0]} & /@ 
                  Range[xmin, xmax, st]]}, 
{Green, 
              Thickness[th1], 
              Line[{0, #, ff[0, #]} & /@ 
                  Range[ymin, ymax, 
                    st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
              zmax}}, 
BoxRatios ->  {1, 1, 
            1}, 
Axes -> True, 
        ViewPoint ->  VP
];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, y, ff[#, y]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, y, 
                    st}]}, 
{Green, Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{x, #, ff[x, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, 
          xmax,  .1}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, x, 
                    st}]}, 
{Green, Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Plot3D[ff[x, y], {x, xmin, xmax}, {y, ymin, ymax}, 
        BoxRatios -> {1, 1, 1}, ViewPoint ->  VP];

Any function 3

ff[x_, y_] :=  y Cos[x] + Sin[x];

    
xmin = -Pi; xmax = Pi; ymin = -Pi; ymax = Pi; zmin = -Pi; 
    zmax = Pi; st = (Pi/24);  VP =  {2.517,  1.357,  1.376};

Show[
Graphics3D[{
{Red, 
              Thickness[th1], 
              Line[{#, 0, ff[#, 0]} & /@ 
                  Range[xmin, xmax, st]]}, 
{Green, 
              Thickness[th1], 
              Line[{0, #, ff[0, #]} & /@ 
                  Range[ymin, ymax, 
                    st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
              zmax}}, 
BoxRatios ->  {1, 1, 
            1}, 
Axes -> True, 
        ViewPoint ->  VP
];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, y, ff[#, y]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, y, 
                    st}]}, 
{Green, Thickness[th1], 
                Line[{0, #, ff[0, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {y, ymin, ymax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Line[{x, #, ff[x, #]} & /@ 
                    Range[ymin, ymax, 
                      st]]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, 
          xmax,  .1}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Line[{#, 0, ff[#, 0]} & /@ 
                    Range[xmin, xmax, st]]}, 
{Green, 
                Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Table[
        Show[
Graphics3D[{
{Red, 
                Thickness[th1], 
                Table[Line[{#, v, ff[#, v]} & /@ 
                      Range[xmin, xmax, st]], {v, ymin, x, 
                    st}]}, 
{Green, Thickness[th1], 
                Table[Line[{u, #, ff[u, #]} & /@ 
                      Range[ymin, ymax, st]], {u, xmin, x, 
                    st}]}
}], 
PlotRange ->  {{xmin, xmax}, {ymin, ymax}, {zmin, 
                zmax}}, 
BoxRatios ->  {1, 1, 
              1}, 
Axes -> True, 
          ViewPoint ->  VP
], {x, xmin, xmax, 
          st}];

Plot3D[ff[x, y], {x, xmin, xmax}, {y, ymin, ymax}, 
        BoxRatios ->  {1, 1, 1}, ViewPoint ->  VP];