Physics 4392: Professor Olness  Fall 2001

Turn of some anoying features

Off[General::"spell1"] ; Off[
        General::"spell"] ;

Load the needed packages:

<<Graphics`PlotField`

<<Graphics`PlotField3D`

<<Calculus`VectorAnalysis`

Load the needed packages:

SetCoordinates[Cartesian[x, y, z]];

This is a good way to clear things between problems:

Clear["Global`*"]

Let's try some 2D stuff:

potential  =  -(x^2 + y^2);

Plot3D[potential, {x, -1, 1}, {y, -1, 1}];

ContourPlot[potential, {x, -1, 1}, {y, -1, 1}];

PlotGradientField[ 
        potential, {x, -1, 1}, {y, -1, 1}];

grad  =  Grad[potential]

grad2D =  grad[[{1, 2}]]

Note this matches the result of PlotGradientField[ potential,{x,-1,1},{y,-1,1}];

PlotVectorField[ 
        grad2D, {x, -1, 1}, {y, -1, 1}];

This is a good way to clear things between problems:

Clear["Global`*"]

Let's try some 3D stuff:

potential  =  -(x^2 + y^2);

PlotGradientField3D[ 
        potential, {x, -1, 1}, {y, -1, 1}, {z, -1, 
          1}];

grad  =  Grad[potential]

Note this matches the result of PlotGradientField3D

PlotVectorField3D[ 
        grad, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}];

This is a good way to clear things between problems:

Clear["Global`*"]

Let's try some Calculus stuff:

potential  =  -(x^2 + y^2);

grad  =  Grad[potential]

Div[grad]

Curl[grad]

This is a good way to clear things between problems:

Clear["Global`*"]

Play with vec1:

vec1 = {y, -x, 0};

Div[vec1]

Curl[vec1]

PlotVectorField3D[
        vec1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}];

Options[PlotVectorField3D]

PlotVectorField3D[
        vec1, {x, -1, 1}, {y, -1, 1}, {z, -1, 
          1}, 
ViewPoint -> {0, 0,  
            4}, 
VectorHeads -> True];

This is a good way to clear things between problems:

Clear["Global`*"]

Play with vec2:

vec2 = {y, -x  +  2 y, 0};

Div[vec2]

Curl[vec2]

PlotVectorField3D[
        vec2, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}];

PlotVectorField3D[
        vec2, {x, -1, 1}, {y, -1, 1}, {z, -1, 
          1}, 
ViewPoint -> {0, 0,  
            4}, 
VectorHeads -> True];

PlotVectorField[
        vec2[[{1, 2}]], {x, -1, 1}, {y, -1, 
          1}, 
ViewPoint -> {0, 0,  
            4}, 
VectorHeads -> True];