Mathematica^® for Calculus III

Department of Mathematics
Rowan University





Abera Abay, Abdulkadir Hassen, Gary Itzkowitz, Hieu Nguyen
August 1998


TABLE OF CONTENTS


                                               
    
        Chapter 1.    Introduction                              
            1.1    Mathematica's Conventions                    2
            1.2    Calculator Operations                        4
            1.3    Functions                            5
            1.4    Basic Inputs                            6
            1.5    Basic Calculations                        7
            
        Chapter 2.    Calclulus of One Variable                    
            2.1    Graphs of Functions                        11
            2.2    Limits                                12
            2.2    Differentiation                            14
            2.3    Integration                            17
            
        Chapter 3.    Parametric Equations and Polar Graphs            
            3.1    Parametric Curves                        19
            3.2    Polar Curves                            23
             
        Chapter 4.    Vector Calculus                        
            4.1    Vector Algebra                        26
            4.2    Vector Valued Functions                    29    
            
        Chapter 5.     Functions of Several Variables                
            5.1    Graphs of Functions of Two Variables                35
            5.2    Partial Derivatives and Gradient                42
            5.3    Multiple Integrals                        53

   


Chapter One  

Introduction to Mathematica

1.1   Mathematica's Conventions

1. 1. 1   Naming

Built-in Mathematica commands, functions, constants, and other expressions begin with capital letters, and are - for the most part-  one or more full-length English words. Mathematica is case sensitive and so a common cause of error is the failure to capitalize command names. For example, Plot,  Integrate, FindRoot, ParametricPlot3D are valid function names. Sin, Exp, Det, GCD, Max are some of the standard mathematical abbreviations that are exceptions to the full-length-English-word(s) rule. User defined functions and variables can be any mixture of upper and lower case letters and numbers. However, a name cannot begin with a number. By convention, user defined functions  begin with a  lower-case letter, but this is not required. For example f, g1, myPlot, r12, sOLution, Method1, are permissible function names.

Example 1:      Evaluate cos(π)

Solution:     We will use this example to show two possible errors before giving the correct answer.

cos[Pi]

General :: spell1 : Possible spelling error: new symbol name \"cos\" is similar to existing symbol \"Cos\".

cos[π]

This is a typical capitalization error one makes when using Mathematica.  The comment before the output  Out[1] = cos[π] indicates a possible error.

Cos[pi]

Cos[pi]

Here Mathematica did not recognize pi and hence returned the command unevaluated. The correct command to evaluate cos(π) is

Cos[Pi]

-1

NOTE:    It is worth noting that Mathematica keeps track of the calculations it performs in a given session. The inputs are denoted by In[k] and the outputs are denoted by Out[k]. Thus, In[1] is the first input and Out[1] is the output of the first input.

1. 1. 2   Parentheses, Square Brackets and Braces

Mathematica interprets various types of brackets differently. Using an incorrect type of bracket is another common source of error.  Mathematica's bracketing conventions are:

1) Parentheses, ( ), are used only for grouping. For example (x-y)^2, 1/(a+b), (x^3-y)/(x+3y^2). It is worth noting that Mathematica understands f(2) as f times 2, and not as the value of the function f at 2.

2) Square Brackets, [ ], are used for function arguments. Thus Sin[Pi], Simplify[(x^3-y`^3)/x-y)], Sqrt[346] are proper use of square brackets. If f is a user-defined function, then f[2] is f evaluated at 2.

3) Braces or curly brackets, { }, are used  for lists, ranges, and iterators. In all cases, elements are separated by commas. Here are the typical use of braces:
{1, 4, 9, 16, 25 ,36}   the list of the square of the first six positive integers.
Plot[ f[x], {x, -5,5}]   specifies the range of values for x.
Table[m^3, {m, 1, 100}] specifies the values of the iterator m, i.e., the values of m; m goes from 1 to 100.

NOTE:    We can write comments with an input. The comments should be enclosed by (* and *). For example, Table[ n^2,{ n, 1, 6 } ]   (*returns a list of the square of the first six positive integers*)

Example 2:     Below we give examples of the correct and incorrect usage of brackets.

(2^3 - 4)/(4 + 3 * 9^2)           (* a  correct use of (...) *)

4/247

[2^3 - 4]/[4 + 3 * 9^2]         (* an incorrect use of [...] *)

                            3 Syntax :: tsntxi : \"[2  - 4] \" is incomplete; more input is needed.

  3 [2  - 4]/[4 + 3 * 9^2]

Sqrt[343]        (* a correct use of [...] *)

7 7^(1/2)

Sqrt (343)      (* an incorrect use of (...) *)

343 Sqrt

1. 1. 3   Equal Signs

The following are Mathematica rules of using the equal sign symbol.
1)  A single equal sign ( = )  assigns a value to a variable. Thus q=3 means that q will be assigned the value 3. If we enter 10+q^3, Mathematica will return 37. As another example take y=x^3-x+1. Now, if we assign a value for x, say x=2, then Mathematica evaluates y using that value of x  and uses the result, 7 in our case, in any input containing y afterwards.

2) A colon-equal sign( := ) creates a delayed statement for an expression, used in defining a function. For example f[x_]:=x^3-x+1 will reevaluate the function f for each new value of x. We will say more about defining functions in Section 1.3 below.

3) A double equal sign( = = ) is a test for the equality of two expressions. If we set x = -5, then evaluating x == -5 returns True, and x == 5 returns False. Another common usage of == is as in Solve[x^3-x+1==0,x] (See Section 1.5  below.)

1. 1. 4   Referring to Previous Results

Mathematica remembers all of the inputs and outputs in a session, and we can refer to a previous output by using the percent sign (%) notation. A single % refers to Mathematica's last output, %% refers to the next-to-last output, and so on.   %k refers to output  line numbered k. For example %45 refers to output number 45.
NOTE: CTRL +L reproduces the last input and CTRL+SHIFT+ L reproduces the last output.   

1.2   Basic Calculator Operations

Mathematica uses +, - , * , / ,  and  ^  for addition, subtraction, multiplication, division and power, respectively. Multiplication can also be performed by leaving a blank space between factors.

Mathematica can  convert  numerical values to decimal form. The command for this is N[expr] or N[expr,n].  In most cases, N[expr] returns six digits of expr or gives expr in the form n.abcde*10^m.  N[expr,n] attempts to give n digits  of expr. Mathematica can perform calculations to arbitrary precision and can handle numbers that are arbitrarily large or small.

Example 3:     Here are some typical usages of N[..]

Pi

π

N[%]

3.14159

Note that the command   N[%] gives a decimalized version of the last output. Similarily  N[%k] can be used to get the decimal equivalent of Output[k].  

N[Pi, 200]

Exercise 1.1. Evaluate the following expressions:
a) 103.41+20*76    b) (5^2 + π)/(1 + π)     c) 1/(1 + 1/(1 + 1/4 !))     d) (2.06 * 10^9)/(0.99 * 10^(-8))
e) What is the remainder of 1998 divided by 13?

1.3   Functions

We can define our own function in Mathematica. The command for defining a function such as f(x)=(x^2 + x + 2)/(x   +   1) in Mathematica is f[x_]:=( x^2 + x + 2)/(x   +   1). Once we evaluate this,  Mathematica will understand f[x] as (x^2 + x + 2)/(x   +   1). Thus, evaluating f[a] returns the value of f at a, while evaluating f[ {a, b, c, ...}]   returns the values of f at a, b, c, ... respectively. Here is an example. But first an important
Reminder: Mathematica reads f(a)  as f times a.

Example 4:    (a)    Define the function   f(x)=(x^2 + x + 2)/(x   +   1)in Mathematica
        (b)      Evaluate f(10)
        (c)    Evaluate f(x), for x =-3, -2, -1, 0, 1, 2, 3.

Solution:     

f[x_] := (x^2 + x + 2)/(x + 1)

Observe that the output is not displayed. To check that we have defined our function correctly, we evaluate

f[x]

(2 + x + x^2)/(1 + x)

Since addition is commutative, this is the given function f(x). We now proceed to solve (b) and (c).

f[10]

112/11

f[{-3, -2, -1, 0, 1, 2, 3}]

                                     1 Power :: infy : Infinite expression  - encountered.                                      0

{-4, -4, ComplexInfinity, 2, 2, 8/3, 7/2}

Thus f(10)=112/11, and the last output shows that f(-3)=-4, f(-2)=-4, f(-1)=ComplexInfinity, f(0)=2, f(1)=2, f(2)=8/3, and f(3)=7/2. Note that Mathematica is warning us that it has encountered the undefined expression 1/0 and gave us ComplexInfinity for f(-1).

Sometimes we may want to deal with an expression such as (x^2 + x + 2)/(x + 1) temporarily. To evaluate such expressions at some given value(s) of x, say, x = 10  or  x =-3, -2, -1, 0, 1, 2, 3,   we do not  need to define  the expression as a function. We can use the substitution command  /. Here is how it works.    

Example 5:    Consider the expression  (x^2 + x + 2)/(x + 1).
        (a)    Find the value of this expression when x =10.
        (b)    Find the value of this expression for x=-3, -2, -1, 0, 1, 2, 3.

Solution:

(x^2 + x + 2)/(x + 1)/.x->10

112/11

(x^2 + x + 2)/(x + 1)/.x-> {-3, -2, -1, 0, 1, 2, 3}

                                     1 Power :: infy : Infinite expression  - encountered.                                      0

{-4, -4, ComplexInfinity, 2, 2, 8/3, 7/2}

Exercise 1.2.  Enter the following functions into Mathematica:
a) f(x)=2x^3-6x^2+x-5        b) g(x)=(x^2 - 1)/(x^2 + 1)        c) h(x)=|x^(1/2)-3|

Exercise 1.3.
Evaluate the following functions using Mathematica and evaluate each function at the given point.
a) f(x)=1001+x^4 at x=25         b) 1+x^(1/2)+x^(1/3)+x^(1/4) at x=π


1.4   Basic Inputs

Mathematica 3.0 allows us to enter mathematical expressions and some of the commonly used commands from  6 different palettes. If we click on the File menu and go to Palettes we will find 7 options. The first six options conatin most of the symbols we need.  BasicInput is a palette which can be used to enter mathematical  expressions involving exponents,  rational expressions, radicals, integrals, derivatives, summation, product, matrices, some of  the commonly used constants( π,  e, i, ∞) and some of the Greek letters.  

Example 6:    Enter ∫_0^1x^3/(2x - 1)^(1/2)dx   in a notebook.

Solution:    One way to enter this expression into a Mathematica notebook is as follows: Go to the BasicInput palette and click on the definite integration symbol ∫_□^□d . Type 0 in the lower box and using the TAB key move to the top box and type 1. Use the TAB to go to the box where the integrand should be typed. While in this box go to the palette and  click on □/□. Go back to the pallete and click on □^□ and type x^3 in this box. Go to the box in the denominator and then go to the palette to click on □^(1/2) and type 2x-1. Finally, using the TAB once again, go to the last box and type x.

Exercise 1.4:     Enter the following expressions in a notebook.

    (a)    80^(1/3)            (b)    1024^(1/5)/2^(-3)        (c)    125^(1/2)^(1/3)
    
    (d)    
(10a^7b)^(1/3)^(1/2)        (e)    ((x^(-3) y^4)/5)^(-3)        (f)     ((3m^1/6n^1/3)/(4n^-2/3))^2  
    


1.5   Basic Calculations

The BasicCalculations palette contains several options. These are Arithmetic and Numbers, Algebra, Lisits and Matrices, Trigonometric and Exponential Functions, Calculus, Other Functions, and Graphics. Each of these is preceeded by a triangle. Click on the shape to see the contents of a  palette in a category.  In this section, we will discuss the options in Algebra and Calculus triangle.

1.5.1   Algebra


Algebra is subdivided into three parts: Solving Equations, Polynomial Manipulation and Complex Numbers.

Polynomial Manipulation contains the commands Expand[ ], Factor[ ],  Together[ ], Apart[ ], Cancel[ ], Simplify[ ], FullSimplify[ ].  

NOTE:  The commands Expand, Factor, Together, Apart, Cancel, Simplify, FullSimplify, TrigExpand, TrigFactor, TrigReduce, ExpToTrig, PowerExpand,  and ComplexExpand can also be entered from  AlgebraicManipulation palette of the Palettes submenu. However, the commands in AlgebraicManipulation palette are applied after entering and highlighting the expressions to which we apply the command and click on the button of the command we want from the palette. The result of a command will replace the input we have entered. In other words, the commands of AlgebraicManipulation palette are in-place simplifications.  

Solving Equations  contains different forms of the Solve commands. Solve[ lhs == rhs, var] is the command to solve  the equation lhs = rhs for the variable var. Thus, Solve[x^2-1==0,x] is the command to solve x^2-1=0 for x. In such cases where there is only one variable in the equation, we may not need to specify the varaible. Thus, Solve[x^2-1==0,x] and Solve[x^2-1==0] give the same solutions. Solve[{ lhs_1== rhs_1,lhs_2== rhs_2,... },{x_1,x_2,...} ] solves a system of equations for the variables x_1,x_2,...
Numerical approximations of solutions may be obtained by the command NSolve[ lhs==rhs,var].

Example 7:     Expand each of the following:    
        
        (a)     (x+1)(x-1)            (b)     (x+y-2)(2x-3)
        
Solution: The command we need is Expand[...].

a = Expand[(x + 1) (x - 1)]

-1 + x^2

b = Expand[(x + y - 2) (2x - 3)]

6 - 7 x + 2 x^2 - 3 y + 2 x y


Example 8:     Factor each of the following:     
        (a)     x^3-2x^2-3x            (b)    4x^2/3+8x^1/3 +4
        
Solution:    We use the Factor[...] command.

a = Factor[x^3 - 2x^2 - 3x     ]

(-3 + x) x (1 + x)

b = Factor[ 4x^2/3 + 8x^1/3 + 4  ]

4 (1 + x^(1/3))^2

Example 9:      Simplify the given expressions.  
    (a)    (x^2 + 4x - 12)/(3x - 6)        (b)    (2/x - 3)/(1 - 1/(x - 1))        (c) x(1 - 2x)^-3/2+(1 - 2x)^-1/2            
Solution:    We will first use Simplify or FullSimplify command and then apply Together.

a = Simplify[(x^2 + 4x - 12)/(3x - 6)]

(6 + x)/3

b = FullSimplify[(2/x - 3)/(1 - 1/(x - 1)) ]

-3 - 2/(-2 + x) + 1/x

Together[%]

(-2 + 5 x - 3 x^2)/((-2 + x) x)

c = FullSimplify[ x(1 - 2x)^-3/2 + (1 - 2x)^-1/2]

1/(1 - 2 x)^(1/2) + 1/x[1 - 2 x]^(3/2)

Together[%]

((1 - 2 x)^(1/2) + x[1 - 2 x]^(3/2))/((1 - 2 x)^(1/2) x[1 - 2 x]^(3/2))

Note that the last result of (c) is not in its simplest form  (1+x -2 x^2)/(1 - 2x)^3/2.  Thus, we should keep in mind that the commands Simplify and  FullSimplify are efficient for polynomials and rational function  but may not be efficient for expressions involving radicals , trigonometric functions, and exponentials.

Example 10 :     Perform the indicated operations:
        (a)    -1/x+2/(x^2 + 1)+1/(x^3 + x)            (b)    (5/y-6/(2y + 1))÷(5/y+4)    

Solution:

a = Together[-1/x + 2/(x^2 + 1) + 1/(x^3 + x)]

(2 - x)/(1 + x^2)

b = Simplify[ (5/y - 6/(2y + 1)) ÷ (5/y + 4)]

1/(1 + 2 y)

Example 11:      Solve the folowing equations:
        a) x^2-x-1=0                  b)   

2x + 13y = 4
3x -3y =- 5
        
Solution:

a = Solve[x^2 - x - 1 == 0]

{{x→1/2 (1 - 5^(1/2))}, {x→1/2 (1 + 5^(1/2))}}

b = Solve[ {2x + 13y == 4, 3x - 3y == - 5}]

{{x→ -53/45, y→22/45}}

Exercise 1.5.  Expand each of the following expressions:

a) (x+1)(x-1)         b) (x+y-2)(2x-3)

Exercise 1.6.  Factor each of the following expressions:

a) x^3-2x^2-3x        b) 4x^(2/3)+8x^(1/3)+3.6        c) 6+2x-3x^3-x^4

Exercise 1.7.  Simplify the following expressions using both of the commands Simplify and FullSimplify:

a) (x^2 + 4x - 12)/(3x - 6)            b) (2/x - 3)/(1 - 1/(x - 1))            c) (x(1 - 2x))^(-3/2)+(1 - 2x)^(-1/2)

Exercise 1.8.  Perform the indicated operations:

a) -1/x+2/(x^2 + 1)+1/(x^3 + x)        b) (5/y-6/(2y + 1))÷(5/y+4)

Exercise 1.9.  Solve the following equations for x:

a) x^2-x+1=0        b) x(1 - 2x)^(-3/2)+(1 - 2x)^(-1/2)=0

Exercise 1.10. Approximate the solution of the equation tan x + e^x=0  near x=0.

1.5.2   Calculus

The Calculus palette is subdivided into three parts:  Common  Operations, Differential Equations and Numerical Root Finding. Common Operations contains a palette for integration, derivative, limit, summation, product, and series. The symbols for all of these can also be entered from the BasicInput palette, which was discussed in Section 1.4 above.     
Differential Equations contains a palette for solving differential equations symbolically as well as numerically. The last part, Numeric Root Finding, contains commands for finding numerical solutions for equations by specifying an initial approximation of a root.  FindRoot [ lhs==rhs,{x,x_0}] finds a root of the equation lhs=rhs in the variable x with a first approximation x_0. FindRoot[ lhs==rhs,{x,x_0, a,b}] searchs for a root between a and b.  For transcendental equations or for search of a zero of a function near a given point  FindRoot is recommended. We give an example below.

Example 12:   Solve  the equation:  sin2x + cosx =0               

Solution: We will use Solve command first and then  FindRoot.

a = Solve[Sin[2x] + Cos[x] == 0]

Solve :: svars : Equations may not give solutions for all \"solve\" variables.

{{Cos[x] → -Sin[2 x]}}

a = FindRoot[Sin[2x] + Cos[x] == 0, {x, 0}]

{x→ -0.523599}

Thus, Solve does not give a solution while FindRoot  does. In fact, FindRoot  yields the solution  x = -0.523599 or  x = -π /6 for  the equation  sin 2x + cos x = 0. This solution is the one closest to x = 0. Similarily we can find the solutions of this equation near other points, such as 1, 2, 3, ....  We leave this to the student as an exercise. In the next chapter, we shall learn how to draw graphs of  functions. Here is the graph of  f(x) = sin(2x) + cosx.   

Plot[Sin[2x] + Cos[x], {x, -10, 10}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_153.gif]


CHAPTER   TWO

CALCULUS OF ONE VARIABLE


2.1   Graphs of Functions

Plot[f,{x,a,b}] generates a plot of f as a function of x as x goes from a to b.  Plot[ { f_1, f_2, f_3, ... }, { x, a, b } ]  plots the graphs of the functions  f_1, f_2, f_3 ...  over the interval [a,b]. Plot has many options most of which  we will discuss in this  chapter. In  Mathematica 3.0 Plot can be entered from the menu  File-Palette-BasicCalclulations-Graphics.  

Example 1 :     Draw the graph of f (x) = x + 5/x .

Plot[x+5/x , {x,-5,5}];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_161.gif]

Example 2:  Plot the graphs of the functions  (x^2 + x + 2)/(x + 1)and (sin (4x))/4 on the same set of axes for -4≤x≤4.

Plot[{(x^2 + x + 2)/(x + 1), Sin[4x]/4}, {x, -6, 5}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_165.gif]

Notice that the graph of (x^2 + x + 2)/(x+1) is not visible in this output since the range from -1 to 1 along the vertical axis is too small.  We can expand this range by using the PlotRange option:

Plot[{(x^2 + x + 2)/(x + 1), Sin[4x]/4}, {x, -6, 5}, PlotRange-> {-5, 5}] ; <br />

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_168.gif]

Exercise 2.1.  Plot the graphs of the following functions on the specified interval:
a) f(x)=x^2+1 on [-5,5]    b) g(x)=1/(x - 2) on [0,4]    c) h(x)=(sin x)/x on [-π,π]

Exercise 2.2. Plot the graphs of f(x)=0.01x(x-3)(x+3) and g(x)=2x+1  together on the same set of axes and over the interval [20,20].  Use the PlotRange option to change the range so that their points of intersection are visible.



2.2   Limits

Limit[f, x -> a]  finds the limit of the function f when the variable x approaches a. The command for the left hand-side limit is Limit[f, x->a, Direction->1] and for the right hand-side limit is Limit[f, x->a, Direction->-1]. If it encounters functions about which it has no specific information, Limit returns an unevaluated expression. Limit returns  an interval to represent a range of possible values of the function when a limit does not exist.  

Example  3:      Evaluate  

lim
x→1
(( x^2 + x + 2)/(x + 1))

Limit[(x^2+x+2)/(x+1),x->1]

2

Example 4:    Evaluate

lim
x→0
(( sin(4x))/(tan x ))

Limit[Sin[4x]/Tan[x],x→0]

4


Example 5:    Evaluate     

lim
x→∞
(e^x/x)
(Note: To enter the Euler number e,  you can either type E or obtain it from the BasicInput palette,  where you can also find ∞  among others).

Limit[e^(x)/x,x->∞]

∞

Example 6:    Evaluate     

lim
x→1^+
(1/(ln x)-1/(x - 1))
Note:  The natural logarithmic function ln x is one of the built-in Mathematica  functions  and  is entered as Log[x].   The logarithmic function  log_a x is entered  as  Log[a,x].

Limit[(1/Log[x])-(1/(x-1)),x->1,Direction->-1]

1/2

Example 7: ( An example where the limit does not exist.)   Evaluate   

lim
x→∞
( cos x)

Limit[Cos[x],x->Infinity]

Interval[{-1, 1}]

Exercise 2.3.  Compute the following limits:
a) Underscript[lim , x→1] x^2-1/(x - 1)        b) Underscript[lim , x→ -5]100/(x + 5)        c)Underscript[lim , x→∞](1 + x + x^2)/(x^10 - x)^(1/3)    d) Underscript[lim , x→0]sin x/x

e) Underscript[lim , x→0^+] ((1 - ln x)/e^1/x )        f)   

lim            ( sin  x)^(1/x)
x→0^+                        
      g)
lim             ( sec 3x cos 5x)

Exercise 2.4. Find the derivative of f(x)=cos x  according to the limit definition and evaluate the answer at x=π.

2.3   Differentiation

All the rules of differentiation are programmed into Mathematica. This makes it easy to differentiate complicated expressions. The notation D[ f, x ] calculates the derivative of the function f with respect to the variablre x. We can obtain higher derivatives of order n, by using the command D[f, { x, n } ]. In Mathematica 3.0 we can get the command for derivatives from the File-Palette-BasicCalculations-Calculus-Common Operations. The symbol  for the derivative of  a functions of one variable is ∂_□ .

Example 8:  Find the derivative of x sin x and the value of the derivative at x=π/4.

Solution:     There are a number of ways to find this derivative. One way is to type in D[x*Sin[x], x]. The second method is to go to the Common Operations submenu of Calculus  and click on ∂_□, and in the lower box type x and use the TAB key to move to the second box and type the function, in this case x*Sin[x]. The third way is to type f=x*Sin[x] and compute D[f, x].  Yet,  another way to find the derivative  is by defining a function. This is   done by typing f[x_] :=   x*Sin[x].  Now we can just type f'[a] to find the derivative of f at a. It is very important to Clear any previous use of the letters you are  going to use to denote a function or an expression.  Here  is an illustration of each of the above methods. In all the methods  except Method 5,  we will  use the substitution command  expr /.x-> a which  replaces x in expr  by the value a.

Method 1:

D[x*Sin[x],x]

x Cos[x] + Sin[x]

D[x*Sin[x],x]/.x-> π/4

1/2^(1/2) + π/(4 2^(1/2))

N[%]

1.26247

Method 2: (Note: x sinx should be written between parentheses. Can you guess why?)

∂_x   ( x * Sin[x])

x Cos[x] + Sin[x]

 ∂_x (  x * Sin[x]) /.x->Pi/4

1/2^(1/2) + π/(4 2^(1/2))

Method 3:

Clear[f]  
f = x*Sin[x]  

x Sin[x]

Df= D[f,x]

x Cos[x] + Sin[x]

Df /. x->Pi/4

1/2^(1/2) + π/(4 2^(1/2))

Method 4:

Clear[f]
f[x_] := x*Sin[x]  

D[f[x], x]

x Cos[x] + Sin[x]

D[f[x],x] /. x -> Pi/4

1/2^(1/2) + π/(4 2^(1/2))

Method 5:

f '[x]

x Cos[x] + Sin[x]

f'[Pi/4]

1/2^(1/2) + π/(4 2^(1/2))

Example 9:    Find the second derivative of      x(x^2 - 1)^(1/2)

Solution:     We give two methods:

Method 1:    We use the command D[f, { x, 2 } ] for the second derivative of f.

D[x*Sqrt[x^2-1],{x,2}]

-x^3/(-1 + x^2)^(3/2) + (3 x)/(-1 + x^2)^(1/2)

Together[%]

(-3 x + 2 x^3)/(-1 + x^2)^(3/2)

Method 2:     We use the prime notation of the derivative by defining  a function in Mathematica :

Clear[g]

g[x_] := x (x^2 - 1)^(1/2)

    g ' '[x]

-x^3/(-1 + x^2)^(3/2) + (3 x)/(-1 + x^2)^(1/2)

Example 10: Find an equation of the tangent line to the graph given by  x^2(x^2+y^2)=y^2 at the point (2^(1/2)/2,2^(1/2)/2).

Solution:     We need to find the slope of the tangent line. That is, find dy/dx at   x=2^(1/2)/2 and  y=2^(1/2)/2. To this end, we rewrite the given equation as x^2(x^2+y[x]^2)=y[x]^2 so that Mathematica will understand y as a function of x.   We shall call this equation eq.  Then we solve deq= D[eq,x] (this is the derivative of eq with respect to x) for y'[x] and substitute x and y[x] by 2^(1/2)/2. (Note: An equation in Mathematica is entered as ==.)  Here are the steps outlined above.

Clear[eq, deq, x, y]

eq =(x^2(x^2+y[x]^2)==y[x]^2)

x^2 (x^2 + y[x]^2) == y[x]^2

deq=D[eq,x]

2 x (x^2 + y[x]^2) + x^2 (2 x + 2 y[x] y^′[x]) == 2 y[x] y^′[x]

soln = Solve[deq,y'[x]]

{{y^′[x] → -(2 x^3 + x y[x]^2)/(-y[x] + x^2 y[x])}}

m=  soln /. {x->Sqrt[2]/2, y[x]->Sqrt[2]/2}

{{y^′[1/2^(1/2)] →3}}

The output   {{y^′[1/2^(1/2)]→3}} means that the slope is 3.(Can you see why?) Finally  we write the equation of the tangent line as:

Clear[x, y]

y=3(x-Sqrt[2]/2)+Sqrt[2]/2

1/2^(1/2) + 3 (-1/2^(1/2) + x)

Together[%]

-2^(1/2) + 3 x

Thus, the  equation of the tangent line is y=3 x-2^(1/2).

Exercise 2.5. Compute the derivatives of the following functions:
a) f(x)= 3x^2+1    b) g(x)=1/x^3        c) h(x)=(sin x)/(cos x)  d) y=ln(cos(e^x))    e)  y=e^xarcsec x

Exercise 2.6. Evaluate the derivatives of the following functions at the specified values of x:
a) f(x)=(x-1)(x+1) at x=1        b) g(x)=(x^(1/2) + 1)/(x^(1/2) - 1) at x=9

Exercise 2.7. Compute the second derivatives of the functions given in Exercise 2.5.

Exercise 2.8. Find an equation of the line tangent to the graph of x+y^2=0 at the point P(9,-3).

Exercise 2.9. Find all relative extrema of the function: a)  f(x)=x^4-7x^2+10 and b) f(x)=(2x^2 - 3x + 5)/(x^2 + 1).

Exercise 2.10.  Find  all relative extrema of f(x)=   (x^2 + 1)^(1/2)  - 1/2 x. Also, find the absolute minimum and absolute maximum values of f(x) on [0,2].

Exercise 2.11. Use implicit differentiation to find (d y)/(d x) if x^2y+3x y^2-x=3. Also find the equation of the tangent line to the graph of the equation at the point (1,1).

Exercise 2.12. Let f(x)=e^(sin x) for -2π≤x≤2π
    (a)    Define f in Mathematica
    (b)    Find the solutions of f ' (x)=0. (Hint: Use FindRoot )
    (c)    Identify the relative extrema of f.
    (d)    Find the inflection points of f.
    (e)    Verify your answers in (b), (c), and (d) by drawing the graph of f.
    

2.3   Integration

Integrate[ f,  x] gives the indefinite integral of f .  Integrate[f, {x, a,b}] gives the definite integral of f over the interval  [a , b]. Integrate can evaluate integrals of rational functions. It can also evaluate integrals that involve exponential, logarithmic, trigonometric and inverse trigonometric functions, so long as the result comes out in terms of the same set of functions.  Integrate[ f,  x] and Integrate[f, {x, a, b}] can be entered from ( what should by now be)  the familiar menu File-Palette-BasicCalculations-Calculus-Common Operations.  We can get a numerical result by applying N to a definite integral. That is, NIntegrate[f, {x, a, b}] gives a numerical approximation to the definite integral  ∫_a^b f(x)   dx.

Example 11: Evaluate   x(x^2 + 1)^2dx

Solution:  We give two methods. In the first method, the input will be entered without using a palette. In the second method we will use a palette for the input.

Method 1:

Integrate[x(x^2+1)^2,x]

x^2/2 + x^4/2 + x^6/6

Method 2:

∫x (x^2 + 1)^2x

x^2/2 + x^4/2 + x^6/6

Question: If you use the  substitution method the answer you get is   1/6 (1 + x^2)^3+C.  How do we reconcile these differences?

Example 12:   Evaluate   (x^5 + x^2 + x + 2)/(x^2 + 1)^2dx

Solution:  

∫ (x^5 + x^2 + x + 2 )/(x^2 + 1)^2x

x^2/2 + (-2 + x)/(2 (1 + x^2)) + (3 ArcTan[x])/2 - Log[1 + x^2]

Note:    All functions in an output appear in Mathematica's notation. To convert a function in an output to a more familiar form use the command TraditionalForm. For the above example the "traditional" form is obtained as follows. (Note that log x is the same as ln x.)  

∫ (x^5 + x^2 + x + 2)/(x^2 + 1)^2x//TraditionalForm

x^2/2 + 3/2 tan^(-1)(x) - log(x^2 + 1) + (x - 2)/(2 (x^2 + 1))

Example 13:   Approximate  ∫_0^1 tan x^2dx

Solution:     The first thing we want to do is let Mathematica  evaluate  the integral.  If Mathematica returns  an unevaluated integral , we use either N[%] ( a command for numerical  approximation of  the  previous output)  or   NIntegrate[f, {x, a, b}] .

∫_0^1 Tan[x^2] x

∫_0^1Tan[x^2] x

N[%]

0.398414

The above two steps can be combined as follows:

NIntegrate[Tan[x^2], {x, 0, 1}]

0.398414

Exercise 2.13. Integrate each of the following and check your work by differentiating the answer.

a) ∫(x^2+2)dx        b) ∫cos 3xdx        c)    x/(x^2 + 1)dx    d) (^x + ^(-x))/(^x - ^(-x))dx

Exercise 2.14.  Evaluate each of the following integrals.
a) ∫_0^1(1 - x^2)^(1/2)dx        b) ∫_ (-π)^πsin^( 2)xdx       c) ∫_2^∞1/x(x - 1)^(1/3)dx

Exercise 2.15.  Approximate the area under the curve y=(1 - x^2)^(1/2) and above the interval [0,1].  (How does this answer compare with the answer in part c, Exercise 2.14 a)?)

Exercise 2.16. Compute the arc length of  the curve:
a)  y=(1 - x^2)^(1/2) along the interval [0,1].     b)  y = 1/6 x^3 + 1/(2x) on [1,3].

Exercise 2.17. a) Compute the area of the region enclosed by the graphs of f(x)=x^3 and g(x)=x.
b) Sketch the region that is bounded by the graphs of f(x) = 3^x and g(x) = 2x+1 and find the area of the region.

CHAPTER   THREE

PARAMETRIC EQUATIONS AND POLAR GRAPHS

3.1   PARAMETRIC CURVES

Example 1: Sketch the curve described by the parametric equation
      x =cos t ; and  y=sin t,   0 !≤ t !≤ 2π
Solution:
.

ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2π}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_301.gif]

Recall that the above parametric equations represent the unit circle. However, Mathematica  produced a  graph that visually looks like an ellipse due to the different settings of the x and y-axes. An important option to fix this is to use the option AspectRatio. The default value of aspect ratio, which is the ratio of  the height to the width of a plot, is 1/GoldenRatio and its value is

N[1/GoldenRatio]

0.618034

This value was chosen because it produces plots that are pleasing to the eye. However, to get a plot that accurately represents the graph of the given equations we need to set aspect ratio to automatic. We do this as follows.

ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2π}, <br />    AspectRatio->Automatic] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_305.gif]

Example 2:   Sketch the curve described by the parametric equation

      x =t^2 - 4; and  y=t/2  , -2 !≤ t !≤ 3
Solution:
.

ParametricPlot[{t^2 - 4, t/2}, {t, -2, 3}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_309.gif]

Example 3:    Sketch the curve (prolate cycloid)   described by the parametric equations

               x =2θ - 4 sinθ   and  y= 2 - 4 cosθ.
Solution:           

ParametricPlot[{2θ - 4Sin[θ], 2 - 4Cos[θ]}, {θ, -4Pi, 4Pi}, <br />PlotLabel->"prolate cycloid"] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_311.gif]

Note that in the above input we have used the the command PlotLabel. In general, the command PlotLabel ->"text" prints the title text for the given plot.

ParametricPlot[{(4t)/(1 + t^3), (4t^2)/(1 + t^3)}, {t, 0, 20}, <br />    AspectRatio->Automatic, PlotLabel->"Folium of Descartes"] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_314.gif]

b) In order to find the points of horizontal tangency, we find the points where the slope of the tangent line is zero. Hence, we evaluate

Solve[D[(4t^2)/(1 + t^3), t] == 0, t]

{{t→0}, {t→ -(-2)^(1/3)}, {t→2^(1/3)}, {t→ (-1)^(2/3) 2^(1/3)}}

Thus, there are two points, corresponding to t = 0 and t = 2^1/3, at which the tangent lines are horizontal.

Example 5: Find the arc length of the curve x = e^(-t) cost,  y =e^(-t) sint;    0 !≤ t !≤ π/2.
   Solution:

∫_0^(π/2) √ ((D[E^(-t) Cos[t], t])^2 + (D[E^(-t) Sin[t], t])^2) t

2^(1/2) - 2^(1/2) E^(-π/2)

N[%]

1.12023

Exercise 3.1. Sketch the curve represented by the parametric equations.
a) x=t^3 , y = t^2/2    b) x=2(θ-sin θ),  y= 1-cos θ    c) x=3cos^3 θ, y=3sin^3 θ

Exercise 3.2. Find all points of horizontal and vertical tangency to the curve
x= cos θ + θ sin θ,  y= sin θ - θ cos θ,  0 !≤ θ !≤2π.

Exercise 3.3.Consider the parametric equations given by x= 3 cos (t/3) - cos t and y = 3 sin (t/3) - sin t.
a) Graph the curve represented by the parametric equations.
b) Find the slope of the tangent line at the point where t = π/4.
c) Find the length of the arc from t=0 to t = 3π/2.

3.2   POLAR   CURVES

In order to graph polar equations in Mathematica, we must load the package for polar plotting, We do this  prior to plotting and by typing:

Needs["Graphics`Graphics`"]

Example 6:   Sketch the graph of r = 3 - 4 cosθ.
Solution:

PolarPlot[3 - 4Cos[θ], {θ, -4Pi, 4Pi}, <br />    AspectRatio->Automatic] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_331.gif]

Example 7 :     Sketch the graph of the six - leaf rose r = 2 Cos ((3θ)/2) . <br /><br />Solution :

PolarPlot[2Cos[3θ/2], {θ, -4Pi, 4Pi}, <br />    PlotLabel->"A Six-leaved Rose", AspectRatio->Automatic] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_334.gif]

Example 8:    Find the area of the region that is inside the circle r = 3 sinθ and outside the convex limacon r = 2- sinθ.

Solution:  First, we plot the two polar curves on the same axes.

PolarPlot[{3Sin[θ], 2 - Sin[θ]}, {θ, 0, 2π}, <br />    AspectRatio->Automatic] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_336.gif]

Next, we find the values of θ that correspond to the two points of intersection of the above curves.

Solve[3Sin[θ] == 2 - Sin[θ], θ]

Solve :: ifun : Inverse functions are being used by Solve, so some solutions may not be found.

{{θ→π/6}}

Note that Mathematica gives only the solution   θ = π/6   which lies in the first quadrant since inverse functions are being used. We can see from the above graph that the other point of intersection must be at θ = (5π)/6. Thus, the area enclosed is given by (using symmetry)

Integrate[(3Sin[θ])^2, {θ, Pi/6, Pi/2}] - <br />Integrate[(2 - Sin[θ])^2, {θ, Pi/6, Pi/2}]

3 3^(1/2)

N[%]

5.19615

Exercise 3.4. Graph the given polar equation and find an interval for θ over which the graph is traced only once.
a) r = 3 -4 cos θ    b) r = 2 + sin θ   c) r= 3cos(3θ/2)  d) r= 5 sin 2θ

Exercise 3.5. Consider the rose curve r = cos ( 2θ) for -2π !≤  θ !≤ 2π.
a) Graph the curve.
b) Find the area of one petal of the curve.

Exercise 3.6. Generate the butterfly curve r = ^(cos θ) - 2 cos (4θ) + sin^5 (θ/12).

Exercise 3.7.  Graph and find the area of each of the following regions.
a) The common interior of r=3- 2 sin θ and r=-3+2 sin θ
b) Inside r=2 (1+cos θ) and outside r=2 cos θ
c) Inner loop of r=3+4 sin θ

Exercise 3.8. Find the length of the given curve on the specified interval.
a) r=1+ sin θ , 0 !≤ θ!≤2π.    b) r=6 (1+ cos θ),  0 !≤ θ!≤2π.

Exercise 3.9. Consider the polar equations r = 4 sin θ and r = 2 ( 2 - sin^2 θ).
a) Graph the polar equations on the same axes.
b) Find the points of intersection of the curves.
c) Find the circumference of each curve.

CHAPTER   FOUR

VECTOR CALCULUS

4.1   VECTOR  ALGEBRA

Vectors are typed in braces with commas between components. For example if a is the vector   
a= i+3j -5k we type

a={1,3,-5}

{1, 3, -5}

The jth  components of a is denoted by a[[j]]. Vector addition, subtraction and scalar multiplications are performed  in a similar way as with numbers.The dot product of vectors a and b is obtained by  a.b and the length of a is obtained by Sqrt[a.a].

Example  1:  Let  a= i+3j -5k and  b= -i+2j +3k.  

Find 3a-2b, a.b,   ||b||,   ||a||,   and the third component of 5a+4b.

Solution: First we will enter the components of a and b as lists. Then we we enter the solutions for  all the problems  in one cell: (Note: It is possible to enter more than one input under the same cell but  on different lines.  To go to a new line press the [RETURN] key. When Mathematica computes such   inputs the outputs will appear in rows with consecutive output numbers.)

a={1,3,-5}
b={-1,2,3}

{1, 3, -5}

{-1, 2, 3}

3a - 2b

a . b

Sqrt[a . a]

Sqrt[b . b]

     (5a + 4b)[[3]]

{5, 5, -21}

-10

35^(1/2)

14^(1/2)

-13

Example 2:  Show that the dot product of vectors  is commutative and that it is distributive  over addtion, that is , a.b= b.a  and a.(b+c)=a.b+a.c for any  vectors a ,b and c.

Solution:  We will show commutativity of dot product for vectors in space.

a={a1,a2,a3}
b={b1,b2,b3}
c={c1,c2,c3}
a.b-b.a
a.(b+c)-(a.b+a.c) (*if this is equal to 0, this proves the
distributive property*)

{a1, a2, a3}

{b1, b2, b3}

{c1, c2, c3}

0

-a1 b1 - a2 b2 - a3 b3 - a1 c1 + a1 (b1 + c1) - a2 c2 + a2 (b2 + c2) - a3 c3 + a3 (b3 + c3)

It is not clear why the last output is zero. We check this by entering:

Simplify[%]

0


Example 3:  Let  u= i+3j + 2k  v= 2i+3 j  and w = -2i+3j +4k. Find  u × v,  i×w and the saclar triple product of  u, v, and w (that is (u × v).w)

Solution:
In order to calculate the cross product of two vectors we need a package, called  Calculus`VectorAnalysis`. It is recommended that you  load this package before starting your work.  The command to load  this package is  Needs["Calculus`VectorAnalysis`"].  To compute the cross product u × v of  u and v we type CrossProduct[u,v].  In Mathematica 3.0, there is a   palette that contains the command for cross product. It is in File-Palettes-Lists and Matrices-Matrix  Operations and is denoted by Cross[□ ,□]. First, we  load the package:

Needs["Calculus`VectorAnalysis`"]

u={1,3,2}
v={-2,3,0}
w={-2,3,4}
i={1,0,0}

{1, 3, 2}

{-2, 3, 0}

{-2, 3, 4}

{1, 0, 0}

prod= CrossProduct[u,v]
CrossProduct[i,w]
prod.w

{-6, -4, 9}

{0, -4, 3}

36


Example 4: Consider the parallelepiped  with sides a=i+k, b=2i+j+3k  and c=i+j-2k.  

a)   Find the volume.    b)  Find the area of the face determined by b and c.

Solution:

a = {1, 0, 1}

b = {2, 1, 3}

c = {1, 1, -2}

volume = Abs[a . Cross[b, c]]

area = Cross[b, c] . Cross[b, c] ^(1/2)/2

{1, 0, 1}

{2, 1, 3}

{1, 1, -2}

4

(5 3^(1/2))/2

Exercise 4.1. Let u= 2i - j + 2k  and v= 5i + 4j - k.
a) Determine each of the following. i) 6u-4v    ii) ||u+v|| iii) u.v
b) Find u.v and u x v.
c) Find a unit vector that is orthogonal to both u and v.
c) Find the area of the triangle determined by u and v.

Exercise 4.2. Find the volume of the parallelepiped that is detremined by the vectors  u=i +j  and v=j + k and w = i +k .

Exercise 4.3. Let u = u_1 i  + u_2 j  + u_3 k,  v = v_1 i  + v_2 j  + v_3 k  and  w = w_1 i  + w_2 j  + w_3 k be vectors in space. Prove that:
a)  u x ( v + w ) =  ( u x v ) + ( u x  w)    b)   u . ( v x w ) = v . ( w x u )

4.2   VECTOR VALUED FUNCTIONS

The derivative of a vector valued function  r(t) ={ x(t) , y(t) , z(t) } of a single variable t can be obtained  by entering  D[r,t].  Another way is to type MapThread[ D,{r, {t, t, t}}]. MapThread applies the operator   D  (i.e., differentiation) to each of the three components of r with respect to the corresponding parameter  in { t, t, t }, so that we get dx/dt,  dy/dt,  and  dz/dt.

Example 5:
Find the first and second derivative of  r(t)=a cost i +asin t j+ bt k.

Solution: We will give two different methods. First, we want to make an observation. Once you  use letters like a ,b, x, y, etc,  to represent a certain quantity, Mathematica will keep using those values for  every input containing those letters. Thus,  before using the same letter for another representation we should tell Mathematica to clear the prevoius usage of the letters. The  command for this is (naturally)  Clear[....].  For both methods we define r in Mathematica.

Method 1:  

Clear[a, b]

r[t_] = {a Cos[t], a Sin[t], b t}

{a Cos[t], a Sin[t], b t}

r '[t]

r ' '[t]

{-a Sin[t], a Cos[t], b}

{-a Cos[t], -a Sin[t], 0}

Method 2:

r1 = MapThread[D, {r[t], {t, t, t}}]

r2 = MapThread[D, {r1, {t, t, t}}]

{-a Sin[t], a Cos[t], b}

{-a Cos[t], -a Sin[t], 0}

Example 6: Represent the hyperbola 4x^2-9y^2=36 ,  x   ≥  3,   in parametric form and find the equation of  the tangent line at (3,0).

Solution: One way of representing the curve in parametric form is by using hyperbolic functions and letting
                  x= 3 cosh t,  and  y= 2 sinh t.  
  To find the equation of the tangent line we proceed as follows:

Clear[r, t]

r[t_] := {3Cosh[t], 2Sinh[t]}

We solve r(t) = (3,0)  to find the value of t that corresponds to the point (3,0).  Once we find this value, say t_0  , we use the formula q(w)=r(t_0)+ w r'(t_0)   for the tangent line.

Solve[r[t] == {3, 0}, t]

Solve :: ifun : Inverse functions are being used by Solve, so some solutions may not be found.

{{t→0}}

<br />Clear[w] <br />r[0] <br />r '[0] <br />q = r[0] + w r '[0]

{3, 0}

{0, 2}

{3, 2 w}

Thus, a parametric equation of the tangent line is x=3, and y=2w.  The following is the graph of the  curve and the tangent line at (3,0).

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_423.gif]

Example 7: Consider the curve given by   r(t)=a cost i +a sint j+ ct k.

a) Find the length of the curve from (a,0,0) to (a,0,2πc).
b) Find the arc length parametrization of the curve.
c) Find its curvature.

Solution: We begin by defining r(t) in Mathematica.

Clear[a, c]

r[t_] := {a Cos[t], a Sin[t], c t}

a) Note that when we move from (a,0,0) to (a,0,2πc), t goes from t=0 to t=2π. Thus the length of the curve  between these two points is

l = ∫_0^(2π ) (r '[t] . r '[t])^(1/2) t

2 (a^2 + c^2)^(1/2) π

b) The arc length parameter s is given by:

Clear[t, u]

    s = ∫_0^t (r '[u] . r '[u])^(1/2) u

(a^2 + c^2)^(1/2) t

Solving for t we see that t =s/(a^2 + c^2)^(1/2).Thus the arc length parametrization of the curve is  
r(s)  =  a  cos(s/(a^2 + c^2)^(1/2))  i +a  sin(s/(a^2 + c^2)^(1/2))  j+ cs/(a^2 + c^2)^(1/2) k.

c)  We  first use the arc length parametrization of the curve to compute its curvature.

Clear[a, c, s]

r[s_] := {a Cos[s/(a^2 + c^2)^(1/2)], a Sin[s/(a^2 + c^2)^(1/2)], (c s)/(a^2 + c^2)^(1/2)}

T[s_] := r '[s] /(r '[s] . r '[s])^(1/2)

Thus, the curvature is given by:

κ = (T '[s] . T '[s])^(1/2)

Simplify[%]

a^2/(a^2 + c^2)^2^(1/2)

r[t_] := {a Cos[t], a Sin[t], c t}

k = 1/(r '[t] . r '[t])^3/2 (√ (CrossProduct[r '[t], r ' '[t]] . CrossProduct[r '[t], r ' '[t]])) <br />

(a^2 c^2 Cos[t]^2 + a^2 c^2 Sin[t]^2 + (a^2 Cos[t]^2 + a^2 Sin[t]^2)^2)^(1/2)/(c^2 + a^2 Cos[t]^2 + a^2 Sin[t]^2)^(3/2)

Simplify[%]

(a^4 + a^2 c^2)^(1/2)/(a^2 + c^2)^(3/2)

From this,  it can easily be shown that κ=  ( a)/(a^2 + c^2^ )

Example 8: The curve that is represented by the vector equation r(t)  = a(1+cos(t))  i + a sin(t) j + 2a sin(t/2) k is known as Vidiani's curve.   Consider the curve for a=1.

a) Plot the curve.

b) Compute the length of the curve from  t=0 to t=π.

c)  Calculate the curvature of the curve and compute the curvature at t=0.

Solution: To plot a  curve in three dimensions, we use the command ParametricPlot3D.  The syntax for this is ParametricPlot3D[{x,y,z},{t, tmin,tmax}].

ParametricPlot3D[{1 + Cos[t], Sin[t], 2Sin[t/2]}, {t, 0, 4Pi}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_450.gif]

r[t_] := {1 + Cos[t], Sin[t], 2Sin[ t/2]}

l = ∫_0^π (r '[t] . r '[t])^(1/2) t                 <br />

2 2^(1/2) EllipticE[1/2]

N[%]

3.8202

<br />κ = 1/(r '[t] . r '[t])^3/2 (√ (CrossProduct[r '[t], r ' '[t]] . CrossProduct[r '[t], r ' '[t]])) ; <br />

Simplify[%]

(13 + 3 Cos[t])^(1/2)/(3 + Cos[t])^(3/2)

Thus, the curvature at t=0 is given by

%/.t->0

1/2

Exercise 4.4. Graph the space curve that is represented by the vector-valued function.
a) r(t) = 1/2 t i + t^(1/2) j + 1/4 t^3 k b) r(t) = t i + ln t j + 1/2 t^2 k

Exercise 4.5. Sketch  and find the length of the curve:
r(t) = (sin t - t cos t) i +(cos t + t sint) j + t^2 k.

Exercise 4.6.
Find the curvature of the curve r(t) =  t i + t^2 j + 1/2 t^2 k.

Exercise 4.7.
Plot the following pairs of intersecting lines in space and find the point of intersection.
L_1:  x = 2t + 3,  y = 5t - 2,  z = -t + 1;      L_2 : x = -2t + 7, y = t + 8, z = 2t - 1.


CHAPTER FIVE

FUNCTIONS OF SEVERAL VARIABLES

5.1   GRAPHS OF FUNCTIONS OF TWO VARIABLES

The following command loads all graphics packges of Mathematica.

Needs["Graphics`Master`"]

5.1.1   Plot3D

Plot3D is the  three-dimensional analog of the Plot command. Given an expression in two variables and the domains for those two variables, Plot3D produces a surface plot. Plot3D has many options. We will discuss some of these options below. We begin with the simplest way of plotting a graph of a function of two variables.

Example 1:  Plot f(x,y) = sin(x-cosy).

Plot3D[ Sin[ x-Cos[y] ],{x,-3,3},{y,-3,3} ];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_469.gif]

The first option we consider is BoxRatios. BoxRatios is an option in Plot3D used to specify the ratio of the lengths of the sides of  the box. This is analogous to specifying the AspectRatio of a two-dimensional plot.  For Plot3D the default is BoxRatios->Automatic.  Below, we plot the graph of the function in example 1 with a different BoxRatio.

Example 2:

Plot3D[ Sin[ x-Cos[y] ],{x,-3,3},{y,-3,3},
BoxRatios->{1,1,.62}];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_470.gif]

Next, we consider the ViewPoint option. ViewPoint selects the point in space from which the observer looks at the object. Its default value is {1.3,-2.4,2.0}. This may be changed by entering a new value directly as an option or can be entered from 3D ViewPoint Selector of the Input menu. We give an example below.

Example 3:

Plot3D[ Sin[ x-Cos[y] ],{x,-3,3},{y,-3,3},
ViewPoint -> {0,3,2},
BoxRatios->{1,1,.62} ];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_471.gif]


Our third option is  AxesLabel.  It is a command used to label the axes in  plotting.

Example 4:

Plot3D[Sin[x-Cos[y]],{x,-3,3},{y,-3,3},
BoxRatios->{1,1,.62},
AxesLabel -> {"x ", "y ", "z "}];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_472.gif]

The fourth option we discuss is ColorFunction. ColorFunction is an option for various graphics functions which specifies a function to apply to z values to determine the color to use for a particular x, y region. It is an option for Plot3D, ListPlot3D, DensityPlot, ContourPlot and related functions. The arguments provided for the function specified by ColorFunction are always in the range 0 to 1.  ColorFunction -> Automatic yields a range of gray levels. ColorFunction -> Hue yields a range of colors. Another way of applying color to a surface is to select the color you want from Color Selector of  the Input menu.

Example 5:

Plot3D[ { Sin[x-Cos[y]], RGBColor[0.996109, 0, 0]},
{x,-3,3},{y,-3,3} ];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_473.gif]

Example 6:

Plot3D[Sin[x-Cos[y]],{x,-3,3},{y,-3,3},
ColorFunction->Hue ];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_474.gif]

Show is another option of Plot3D.   Show[graphics, options] displays two-and three-dimensional graphics, using the options specified. Show[g_1, g_2,] shows several plots combined.  

Example 7: Plot the graphs of f(x,y) = 3x + 4y - 3 and g(x,y) = 10 sin(xy) on the same axes.

a= Plot3D [ {3x+4y-3,RGBColor[1.000,0.000,0.000]}, {x,-3,3},
{y,-3,3} ,
DisplayFunction->Identity ];

b=Plot3D[ {10 Sin[x*y],RGBColor[0.000,0.502,0.251]}, {x,-3,3},
{y, -3,3},
DisplayFunction->Identity ];

Show[a, b,DisplayFunction->$DisplayFunction];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_477.gif]

Show[GraphicsArray[{a, b}]] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_479.gif]

5.1.2   ParametricPlot3D


ParametricPlot3D
is a direct analog of ParametricPlot.  Depending on the input, ParametricPlot3D  produces a space curve or a surface. ParametricPlot3D[{ f, g, h}, {t, a, b }] produces a three dimensional space curve parametrized by  a variable t which runs from a to b. ParametricPlot3D[{ f, g, h}, {t, a, b },{u, c, d}] produces a two-dimensional surface parametrized by t and u. Options are given to ParametricPlot3D the same way as for  Plot3D. Most of the options are the same.

Example 8: Plot the curve that is parametrized by x = sin t, y = cos t, and z = t/3.

ParametricPlot3D[ {Sin[t],Cos[t],t/3, Thickness[.02]},
   {t,0,6Pi} ];

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_480.gif]

Example 9: Plot the surface that is parametrized by  x = u cos u (4 + cos(u + v)), y = u sin u (4 + cos(u + v)), and z = u sin(u + v).

ParametricPlot3D[{u Cos[u] (4 + Cos[u + v]), u Sin[u] ( 4 + Cos[u + v]), u Sin[u + v]}, {u, 0, 4Pi}, {v, 0, 2Pi}   ] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_482.gif]

Exercise 5.1.  Plot each of the following.
a) z = x^2 , -3 ≤ x ≤ 3, -3 ≤ y ≤ 3.    
b) f(x,y) = (x^2 - y^2)/(x^2 + y^2),  -1 ≤ x ≤ 1, -1 ≤ y ≤ 1.
c) f(x,y) = ^sin(x - 2 cos y) , -2 ≤ x ≤ 2, -2 ≤ y ≤ 2.  
d)  z(x,y)= sin(x + sin(y))  for -4 ≤ x ≤ 4 and -4 ≤ y ≤ 4.

Exercise 5.2. Graph the portion of the helicoid (spiral ramp) that is defined by:
x = u cos v,  y = u sin v, z = v for 0 ≤ u ≤ 2  and  0 ≤ v ≤ π.

Exercise 5.3. Use parametric plot to graph the surface f(x,y) = 1/12 (144 - 16 x^2 - 9 y^2)^(1/2).
[Hint: z = (1 - (x/3)^2 - (y/4)^2)^(1/2) and so let x = 3 r cos θ, y = 4 r sin θ. Then, z = (1 - r^2)^(1/2). ]

5.2   Partial Derivatives and Gradient

5.2.1   Partial Derivatives

The command for the partial derivative of f with respect to x is D[f, x], and D[f,{x,n}] gives the nth partial derivative of f with respect to x. The multiple(mixed) partial derivative of f with respect to x_1,x_2,x_3,.... is obtained by D[f,x_1,x_2,x_3, ...]. In Mathematica 3.0 we can access this command from  File- Palettes- BasicInputs  or File- Palettes- BasicCalculations- Calculus- Common Operations. The symbols are ∂_□  and ∂_ (□, □) .

Example 10:   Find the first partial derivatives of x^3+y^2 with respect to x^ and y^ .

Solution:  We give two methods.  
Method 1: We can type all the inputs and the command as follows:

Clear[x, y]

D[x^3 + y^2, x]

3 x^2

D[x^3 + y^2, y]

2 y

Method 2:  We can use the BasicInput palette to enter the inputs.

∂_x (x^3 + y^2)

3 x^2

∂_y (x^3 + y^2)

2 y

Example 11:   Find the four second partial derivatives of x^3sin y+ e^xy.  

Solution:  
Method 1:

D[x^3 * Sin[y] + E^(x * y), {x, 2}]

E^(x y) y^2 + 6 x Sin[y]

D[x^3 * Sin[y] + E^(x * y), x, y]

E^(x y) + E^(x y) x y + 3 x^2 Cos[y]

D[x^3 * Sin[y] + E^(x * y), y, x]

E^(x y) + E^(x y) x y + 3 x^2 Cos[y]

D[x^3 * Sin[y] + E^(x * y), {y, 2}]

E^(x y) x^2 - x^3 Sin[y]

Method 2:

∂_ (x, x) (x^3 * Sin[y] + ^(x * y))    

E^(x y) y^2 + 6 x Sin[y]

∂_ (x, y) (x^3 * Sin[y] + ^(x * y))

E^(x y) + E^(x y) x y + 3 x^2 Cos[y]

∂_ (y, x) (x^3 * Sin[y] + ^(x * y))

E^(x y) + E^(x y) x y + 3 x^2 Cos[y]

∂_ (y, y) (x^3 * Sin[y] + ^(x * y))

E^(x y) x^2 - x^3 Sin[y]

Example 12:   Evaluate the first partial derivatives of xy+yz^2+xz at (-1,2,3).

Solution:    Recall that Expr /.{var_1->val_ (1,)var_2->val_ (2,)var_3->val_3, ...   } is the command  for substituting var_1 by val_1, var_2 by val_2, var_3 by val_3, .... in Expr.

Clear[x,y,z]
D[x*y + y*z^2 + x*z,x]/.{x->-1, y->2, z->3}

5

D[x * y + y * z^2 + x * z, y]/.{x-> -1, y->2, z->3}

8

D[x * y + y * z^2 + x * z, z]/.{x-> -1, y->2, z->3}

11

Example 13:    Let f(x,y,z) =y ^x+x ln z ^(-y). Find   f_xxx, f_xyz, f_xzz, f_zxz , and f_zzx

Solution:    First we define f(x,y,z) in Mathematica. Then we use the ∂_ (□, □) notation. Since the palette gives only two boxes for the variables, we need to add one more box. This can be done by using CTRL + .

Clear[x, y, z, f]

f[x_, y_, z_] := y * ^x + x * Log[z] * ^(-y)

 ∂_ (x, x, x) f[x, y, z]

E^x y

 ∂_ (x, y, z) f[x, y, z]

-E^(-y)/z

 ∂_ (x, z, z) f[x, y, z]

-E^(-y)/z^2

 ∂_ (z, x, z) f[x, y, z]

-E^(-y)/z^2

 ∂_ (z, z, x) f[x, y, z]

-E^(-y)/z^2

Example 14:    Let x=t^2+s ,   y=t+s^2   and z=x sin y.  Find the first partial derivatives of z with respect to s and t.

Solution:  

x = t^2 + s   <br />  y = t + s^2    <br /> z = x * Sin[y] (* This gives Z as a function of t and s explicitly *)

s + t^2

s^2 + t

(s + t^2) Sin[s^2 + t]

D[z, s]

2 s (s + t^2) Cos[s^2 + t] + Sin[s^2 + t]

D[z, t]

(s + t^2) Cos[s^2 + t] + 2 t Sin[s^2 + t]

5.2.2   Directional Derivative and Gradient


The notation for a vector  such as u =2i + 5j - 6k in Mathematica is {2,5,-6}. The command for the dot product of  two vectors u and v is obtained by typing u.v

Example 15:    Find the gradient and directional derivative of  f( x , y ) = x^2sin2y at the point  (1,π/2,0)   in the direction of v=(3/5,-4/5)

Solution:   The gradient of f, ∇f, at (a,b) can be obtained by evaluating ∇ f=(∂_xf,∂_yf)(a,b). We will discuss other commands for obtaining the gradient in the near future. The directional derivative of f at (a,b) in the direction of a unit vector v is given by  v. ∇f(a,b).

Method 1:

Clear[x, y]

f=x^2*Sin[2y]
v={3/5, -4/5}

x^2 Sin[2 y]

{3/5, -4/5}

 ∇f = { D[f, x], D[f, y] }/.{x->1, y->Pi/2}

{0, -2}

direcderiv = ∇f . v  

8/5

Method 2:

Clear[f]

f[x_, y_] := x^2 * Sin[2y]

    v = {3/5, -4/5}

{3/5, -4/5}

∇f = {∂_x f[x, y], ∂_y f[x, y]}/.{x->1, y->π/2}

{0, -2}

direcderiv = v . ∇f

8/5

Example 16:   Find the gradient and directional derivative of  f(x,y,z) = xy+ yz + x z at the point  (1, 1, 1)  in the direction of v = 2i + j - k    

Solution:

Clear[x, y, z]

w= x*y + y*z + x*z
v={2,1,-1}

x y + x z + y z

{2, 1, -1}

unitvector = v/Sqrt [v . v]

{2/3^(1/2), 1/6^(1/2), -1/6^(1/2)}

 ∇w = {D[w, x], D[w, y], D[w, z]}/.{x->1, y->1, z->1}

{2, 2, 2}

direcderiv = unitvector . ∇w

2 2/3^(1/2)

Example 17:    Let the temperature T at a point (x,y) on a metal plate be given by T= x/(x^2 + y^2).
a) Plot the level curves.
b) Plot the graph of the temperature.
c) Find the rate of change of temperature at (3,4), in the direction of u=i-2j
d) Find the unit vector in the direction of which the temperature increases most rapidly at (3,4).
e) Find the maximum rate of increase in the temperature at (3,4).

Solution: The command to plot level curves is ContourPlot[ f,{x,a,b},{y,c,d}] and the command to plot the graph of functions of two variables is Plot3D[ f,{x,a,b},{y,c,d}]. Rate of change in a given direction is nothing but directional derivative. The gradient vector is the direction of most rapid increase and its norm is the maximum rate if change.  

Clear[x, y, T]

T[x_, y_] := x/(x^2 + y^2)

a) We give two methods of drawing level curves; one uses the ContourPlot command and the other uses the Plot command.     

levelcurves1 = ContourPlot[T[x, y], {x, -5, 5}, {y, -5, 5}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_611.gif]

Note:  1. Use the command ContourPlot[T[x,y],{x,-5,5},{y,-5,5}, ContourShading->False]; to get unshaded contours.
2.  Solving T(x,y)=c for y we get (for  c=-5,-4,-3,-2,-1,1,2,3,4,5) the following level curves. (We leave it as an exercise to plot level curves for smaller values of |c|.)

                            2 Plot :: plnr : Sqrt[-5 x - x ] is not a machine-size real number at x = 0.0595808 .

                            2 Plot :: plnr : Sqrt[-5 x - x ] is not a machine-size real number at x = 0.00648835 .

                            2 Plot :: plnr : Sqrt[-5 x - x ] is not a machine-size real number at x = 0.000689151 .

General :: stop : Further output of Plot :: plnr will be suppressed during this calculation.

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_617.gif]

It is a good exercise to draw these level curves using PolarPlot. Note that the polar form of the equations T(x,y) = c is r=cosθ/c or simply r = c cosθ (since c is arbitrary).

Here is the graph of  T.

graphofT = Plot3D[T[x, y], {x, -5, 5}, {y, -5, 5}, <br />BoxRatios-> {1, 1, 1}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_620.gif]

∇T = {D[T[x, y], x], D[T[x, y], y]}

v = {1, -2}

u = v/(v . v)^(1/2)

u . ∇T/.{x->3, y->4}//N

{-(2 x^2)/(x^2 + y^2)^2 + 1/(x^2 + y^2), -(2 x y)/(x^2 + y^2)^2}

{1, -2}

{1/5^(1/2), -2/5^(1/2)}

0.0393548

d) The unit vector in the direction of which the temperature increases most rapidly at (3,4) is given by

∇T/(∇T . ∇T)^(1/2)/.{x->3, y->4}

{7/25, -24/25}

e) The maximum rate of increase in the temperature at (3,4) is the norm of the gradient at this point. This can be obtained by:

 (∇T . ∇T)^(1/2)/.{x->3, y->4}

1/25

Example 18:   Let f(x,y)=2x^2-3xy-x+y+y^2and let R be the rectangle in the xy plane whose vertices are at (0,0), (2,0), (2,2), and  (0,2).

a) Find all relative extremum values of f inside R.
b) Find the maximum and minimum values of f on  R.

Clear[f, x, y, d]

f[x_, y_] := 2x^2 - 3x * y - x + y + y^2

Solve[{∂_x f[x, y] == 0, ∂_y f[x, y] == 0}, {x, y}]

{{x→1, y→1}}

d[x_, y_] := ∂_ (x, x) f[x, y] * ∂_ (y, y) f[x, y] - (∂_ (x, y) f[x, y])^2

∂_ (x, x) f[x, y]/.{x->1, y->1}

d[x, y]/.{x->1, y->1}

4

-1

Thus (1,1) is the local minimum point of f inside R and its local minimum value is f(1,1) = 0. Next we find the extreme values of f on the boundary of the rectangle. This is done by considering f as a function of one variable on the sides of R. Let f1=f[x,0], f2=f[x,2] for x between 0 and 2, and f3=f[0,y] and f4=f[2,y] for y between 0 and 2.   We now proceed as follows:

f1 = f[x, 0]

f2 = f[x, 2]

f3 = f[0, y]

f4 = f[2, y]

-x + 2 x^2

6 - 7 x + 2 x^2

y + y^2

6 - 5 y + y^2

Solve[D[f1, x] == 0 ]

{{x→1/4}}

Solve[D[f2, x] == 0 ]

{{x→7/4}}

Solve[D[f3, y] == 0 ]

{{y→ -1/2}}

Solve[D[f4, y] == 0 ]

{{y→5/2}}

Thus, we have the following points on the boundary of R as critical points of f: (1/4,  0), (7/4, 2), (2,5/2).  Observe that the point (0, -1/2) is outside the rectangle R. The four vertices of R: (0,0), (2,0), (0,2) and (2,2) are also critical points (Why?). We now evaluate f at each of these points and at (1,1) (the relative minimum point found above) and compare the results. We do this  using the substitution command.

{-1/8, -1/8, -1/4, 0, 6, 6, 0, 0}

Thus, the minimum value of f is -1/4 and the maximum value of f is 6. At what points are these attained?
Here is the graph of f.

Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, <br />BoxRatios-> {1, 1, .62}] ;

[Graphics:HTMLFiles/Mathematica Student Tutorial Calculus III_668.gif]


Exercise 5.4. Let f(x, y) = (x - y)^2/(x^2 + y^2).        Find  a) f_y (1,0)    b)  f_xxy

Exercise 5.5. The temperature at a point (x,y) on a metal plate is modeled by;
            T(x,y) = 400 Exp ( -(x^2 + y) /2 );  x ≥ 0,  y ≥  0.
a) Find ▽ T (x, y).
b) Find the directional derivative of  T(x,y) at the point  (3, 5) in the dierection of u = 1/2 i  + 3^(1/2)/2 j.
c) Find the direction of greatest increase in heat from the point (3,5).

Exercise 5.6. Let   f(x,y) = (4 x y)/(( x^2 + 1)    ( y^2 + 1))  for -2 ≤  x  ≤ 2, and  0 ≤ y ≤3.

a) Find a set of parametric equations of the normal line and an equation of the tangent plane to the surface at the point (1, 2, 8/10).
b) Graph the surface, the normal line and the tangent plane found in a).


5.3   Multiple Integrals

The command for multiple integrals is more or less the same as  the command for single integrals. If f is a function of two variables x and y, then Integrate[f,x] integrates f with respect to x while Integrate[f,y] integrates f with respect to y.  Integrate[f, x, y ] integrates f with respect to x and y. It is worthwhile to keep in mind  that Mathematica does not give a constant of integration.   Integrate[f,{x,a,b},{y,c,d}] evaluates ∫_a^b(∫_c^dfdy)dx=∫_a^b∫_c^dfdydx. Here c and d can be functions of x. In Mathematica 3.0, the command for multiple integrals can be entered from the BasicInputs palette as follows: From the palette click on ∫d□ or ∫_□^□d. Use the TAB key to move to the first box inside the integral sign and then click on the integral sign of your choice from the palette.  

Clear[f, x, y]

f[x_, y_] := 6x * y^2

Method 1:

∫f[x, y] x

3 x^2 y^2

∫f[x, y] y

2 x y^3

∫∫f[x, y] xy

x^2 y^3

Method 2:

Integrate[f[x, y], x]

3 x^2 y^2

Integrate[f[x, y], y]

2 x y^3

Integrate[f[x, y], x, y]

x^2 y^3

Solution: We will use the letter of the question to denote the integral:

a = ∫_0^1∫_0^1^(x + y) xy

1 - E + (-1 + E) E

Simplify[%]

(-1 + E)^2

N[%]

2.95249

b = ∫_1^4∫_x^( x^2) x * yyx       

2475/8

c = Integrate[1 + x^2 + y^2, {y, 0, 1}, {x, 0, y}] <br />

5/6

d = ∫_0^1∫_0^(4 - x^2) ^(x * y) yx

∫_0^1 (-1/x + E^(4 x - x^3)/x) x

This example shows that there are double integrals that Mathematica can not evaluate exactly. For such cases we can get a numerical approximation by using NIntegrate or N[%]. (We will use N[%] below.)

N[%]

11.415

We leave it as an exercise to the reader to skecth the regions of integration for the integrals of Example 2.

Example 21:   Evaluate each of the following triple integrals:
a)∫_1^4∫_0^1∫_0^x2z ^(-x^2)dydxdz     b)∫_0^2∫_ (-(4 - x^2)^(1/2))^(4 - x^2)^(1/2)∫_0^x^2xdzdydx

∫_1^4∫_0^1∫_0^x2z * ^(-x^2) yxz

(15 (-1 + E))/(2 E)

∫_0^2∫_ (-(4 - x^2)^(1/2))^(4 - x^2)^(1/2) ∫_0^x^2xzyx

128/15

Exercise 5.7. a) Evaluate the iterated integral     ∫_0^2∫_x^2^(-y^2)dy  dx     
b) Switch the order of integration and evaluate  the integral in a).

Exercise 5.8. Approximate the integral   ∫_0^2∫_x^2  (16 - x^3 - y^3)^(1/2)dy  dx     

Exercise 5.9.
Find the volume of the solid that lies below the surface z = 1 - xy and above the plane region R bounded by y = x,  y = 1,  and x =0.

Exercise 5.10.
Evaluate the iterated integral ∫_0^(π/4) ∫_0\(4 \) r^2 sinθ  cosθ dr  dθ .

Exercise 5.11.
a)  Evaluate the sum of the integrals

∫_0^(5 ( 2)^(1/2) /2 ) ∫_0\(x \) x y  dy  dx  +  ∫_ (5 ( 2)^(1/2) /2)^5 ∫_0                      2 \( Sqrt[25 - x ] \)x y  dy  dx

b) Use polar coordinates to combine the sum of the integrals in a) into a single integral and evaluate it.

Exercise 5.12.
Find the surface area of  z = 2x + y^2 over the triangle with vertices (0,0),  (2,0),  and (2,2).

Exercise 5.13. Evaluate the triple integral:

∫_0^2^(1/2)∫_0^(2 - x^2)^(1/2)∫_ (2 x^2 + y^2    )^(4 - y^2)ydzdydx


Created by Mathematica  (May 24, 2007) Valid XHTML 1.1!