Math 615: 9/23/15

Input Types

Text fields:  You can enter text into a cell by declaring it to be a “Text” cell.  This will prevent it from being evaluated, and hence it will not produce any unwanted error messages.  Click “Format,” then “Style,” then “Text.”  You can aslo create titles, subsections, etc.

f[x_] := Cos[2Pi x]
f[1]

Another way to enter text is to click the “+“ sign above a cell. Notice this also gives you the option of “Free-form input.” Under this option, you type a command for Mathematica in plain English, and it will try to translate it into a formal Mathematica command.

Try to integrate a function.

Teaching yourself Mathematica

Free-form input - This is a good way to discover possible commands and their usage.  Clicking on the Mathematica input will automatically replace your input, and the “+“ symbol gives other possible expressions.

Classroom Assistant Palette - Open this under the Palettes menu.  The “Basic Commands” contains most commands you will ever need, and the command will enter a template for you to fill in.

Integrate[expr,var]

(∫_lower^upper)expr\[DifferentialD]var

Auto-Completion - If you begin typing a command, Mathematica will suggest the rest of the command.  You can also see the syntax by clicking the down arrows.  For example, begin typing Sum, and ...

Sum[f,{i,(Subscript[i, min]),(Subscript[i, max])}]

Documentation Center - This contains all the information about a command’s usage along with examples.  The sample code can be modified and rerun within the Documentation Center.  For example, figure out how to graph both sin(x) and cos(x) on the same graph by looking up “Plot.”

Plot[{Sin[x],Cos[x]},{x,0,2Pi},PlotLegends->"Expressions"]

Graphs of functions

Function(s) of 1-variable.

Plot[x^2, {x, -2, 2}]

Plot[{x^2, 2x-4}, {x, -2, 2}]

Function(s) of 2-variables.

Plot3D[x^2 + y^2, {x, -2, 2}, {y, -2, 2}]

Plot3D[{x^2 + y^2, 2x-4y }, {x, -2, 2}, {y, -2, 2}]

Plot3D[{2x-y+5,3x-2+y, 4x-2y+10},{x,-10,10},{y,-10,10}]

2D and 3D Parametric Graphs

Function f: R -> R^2

ParametricPlot[{2Cos[t],7Sin[t]},{t,0,2Pi}]

Two functions Function f: R -> R^2

ParametricPlot[{{2Cos[t],7Sin[t]}, {Cos[t], Sin[t]}},{t,0,2Pi}]

Click on “More, Legends, Formulas” to get a legend like the following.

ParametricPlot[{{2 Cos[t],7 Sin[t]},{Cos[t],Sin[t]}},{t,0,2 π},PlotLegends->"Expressions"]

Graphing previously defined functions.  Note: the semicolon; prevents the output from being printed on the screen.

f[t_]:= {2Cos[t], 7Sin[t]}
g[t_] := {Cos[t], Sin[2t]}
ParametricPlot[f[t], {t, 0, 2Pi}]
ParametricPlot[{f[t], g[t]}, {t, 0, 2Pi}]

Function R -> R^3.

ParametricPlot3D[{Cos[t],Sin[t],t},{t,0,4Pi}]

Visualizing spans of vectors.

Parameterizing a line.

ParametricPlot[{2-t,1+3t},{t,-2,2}]

Using scalar multiplication.

v0 = {2,1};
v = {-1,3};
ParametricPlot[v0 + r v, {r, -2,2}]

Linear combinations of two vectors give a parametric function R^2 -> R^2.

v1 = {3,1};
v2 = {1, 2};
ParametricPlot[r v1 + s v2, {r, -2,2}, {s, -2, 2}]

Visualizing span(w1), span(w2), span(w1,w2).

w1 = {1, 1, 0};
w2 = {-1, 2, 1};
ParametricPlot3D[ r w1, {r, -2, 2}]
ParametricPlot3D[ r w2, {r, -2, 2}]
ParametricPlot3D[ r w1 + s w2, {r, -2, 2}, {s, -2, 2}]

What is the dimension of span(v1,v2,v3) for given vectors?  Let’s check graphically.

v1 = {1,0,0};
v2 = {0,1,0};
v3 = {0,0,1};
ParametricPlot3D[{r1 v1 + r2 v2, r1 v3}, {r1, -2, 2}, {r2, -2, 2}]

v1 = {1,0,0};
v2 = {0,1,0};
v3 = {1,1,0};
ParametricPlot3D[{r1 v1 + r2 v2, r1 v3}, {r1, -2, 2}, {r2, -2, 2}]