Calculus III: Introduction

In The Begining

Calculus III, Multivariable Calculus, is the extension of calculus concepts to functions of more than one variable.  Students will need a foundation in the concepts of functions and their graphs, limits, derivatives, and integral in order to have a better chance of success in Calculus III.  In this lab we will explore how Mathematica could be used to facilitate the use of these concepts.  It is assumed that students in Calculus III have some working knowledge of how Mathematica notebooks are created, saved and changed and that the difference between execution and writing cells has been explained in an earlier course.  If this is your first experience using Mathematica, please talk to your instructor about more basic training.

Functions and Expressions

In Mathematica you can work with the expression 3x+1 in a couple of different ways.  First as an expression:

f=3x+1

Then to substitute the value 2 in for x we do the following:

f/.{x->2}

Secondly, we can define a Mathematica function as follows and use function notation to evaluate the function at 2:

Clear[f]

f[x_]:=3x+1
f[2]

Note that the equals ( = ) is used as a “replacement assignment” while the colon-equals ( := ) is a “delayed assignment”.  The difference between these two types of assignments is that with the equals a replacement rule is created at the time of execution, with the colon-equals the assignment is delayed until later use.

1D Graphics

Mathematica shows it's true value when you wish to graphically display results.  There are a multitude of ways of generating graphics in Mathematica, but the most basic technique is the use of the "Plot" command.  What follows are several examples that illustrate the use of the "Plot" command and some of it's options.  Note that the “Basic Math Assistant” palette can be a great help when trying to use mathematical and other symbols (like π).

Plot[Sin[x],{x,0,2π}]

Plot[Sin[x],{x,0,2π},
   Ticks->{{π/2,π,3π/2,2π},{-1,1}},
   AxesLabel->{x,y}]

Plot[((Sin[x^2])/(x^2+1)),{x,0,10}]

Plot[((Sin[x^2])/(x^2+1)),{x,0,10},PlotRange->All]

See the on-line help for a full list of the options that the "Plot" command can use.

Limits

The basic form of the limit command is as follows:

Limit[3*x+1,x->2]

The direction of the limit can be specified by the Direction option as follows:

Limit[Cot[x],x->0,Direction->1]

This is the limit in the positive direction, or from the left.  The limit from the right and a graph of this function is

Limit[Cot[x],x->0,Direction->-1]

Plot[Cot[x],{x,-Pi,Pi}]

See the help for the Limit command for more options.

Derivatives

The two basic forms of differentiation in Mathematica are related to the two ways of representing expressions.  The D command is used to take the derivative of an expression, as follows:

Clear[y]

y=(x^2)*Sin[x]

The first derivative of the expression y, with respect to x is:

D[y,x]

The forth derivative of y w.r.t. x four times is:

D[y,{x,4}]

If we instead define a Mathematica function

Clear[y]
y[x_]=x^2*Sin[x]

Then the fist derivative evaluated at x would be:

y'[x]

The forth derivative evaluated at x would be:

y''''[x]

or

Derivative[4][y][x]

See the help on the D and Derivative commands for more information on differentiation.

Integrals

Mathematica can attempt to do both definite and indefinite integrals.  In the case of a definite integral, Mathematica can attempt to find the value exactly via the Fundamental Theorem of Calculus or by applying a numerical approximation method.

Examples:

Integrate[x*Sin[x],x]

Note the lack of the arbitrary constant for this indefinite integral.

Integrate[x*Sin[x],{x,1,2}]

This answer was arrived at via the F.T.C. by plugging the upper and lower limits into the above anti-derivative and subtracting.

Integrate[Exp[-x^2],x]

Note that in this case Mathematica uses a function that is not one you may be familiar with.  The Erf function is used in probability and statistics when dealing with normal distributions.

Integrate[Exp[-x^2],{x,0,Pi}]

NIntegrate[Exp[-x^2],{x,0,Pi}]

To see more decimal places we could use the N command:

N[Integrate[Exp[-x^2],{x,0,Pi}],20]

Some functions don’t have anti-derivatives that can be expressed as common (or uncommon) functions/expressions.  In these cases Mathematica might choke and just return the original expression, as follows:

Integrate[x^2/(Cos[x]^2+4*x^2),{x,0,Pi}]

In this case we can still use the approximating capabilities when dealing with definite integrals.

NIntegrate[x^2/(Cos[x]^2+4*x^2),{x,0,Pi}]

Remember that this is only an approximation.  The exact value of this integral is not currently known.

To see more information on how Mathematica does integrals, look up the Integrate or NIntegrate commands in the help.

Exercises

Create a Mathematica expression for (((x^3)-8)/(2-x)).  Evaluate this expression at x = 1, 2, 3, and π.

Create a Mathematica function for ((2Cos[x])/(1-(x^2))).  Find the limit from the left, limit from the right, and two-sided limit of this function as x approaches zero.  Graph the function to confirm the results of the limits generated.

Let f(x)=((sin(x))/x) (note that this is not Mathematica notation).  Graph the function f, it’s third derivative and an anti-derivative for this function over the interval (0, π), on the same set of axes.  Use the colors red, blue, and green resp. for the three functions (look in the help for Plot options) and pick appropriate options for scaling, line thickness/styles and axes labels so that the graph is “easy to read”.