Calculus I:  Mathematica Practice 4

Syntax Checks

Clear[f,g,h]

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

Problem 1: Implicit Differentiation

D[Cos[x y]==y[x],x]
Solve[%,y']

Problem 2: Solving System of Equations

Solve[3x+2y= 1,4x-7y= 3,{x,y}]

Problem 3: Plotting a Logarithmic Function

Plot[Ln[x],{0,10}]

Problem 4: Simplifying using Logarithm Laws

Simplify(e^Log[x])

Example

Find the values of a and b such that the curve f(x) = a (x^(2 ))+ b x  has a slope of 4 at the point (1,2).

Barry's Solution

Let's define the function we are working with:

f[x_]=a*x^2+b*x

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

slopef[x_]=2*a*x+b

We need two equations to solve for the two unknowns a and b. One equation comes from the slope being equal to 4 when x=1:

equation1=slopef[1]==4

The second equation comes from requring the curve to pass through the point (1,2):

equation2=f[1]==2

Now, we solve the system of equations (we could do this by hand, but I am going to use Mathematica here):

Solve[{equation1,equation2},{a,b}]

Let's do a plot to check this result.

a=2
b=0

This plot shows the function passes through (1,2):

Plot[{f[x]},{x,0,2},GridLines->Automatic]

This plot shows the function has slope 4 at (1,2):

Plot[{f[x]},{x,0.9,1.1},GridLines->Automatic]

From the graph above, we have approximately that the rise over run is

((2.4-1.6)/(1.1-0.9))

Example Based on 3.6 Derivatives of Logarithmic Functions

Find the equation of the tangent lines to the curve y=(ln x)/x at the points where x=1, and x=e. Sketch the situation.

Barry's Solution

Let's define the function we are working with:

f[x_]=Log[x]/x

The slope of the curve is given by the derivative, which we can easily calculate using the product rule. I am going to use Mathematica to calculate the derivative here:

m[x_]=f'[x]

The equation of the tangent line is given by y-(Subscript[y, 0])=m(x-(Subscript[x, 0])) where m is the slope at x=(Subscript[x, 0]).

tangent1[x_]=m[1](x-1)+f[1]

tangent2[x_]=m[E](x-E)+f[E]

This plot shows the situation. The tangent lines are in red.

Plot[{f[x],tangent1[x],tangent2[x]},{x,0,6},PlotStyle->{Black,Red,Red},PlotRange->{{0,6},{-1,1}}]

Problem

Find the equation of the tangent lines to the curve (x^3)/4+(y^2)/7=8 at the points where x=2. Sketch the situation.

Barry's Solution

Let's define the implicit function we are working with:

implicitfcn=x^3/4+y^2/7==8

Let's plot it right away to get a feel for what is happening (load the ImplicitPlot package above):

plot1=ContourPlot[implicitfcn,{x,-20,20},{y,-20,20}]

We will need the (x,y) coordinates when x=2, which we get by solving the following equation for y

Solve[(2)^3/4+y^2/7==8,y]

N[%]

The following sketch shows that our numbers appear to be accurate:

plot1=ContourPlot[implicitfcn,{x,1,3},{y,-8,8},GridLines->{{2},{+(Sqrt[42]),-(Sqrt[42])}},AspectRatio->1]

We need to get dy/dx = m using implicit differentiation. You can do the implicit differentiation by hand, or use Mathematica. I'm going to use Mathematica:

D[x^3/4+y[x]^2/7==8,x]
Solve[%,y'[x]]

Now, we evaluate the slope at the two points, (2,+(Sqrt[42])) and (2,-(Sqrt[42])):

m1=-((21 (((2))^2))/(8 (+(Sqrt[42]))))

m2=-((21 (((2))^2))/(8 (-(Sqrt[42]))))

The equation of the tangent line is given by y-(Subscript[y, 0])=m(x-(Subscript[x, 0])) where m is the slope at x=(Subscript[x, 0]).

tangent1[x_]=m1(x-2)+(+(Sqrt[42]))

tangent2[x_]=m2(x-2)+(-(Sqrt[42]))

plottangents=Plot[{tangent1[x],tangent2[x]},{x,0,3},PlotStyle->{Red}]

Show[plot1,plottangents]

Looks good.