Lab 2: Student Assignment

Week 2, January 18-24

MAT 229, Spring 2021

Special Constants

({{Standard notation, Mathematica notation}, {π≈3.14159, Pi}, {e≈2.71828, E}})

Commands

({{Functionality, Mathematica notation}, {plot the graph of a function, Plot[...]}, {square root of something, (Sqrt[…]), Sqrt[...]}, {absolute value of something, |…|, Abs[...]}, {sine of something (radian mode),sin(…), Sin[...]}, {cosine of something (radian mode),cos(…), Cos[...]}, {tangent of something (radian mode),tan(…), Tan[...]}, {natural logarithm of something, ln(…), Log[...]}})

Exercises to submit

Exercise 1

The linear approximation for a function f(x) at x=a is the m x+b that comes from the tangent line y=m x+b to f(x) at x=a. It provides a simple approximation to f(x) for values of x near a.
	f(x)≈m x+b
Let f(x)=(2^x)-2x+3.

Define this function in Mathematica.

f[x_]:=2^x-2x+3

Now let’s use this function to create the tangent line at a given value x=x0. (Notice that the semi-colon suppresses reporting of the value of x0):

x0=0;
f'[x0]
f[x0]
f'[x0](x-x0)+f[x0]

Determine the linear approximation for f(x) at x=0.
	m x+b= 4+x (-2+Log[2])

What is the absolute value (decimal) of the difference between f(1) and your linear approximation at x=1?

Let' s use our powers as mathematicians to name something :

tangent[x_]:=4+x (-2+Log[2])
Abs[f[1]-tangent[1]]
N[%]

and let’s check that things make sense:

Plot[{f[x],tangent[x]},{x,-1.2,1.2}]

What is the absolute value (decimal) of the difference between f(-1) and your linear approximation at x=-1?

Abs[f[-1]-tangent[-1]]
N[%]

Exercise 2

Let f(x)=((e^(-(x^2)-x-1))/((x^2)+1)).

Define this function in Mathematica.

Note that for this one I defined the function as “f2” -- if you want to avoid collisions, you can give each function in a notebook a unique name. Remember your power as a mathematician -- to name things!

f2[x_]:=E^(-x^2-x-1)/(x^2+1)

Use your function to determine the y-intercept of y=f(x). Get a decimal value.

N[f2[0]]

Get all real-valued critical numbers for f(x) as decimal values.

NSolve[f2'[x]==0,x,Reals]

Evaluate f(x) at your critical numbers to determine the y-values of the critical points.

f2[-0.25805587247847267`]

Evaluate f''(x) at your critical numbers to determine if each is a local maximum or a local minimum.

f2''[-0.25805587247847267`]

Local minimum points: none

Local maximum points: (-0.25805587247847267, -1.52082)

Get all real-valued second-order critical numbers for f(x) as decimal values, i.e. solve f''(x)=0. These are points about which concavity can change, the inflection points.

NSolve[f2''[x]==0,x,Reals]

Inflection points:

Make a plot of the graph of f(x) to verify your calculations for the y-intercept, the local max/min, and the inflection points.

I think that I’ll have a little fun here:

Show[
Plot[f2[x],{x,-2,1.5}],
ListPlot[
{
{-0.775714860650307`,f2[-0.775714860650307`]},
{0.23670380674925937`,f2[0.23670380674925937`]},
{-0.25805587247847267`,f2[-0.25805587247847267`]}
},PlotMarkers->{}]
]

Exercise 3

Let g(x)=(e^(2x)) and h(x)=3(e^x)-2.

Plot the graphs of g(x) and of h(x)  together on the same axes for various ranges of x-values until you have one that clearly shows the region bounded by these two graphs.

g[x_]:=E^(2x)
h[x_]:=3E^x-2
Plot[{g[x],h[x]},{x,0,1}]

Get decimal numbers for the x-values of the intersection points.
	Intersection points: x≈0, 0.693147

NSolve[g[x]==h[x],x,Reals]

Find the area of the region bounded by y=g(x) and y=h(x).
	Area: 0.113706

We can see that h is on top, because ultimately g has to grow faster!

NIntegrate[h[x]-g[x],{x,0,0.6931471805599453`}]

Exercise 4

Let g(x)=(x^3)-6x and h(x)=(x^2)-3x-2.

g[x_]:=x^3-6x
h[x_]:=x^2-3x-2

Plot the graphs of g(x) and of h(x)  together on the same axes for various ranges of x-values until you have one that clearly shows the regions bounded by these two graphs.

Plot[{g[x],h[x]},{x,-2,2.5}]

Get exact numbers for the x-values of the intersection points.
	Intersection points: x = 2,(1/2) (-1-(Sqrt[5])),(1/2) (-1+(Sqrt[5]))

Solve[g[x]==h[x],x]

Find the combined area of the regions bounded by y=g(x) and y=h(x).
	Area: 5.94605

Integrate[Abs[g[x]-h[x]],{x,(1/2) (-1-(Sqrt[5])),2}]
N[%]

Exercise 5

Let p(x)=(x^3) and q(x)=-(x^2)+3.

p[x_]:=x^3
q[x_]:=-x^2+3

Plot the graphs of g(x) and of h(x)  together on the same axes for various ranges of x-values in the first quadrant until you have one that clearly shows the regions  bounded by these two graphs for x≥0.

Plot[{p[x],q[x]},{x,0,1.5}]

Get the x-values of that intersection point.
	Intersection point: x≈1.17456

NSolve[p[x]==q[x],x,Reals]

Find the volume for the solid obtained by rotating about the x-axis the region bounded by y=p(x) and y=q(x) for x≥0.
	Volume: 23.049

Integrate[Pi(q[x]^2-p[x]^2),{x,0,1.1745594102929802`}]