Supplementing Calculus with Mathematica

Dr. Michael C. Sostarecz

Monmouth College

My Background with Mathematica

The Calculus I Classroom at Monmouth College

14 network computers running Windows

Recently upgraded from Mathematica 3 to Mathematica 6

3 Sections of 18-28 students each

Front workstation with a projector onto a white board

Introducing Mathematica

Oohs and Ahhs

Arithmetic

2+2, Shift-Enter vs Enter, 2D Input, N

Computer Algebra System

Expand vs Factor, Together vs Apart, Simplify, Solve and Nsolve

Functions

DEFINING, Evaluating, Composite Functions

Plotting

Basic Plotting, PlotRange, PlotStyle

Manipulate

Optimization

Demonstrations Project - Chris Boucher

"Maximizing the Area of a Rectangle with Fixed Perimeter" from The Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/MaximizingTheAreaOfARectangleWithFixedPerimeter/

The Derivative as a Function and Differentiability

Demonstrations Project - Wolfgang Narrath & Reinhard Simonovits

f[x_] = Abs[(x^2)+x];
Manipulate[Plot[ f[x],{x,x0-2 h,x0+2 h},PlotRange->{{x0-2*h,x0+2*h},{f[x0]-2*h,f[x0]+2*h}},
PlotStyle-> {RGBColor[0.378912, 0.742199, 0.570321],Thickness[.005]},
Prolog->{GrayLevel[1],Disk[{x0,f[x0]},0.8h],Yellow,Circle[{x0,f[x0]},0.8h]},
PlotLabel-> "f[x]",Epilog-> {Red,PointSize[.015], Point[{x0,f[x0]}]},AxesOrigin->{x0,f[x0]},Background-> GrayLevel[0.9],PlotStyle->Red,AspectRatio->1,ImagePadding->0.1],
{{x0,-1,"(Subscript[x, 0])"},-1.46,0.5,Appearance->"Labeled"},Delimiter,
{{h,1,"zoom"},1,(10^(-6))},SaveDefinitions->True,FrameLabel->Row[{ "The differentiation microscope for ",TraditionalForm[HoldForm[f[x]==Abs[x^2+x]]]}]]

"Differentiation Microscope" from The Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/DifferentiationMicroscope/

Riemann Sums

Demonstrations Project - Scott Liao

left[f_,x_,n_,h_,type_]:={f/.x->bottom[n,h],f/.x->bottom[n+1,h],f/.x->bottom[n,h]+.5h,If[(f/.x->bottom[n,h])<(f/.x->bottom[n+1,h]),f/.x->bottom[n+1,h],f/.x->bottom[n,h]],If[(f/.x->bottom[n,h])<(f/.x->bottom[n+1,h]),f/.x->bottom[n,h],f/.x->bottom[n+1,h]],f/.x->bottom[n,h]}[[type]];
right[f_,x_,n_,h_,type_]:=If[type==6,f/.x->bottom[n+1,h],left[f,x,n,h,type]];
bottom[0,h_]:=0;
bottom[n_,h_]:=bottom[n-1,h]+h;

rectangle[f_,x_,n_,h_,type_]:={EdgeForm[Thin],RGBColor[0,1-n/20,n/20],Polygon[{{bottom[n,h],0},{bottom[n,h],left[f,x,n,h,type]},{bottom[n+1,h],right[f,x,n,h,type]},{bottom[n+1,h],0}}]};
estimatedArea[f_,x_,n_,h_,type_]:=N[Sum[Abs[bottom[i,h]-bottom[i+1,h]]*(left[f,x,i,h,type]+right[f,x,i,h,type])/2,{i,0,n-1}],3];
Manipulate[

Show[Plot[f,{x,0,8},PlotStyle->Black,PlotLabel->Grid[{{"estimated area: "<> ToString[estimatedArea[f,x,n,a/n,type]]},{"integral: "<>ToString[N[(∫_0^a)f\[DifferentialD]x,3]]}}]],Plot[f,{x,0,a},PlotStyle->Black,Filling->1->{0,Opacity[.25,Blue]}],Graphics[{Opacity[.4],Table[rectangle[f,x,i,a/n,type],{i,0,n-1}]}],Graphics[{Red,Line[{{a,0},{a,150}}]}],ImageSize->{500,400}],{{f,x,"function"},{x->"x",(((x-3))^2)->"(x-3)^2",(((x-3))^3)+27->"(x-3)^3+27",(Sqrt[x])->"(Sqrt[x])",Sin[x]+1->"sin(x)+1",(E^(x/3))->"(E^(x/3))"},ControlType->SetterBar},
{{type,2,"type"},{1->"left",2->"right",3->"midpoint",4->"overestimate",5->"underestimate",6->"trapezoidal"},ControlType->SetterBar},
{{a,5,"upper limit a"},0.01,8,Appearance->"Labeled"},
{{n,3,"number of quadrilaterals"},1,20,1,Appearance->"Labeled"},SaveDefinitions->True]

The Derivative as a Function and Differentiability

Adapted from Wolfgang Narrath & Reinhard Simonovits

Dynamic Module with an Imput Field

"Differentiation Microscope" from The Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/DifferentiationMicroscope/

Dynamic Module with an Input Field

Panel[DynamicModule[{f= Sin[x]},
Column[{
Row[{"Function:  ",InputField[Dynamic[f],ImageSize->{340,40}]}],
Manipulate[


f


]}]]]

Riemann Sums

Adapted From Scott Liao

Nonlinear Solver

FindRoot with 200 random initial conditions

Function Plotter

Dynamic Tabular Input

Useful for Limits

Quiet[Panel[DynamicModule[{f= Sin[x]},
Column[{
Row[{"Function:  ",InputField[Dynamic[f],ImageSize->{340,40}]}],

Manipulate[
MatrixForm[Table[{InputField[Dynamic[(Subscript[A, m])]/.{m->i},ImageSize->{120,20}],f/.x->(Subscript[A, m])/.{m->i}},{i,matrixHeight}]],{{matrixHeight,3,"# of Data Points"},1,8,1,Appearance->"Labeled"}]
}

]
]]]

Function and Data Plotter

g[x_]:=Cos[x]+3 Sin[x]-2.` ((Sin[x])^2)