Calculus I:  Mathematica Practice 3

Syntax Checks

Clear[f,g,h]

The following Mathematica commands have syntax errors. Fix the errors so the commands will work.

Problem 1: Differentiation

we want (d/(d x))sin(x):

f[x]=sin x
f'

Problem 2: Differentiation

we want (d/(d x))(((1+x)/(x^2))):

D[1+x/x^2]

Problem 3: Differentiation

we want (d/(d x)) exp(x):

D[e^x,x]

Problem 4: Differentiation

we want (d/(d x)) ln(x):

D[ln(x),x]

Problem 5: Composition of Functions

we want f(g(x)):

f[x_]=Sin[x]
g[x_]=ArcSin[x]
fg[x]

Problem 6: The Product Rule of Derivatives

where f and g are both functions of x:

Clear[f,g]
D[f[x]*g[x]]

Problem 7: The Quotient Rule of Derivatives

where f and g are both functions of x:

Clear[f,g]
D[f/g,x]

Problem 8: The Chain Rule of Derivatives

where f is a function of g, and g is a function of x:

Clear[f,g]
D[f[g],x]

Problem 9: The Chain Rule of Derivatives applied to a Power Form

we want (d/(d x)) (sin^3)(x):

D[Sin^3[x],x]

Example Based on 3.1 Derivatives of Polynomials and Exponential Functions

At what point on the curve y=1+2 (e^x)-3x is the tangent line parallel to the line 3x-y=5? Illustrate by graphing both the curve and the line.

Barry's Solution

Let's define the function we are working with:

f[x_]=1+2Exp[x]-3x

The slope of the curve (and consequently, the tangent line to the curve) is given by the derivative, which we can easily calculate using the power rule and exponential rule  (although you could also use Mathematica to calculate it):

m[x_]=2Exp[x]-3

Now, the straight line is given by 3x-y=5. We can just write this in y=m x + b=3x-5 form and read off the slope. We see the slope should be 3. So if we want the tangent line of the first curve to be parallel to this line, the slope of the tangent line must be 3. This leads to the equation for x:

equation1=m[x]==3

Which we can solve using Mathematica:

Solve[equation1,x]

So the x coordinate where we want the tangent line is ln(3). The slope is

m[Log[3]]

as expected, and the y-coordinate is

f[Log[3]]

The equation of the tangent line is y-(Subscript[y, 0])=m(x-(Subscript[x, 0])) which means y=m(x-(Subscript[x, 0]))+(Subscript[y, 0]):

tangent[x_]=m[Log[3]] (x-Log[3])+f[Log[3]]

Now, we can plot the situation, and verify visually our result.

Plot[{f[x],tangent[x],3x-5},{x,0,2},PlotStyle->{Black,Red,Red}]

Note that ln(3) is very close to 1:

Log[3.0]

Example Based on 3.3 Derivatives of Trigonometric Functions

If f(x)=(Sqrt[x])sin x, find f'(x). Check to see that your derivative is correct by graphing both f and f' for 0≤x≤2π.

Barry's Solution

Let's define the function we are working with, and calcualte it's derivative using Mathematica:

f[x_]=Sqrt[x]Sin[x]
f'[x]

Plot[{f[x],f'[x]},{x,0,2Pi},PlotStyle->{Red,Blue}]

Where the blue graph (derivative) crosses the axis the red graph (function) has horizontal tangents. Also, where the blue graph (derivative) has an extrema, the red graph (function) is changing most rapidly (ie, largest absolute value of slope). So our derivative makes sense.

Example Based on 3.4 Chain Rule

Using Mathematica, differentiate the function f(x)=(Sqrt[(( (x^4)-x+1)/((x^4)+x+1))])and simplify the result. Where does the graph of f(x) have horizontal tangents? Graph f and f'on the same screen. Are your graphs consistent with your earlier answer about horizontal tangents?

Barry's Solution

Let's define the function we are working with, and take it's derivative and then simplify:

f[x_]=Sqrt[(x^4-x+1)/(x^4+x+1)]
f'[x]
Simplify[%]

The graph will have horizontal tangents where the derivative is zero. So we need to solve the equation:

Solve[f'[x]==0,x]

Some of these solutions look imaginary. Let's check:

N[%]

So it looks like we have two real values solutions.

Let's plot the function and the derivative:

Plot[{f[x],f'[x]},{x,-3,3},PlotStyle->{Red,Blue}]

Where the blue graph (derivative) crosses the axis the red graph (function) has horizontal tangents. These occur at two  places, as we predicted earlier.