Mathematica Lab 6
Mathematica Lab 6
Initialization
Evaluate the following initialization cell with Shift-Enter before you begin. (It will evaluate
automatically if you answer Yes at the prompt.)
Exercise 1
In[62]:= Clear["`*"]
(a)
To begin, define f (x) = lnx4 + 6 x + 15
Plot f (x) on the interval [1, 4] with 5 left rectangles, and with 5 right rectangles.
Out[101]=
5 Left Rectangles
6
0
1 2 3 4
Underestimate
math1234_lab6_part2.nb 3
0
1 2 3 4
Overestimate
Find the sum of the areas of 5 left and 5 right rectangles. Give your answers as decimal
numbers to 6 significant digits.
4-1
In[102]:=
Δx =
5
Out[102]=
3
5
Out[103]=
13.6413
Out[107]=
12.0837
Answers:
4 math1234_lab6_part2.nb
5 Left 5 Right
12.0837 13.6413
Plot f(x) on the interval [1, 4] with 50 left rectangles, and with 50 right rectangles. Find
the sum of the rectangle areas as decimals to 6 significant digits.
0
1 2 3 4
0
1 2 3 4
math1234_lab6_part2.nb 5
4-1
In[108]:=
Δx =
50
Out[108]=
3
50
Out[109]=
12.9274
Out[112]=
12.7716
Answers:
50 Left 50 Right
12.7716 12.9274
Plot f(x) on the interval [1, 4] with 200 left rectangles, and with 200 right rectangles. Find
the sum of the rectangle areas as decimals to 6 significant digits.
4-1
In[113]:=
Δx =
200
Out[113]=
3
200
Out[114]=
12.8689
6 math1234_lab6_part2.nb
Out[115]=
12.8299
Answers:
What happens to the accuracy of the left and right rectangle sums as the number of rectan-
gles is increased?
The more rectangles you create, the more accurate the left and right rectangle sums
become.
(b)
estimate of the area under f(x) on [1, 4]. Include a margin of error with your estimate.
Based on the most accurate approximating sums that you found above, give your best
(Use only the left and right rectangles that you already calculated. Don’t use midpoint
rectangles or anything else.)
12.8299324736659076235 + 12.868871467210630183
In[116]:=
2
Out[116]=
12.849401970438268903
12.84940197043826890325 - 12.8299324736659076235
In[117]:=
Out[117]=
0.019469496772361280
Exercise 2
(a)
To begin, define g(x) = 4500 x - 1800 x2 + 225 x3 - 9 x4
Plot g(x) with 100 midpoint rectangles on the interval [0, 5], and find the midpoint rectan-
gle sum as a decimal to 6 significant digits.
Out[119]=
100 Midpoint Rectangles
3500
3000
2500
2000
1500
1000
500
0
1 2 3 4 5
5-0
In[121]:=
Δx =
100
Out[121]=
1
20
Out[123]=
10 781.8
(b)
Plot g(x) with 200 midpoint rectangles on the interval [0, 10], and find the midpoint rectan-
gle sum as a decimal to 6 significant digits. (Note that Δx is the same as it was in (a). The
interval is now twice as wide, but we are using twice as many rectangles, so the width of
each rectangle is the same as before.)
Out[124]=
200 Midpoint Rectangles
3000
2000
1000
0
2 4 6 8 10
-1000
Out[125]=
7500.47
(c)
Explain why the answer to (b) is less than the answer to (a), even though the region is
twice as wide.
The answer is less in answer b than answer a because the area is negative from 5 to
10.