Honors Calculus I and II:
Graphics for the Solutions for Exam 1.
> with(plots): with(plottools): with(linalg):
Question 2.
We first look at the graphs and then solve for the intersection point:
> f:= tan(x);
> g:= 2*sin(2*x);
> plot({f,g}, x = -1.5..1.5, y = -4..4, thickness = 3, numpoints = 2000, scaling = unconstrained);
These graphs then repeat with period Pi, since both the functions tan(x) and 2sin(2x) have period Pi.
We see that there is one intersection point in the interval (0, Pi/2).
> solve(f - g, x);
Actually, the general solution is x = kPi/3, with k any integer, since given any solution, a new solution is obtained by adding any integer multiple of Pi.
> simplify(subs(x = Pi/3, [f,g]));
In the interval [0, Pi/2], the required solution is x = Pi/3 and the curves meet at the point (Pi/3, 3^(1/2)).
Next we find the equations of the tangent lines at x = Pi/3, using the point slope form of the tangent line equations:
> f1:= diff(f, x);
> g1:= diff(g, x);
> m1:= simplify(subs(x = Pi/3, f1));
> m2:= simplify(subs(x = Pi/3, g1));
> Linf:= sqrt(3) + m1*(x -Pi/3);
> Ling:= sqrt(3) + m2*(x -Pi/3);
> Tanf:= simplify(y - Linf);
> Tang:= simplify(y - Ling);
The functions Linf and Ling are the linear approximations to the curve based at the intersection point.
The vanishing of the functions Tanf and Tang give the equations of the tangent lines.
Next we find the angle between the tangents in radians, µ1, and degrees, µ2:
> m:= (m2 - m1)/(1 + m1*m2);
> mu1:= evalf(arctan(m));
> mu2:= evalf(180/Pi*arctan(m));
Finally we plot the curves and the tangent lines on one plot:
> P1:= plot(f, x = 0..5/4, color = green, thickness =3, numpoints = 600):
> P2:= plot(g, x = 0..5/4, color = blue, thickness =3, numpoints = 600):
> P3:= plot(Linf, x = 4/5..5/4, color = red, thickness =3, numpoints = 600):
> P4:= plot(Ling, x = 4/5..5/4, color = magenta, thickness =3, numpoints = 600):
> display(P1, P2, P3, P4);
> display(P1, P2, P3, P4, scaling = constrained);
Question 4.
We first solve for the inverse function:
> h:= (3*x - 2)/(x - 1);
> k:= solve(y - h, x);
> hinv:= subs(y =x, k);
We check that their compositions are defined and are as expected:
> simplify(h - 3);
This never vanishes, since a reciprocal is never zero, so this shows that the range of h avoids the number 3.
> simplify(hinv - 1);
This never vanishes, so this shows that the range of hinv avoids the number 1.
So h is defined for x not 1 and has range avoiding 3.
Also hinv is defined for x not 3 and has range avoiding 1.
The compositions are now properly defined, so we can compute them:
> hhinv:= subs(x = hinv, h);
> simplify(hhinv);
> hinvh:= subs(x = h, hinv);
> simplify(hinvh);
We solve the inequality 3.99 < h(x) < 4.01, by applying hinv to it.
We first observe that hinv is decreasing in the interval [3.99, 4.01].
Actually we see that both h and hinv are decreasing everywhere on its domain.
> factor(diff(h,x));
> factor(diff(hinv, x));
> subs(x = 399/100, hinv);
> subs(x = 401/100, hinv);
So the solution to the inequality is: x must lie in the open interval (199/99, 201/100).
Finally we plot the functions h and hinv on the same graph.
> P5:= plot(h, x = -5..0.9, color = green, thickness =3, numpoints = 600):
> P6:= plot(h, x = 1.1..5, color = green, thickness =3, numpoints = 600):
> P7:= plot(hinv, x = -5..2.9, color = blue, thickness =3, numpoints = 600):
> P8:= plot(hinv, x = 3.1..5, color = blue, thickness =3, numpoints = 600):
> display(P5,P6,P7,P8);
We also focus in on the domain [199/99, 201/101] for the function h(x):
> P9:= plot(h, x = 199/99..201/101, color = green, thickness =3, numpoints = 1000, scaling = constrained):
> display(P9);
As expected, the outputs lie in the interval [3.99, 4.01].
Question 5.
We enter the function describing the radioactive decay:
> dec:= 10*2^(-t/4);
Now we find the time that 4 grams remains and the time that 1 mg remains:
> t1:= fsolve(dec -4, t);
> t2:= fsolve(dec -0.001, t);
Note that solve doesn't work here to give an analytic solution.
We use fsolve, which gives us a decimal approximation to the exact solution.
We can get around this by taking logarithms:
> lndec:= simplify(ln(dec));
> t11:= simplify(solve(lndec - ln(4)));
> evalf(t11);
> t22:= simplify(solve(lndec - ln(10^(-3))));
> evalf(t22);
Finally, we convert to minutes and seconds:
> t1mins:= floor(evalf(60*(t11 - 5)));
> t1secs:= evalf(3600*(t11 - 5 - 17/60) );
> t2mins:= floor(evalf(60*(t22 - 53)));
> t2secs:= evalf(3600*(t22 - 53 - 9/60) );
Question 6.
We first enter the equation of the ellipse:
> m:= x^2 + 2*x*y + 4*y^2 - 108;
We now differentiate, taking y to be a function of x, with derivative y1:
> dm1:= diff(m, x) + diff(m, y)*y1;
> yprime:= solve(dm1, y1);
Now we find the horizontal tangents:
> yh:= solve(numer(yprime), y);
> h1:=subs(y = yh, m);
> solve(h1, x);
So the points with horizontal tangents are A1 = (6, -6) and C1 = (-6, 6).
Next we find the vertical tangents:
> yv:= solve(denom(yprime), y);
> v1:=subs(y = yv, m);
> solve(v1, x);
So the points with vertical tangents are B1 = (12, -3) and D1 = (-12, 3).
We find the area of the inner parallelogram:
> A1:= [6,-6];
> B1:= [12, -3];
> C1:= [-6,6];
> D1:= [-12, 3];
> M1:= B1 - A1;
> M2:= D1 - A1;
> MM:= matrix([M1, M2]);
> parallelogramarea:= det(MM);
Alternatively, we use the formula for the area of a parallelogram: bh, where b is the base and h is its height.
We first find the equation of the perpendicular through the point C1 to the base D1A1:
> DAslope:= (3 - (-6))/(-12 - 6);
> perpslope:= -1/DAslope;
> perpline:= y - C1[2] - perpslope*(x - C1[1]);
Now we give the equation of the line joining D1 and A1:
> DAline:= y - A1[2]- DAslope*(x - A1[1]);
Now we find where they meet:
> solve({DAline, perpline});
So the perpendicular from C1 to the base D1A1 meets the base at the point P1, given as follows:
> P1:= [-42/5, 6/5];
So now we may compute the height, base and area of the parallelogram, using Pythagoras:
> pramheight:= sqrt((P1[1] - C1[1])^2 +(P1[2] - C1[2])^2 );
> prambase:= sqrt((D1[1] - A1[1])^2 +(D1[2] - A1[2])^2 );
> pramarea:= pramheight*prambase;
This agrees with our previous result.
Finally the outer rectangle has area (12- (-12))(6 - (-6)) = 24(12) = 288.
So our estimate for the ellipse area is the average of the areas of the inner parallelogram and the outer rectangle:
> ellipseareaest:= 1/2*(288 + pramarea);
We plot the ellipse, the inner paralleogram and the outer rectangle:
> Q1:= implicitplot(m, x= -12..12, y = - 6..6, grid = [100, 100], thickness = 3, color = blue, scaling=constrained):
> Q2:= plot(6, x= -12..12, thickness = 3, color = red, scaling=constrained):
> Q3:= plot(-6, x= -12..12, thickness = 3, color = red, scaling=constrained):
> Q4:= plot([-12,t, t= -6..6], thickness = 3, color = red, scaling=constrained):
> Q5:= plot([12,t, t= -6..6], thickness = 3, color = red, scaling=constrained):
> Q6:= plot([t, 3-t/2, t= -6..12], thickness = 3, color = green, scaling=constrained):
> Q7:= plot([t, -3-t/2, t= -12..6], thickness = 3, color = green, scaling=constrained):
> Q8:= plot([t, 9+t/2, t= -12..-6], thickness = 3, color = green, scaling=constrained):
> Q9:= plot([t, -9+t/2, t= 6..12], thickness = 3, color = green, scaling=constrained):
> display(Q1, Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9);
We can find the exact area of the ellipse by solving for y giving the upper and lower curves for each fixed x and then integrating the difference between x = -12 and x = 12:
> mm:= [solve(m, y)];
The upper curve at fixed x is mm[1].
The lower curve at fixed x is mm[2].
We check by plotting these two curves.
> plot({mm[1],mm[2]}, x = -12..12, thickness = 3, numpoints = 1000, scaling = constrained);
The height between the curves is then mm[1] - mm[2].
> mmm:= mm[1] - mm[2];
> ellipsearea:= int(mmm, x = -12..12);
> evalf(ellipsearea);
Finally we calculate the percentage error in our estimate of 198 for the area of the ellipse:
> percenterror:= (ellipseareaest/ellipsearea - 1)*100;
> evalf(percenterror);
>