An Introduction to Mathematica for Calculus Students

Arvind Borde

Mathematica is a powerful symbolic mathematics program that allows you to visualize mathematical expressions and to carry out calculations. As you learn about it, you'll find this online reference guide to Mathematica useful.

Below you will find examples of what you can do with Mathematica. Many are based on a calculus class taught by Eric Hirschmann and myself at Southampton College over the period 1998--1999. Here are important things to keep in mind:

  • Multiline input is accepted by the program. The Enter key does not make Mathematica act on input. You need to press Shift-Enter when you want something done.
  • Mathematica is sensitive to case, and it requires that standard functions be entered with their first letter capitalized. Cos[x] and cos[x] are different expressions, and Mathematica will automatically recognize only the former.
  • Arguments to functions must be entered in square brackets, and these delimiters cannot be used in any other context. Neither Sin(x) nor 4*[2+2] is accepted. You must use Sin[x] for the former 4*(2+2) for the latter.

Keeping in mind that you press Shift-Enter after input when you want Mathematica to act on it, here's how you

  1. Add 2 and 2:
      2+2
    
  2. Multiply 25 and 37.5:
      25*37.5
    
    or
      25 37.5
    
  3. Find the square root of 2:
      Sqrt[2]
    
    You will see that the result here is not very satisfactory.

  4. Find the square root of 2 as a decimal:
      N[Sqrt[2]]
    
  5. Find the square root of 2 as a decimal with 5000 significant figures:
      N[Sqrt[2], 5000]
    
  6. Express π as a decimal with 175 significant figures:
      N[Pi, 175]
    
  7. Solve an equation:
      Solve[x^2 - 98 x - 27 == 0, x]
    
  8. Solve an equation numerically:
      N[Solve[x^2 - 98 x - 27 == 0, x], 24]
    
  9. Differentiate a function:
      D[x^2 Cos[x^3] - Exp[2^x], x] 
    
  10. Differentiate a function many times:
      D[x^2 Cos[x^3] - Exp[2^x], {x,4}] 
    
  11. Integrate a function:
      Integrate[x^3 + x^2 + x^(-1), x] 
    
  12. Plot a single function:
      Plot[x^2, {x, 0, 10}] 
    
  13. Define your own functions:
      f[x_]:=x^3 
    
  14. Plot a function you have defined:
      Plot[f[x],{x, 0, 10}]
    
  15. Combine plots M and N:
      Show[Out[M],Out[N]] 
    
  16. Plot more than one function:
      Plot[{x^2,x^3},{x,0,10}] 
    
  17. Adjust the range of the plot in order to see more or less of the function(s):
      Plot[{x^2,x^3},{x,0,10}, PlotRange->{0,300}] 
    
  18. Distinguish multiple functions on the same graph, using R(ed), G(reen), and B(lue) values:
      Plot[{x^2,x^3},{x,0,10},
         PlotStyle->{{RGBColor[1,0,0]},{RGBColor[0,1,0]}}] 
    
  19. Label functions on a graph:
      Plot[{Sin[x], x^2, Log[x], x^3 - x, -x^2 + 1, Cos[x]}, 
          {x, -3, 3}, PlotLegends -> "Expressions"]
    
  20. Number functions on a graph (and make the lines thicker):
     Plot[{Sin[x], x^2, Log[x], x^3 - x, -x^2 + 1, Cos[x]}, 
          {x, -3, 3}, PlotLegends -> Automatic, PlotStyle -> Thick] 
    
  21. Plot points:
      ListPlot[{{1,-1},{3,4},{5,-6}},Joined->True] 
    
  22. Draw 3-D plots:
      Plot3D[(x^2+y^2) Exp[-(x^2+y^2)], {x,-2,2}, {y,-2,2}, PlotPoints->50] 
    
  23. Plot parametrized families of functions:
      Plot[Evaluate[Table[E^{b*x},{b,1,4,.5}]],{x,0,3}]
    
  24. Make parametric plots of curves:
      ParametricPlot[{Sin[t], Sin[2t]}, {t, 0, 2 Pi}]
    
  25. Make 3D parametric plots of curves:
      ParametricPlot3D[{Sin[t], Sin[2t], t}, {t, 0, 2 Pi}]
    
  26. Make parametric plots of surfaces:
      ParametricPlot3D[{u Sin[t], u Cos[t], t}, {t, 0, 10}, {u, -1, 1}]
    
  27. Make more parametric plots of surfaces:
      ParametricPlot3D[{Cos[t] (3+Cos[u]), Sin[t] (3+Cos[u]), Sin[u]}, 
         {t, 0, 2 Pi}, {u, 0, 2 Pi}]
    
  28. Play with transparency of surfaces:
      ParametricPlot3D[{1.16^v Cos[v] (1 + Cos[u]), 
          -1.16^v Sin[v] (1 + Cos[u]), -2 1.16^v (1 + Sin[u])}, {u, 0, 2 Pi}, 
          {v, -15, 6}, Mesh -> None, PlotStyle -> Opacity[0.3], PlotRange -> All, 
          PlotPoints -> 25] 
    
  29. Make an animation
      Animate[Plot[Sin[x + a], {x, 0, 10}], {a, 0, 5}, 
         AnimationRunning -> False]
    
  30. Make a 3D animation
      Animate[ParametricPlot3D[{Cos[a t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), Sin[u]}, 
         {t, 0, 2 Pi}, {u, 0, 2 Pi}], {a, 0, 5}, 
         AnimationRunning -> False]
    


http://arvind-borde.org/courses/mathematica/mathematica_for_calculus.html