, , , , ,

[SOLVED] Homework 8. amath 301 beginning scientific computing

$25

File Name: Homework_8__amath_301_beginning_scientific_computing.zip
File Size: 489.84 KB

5/5 - (1 vote)

Written Exercises
(12 points total)
Exercise 1. (Component Skill 8.1)
The hyperbolic cosine is defined as
cosh(x) =
e
x + e
−x
2
.
(Pronounced “kawsh of x.”) Calculate the fourth-degree Taylor polynomial of cosh(x) at x = 0.
Exercise 2. (Component Skill 8.2)
Consider the integral
I = ∫
π
2
0
sin(x)dx.
a. What is the exact value of I? You don’t have to show how you obtained this value.
b. Approximate I with the left-hand rule using N = 4 subintervals. Show how you set-up the
left-hand rule. Write your answer in decimal form. Round to the nearest fourth decimal place.
c. Does your answer from (b) overestimate or underestimate the exact value of I? Provide a
brief justification as to why this is (besides that the calculations suggest that this is the case).
d. What is the maximum possible error of your answer for (b)? Show how you obtained this
maximum possible error.
Note: This question is asking about the maximum possible error, not the exact error. Use
the global error estimate for the left-hand rule.
e. Approximate I with the right-hand rule using N = 4 subintervals. Show how you set-up the
right-hand rule. Write your answer in decimal form. Round to the nearest fourth decimal
place.
f. Does your answer from (e) overestimate or underestimate the exact value of I? Provide a
brief justification as to why this is (besides that the calculations suggest that this is the case).
g. What is the maximum possible error of your answer for (e)? Show how you obtained this
maximum possible error.
Note: This question is asking about the maximum possible error, not the exact error. Use
the global error estimate for the right-hand rule.
2
h. Approximate I with the midpoint rule using N = 4 subintervals. Show how you set-up the
midpoint rule. Write your answer in decimal form. Round to the nearest fourth decimal place.
i. What is the maximum possible error of your answer for (h)? Show how you obtained this
maximum possible error.
Note: This question is asking about the maximum possible error, not the exact error. Use
the global error estimate for the midpoint rule.
Exercise 3. (Component Skills 8.3-8.4)
Consider an ellipse of the form
x
2
a
2
+
y
2
b
2
= 1.
The circumference of this ellipse is given by the integral
C = ∫

0

a
2 sin2
(θ) + b
2 cos2(θ)dθ.
This integral can be solved exactly if the ellipse is a circle. Then, a and b are equal to the radius
of the circle r, and the circumference C = 2πr, as you learned in your grade school days. If a and b
are not equal to each other, then we can’t solve the integral above exactly.
a. Estimate C by the trapezoidal rule with N = 4 subintervals. Assume a and b are positive
parameters. What you will find is an approximate formula for C as a function of a and b.
b. Estimate C by Simpson’s 1/3 rule with N = 4 subintervals. Assume a and b are positive
parameters. What you will find is an approximate formula for C as a function of a and b.
3
Coding Exercises
(8 points total)
Exercise 1. (Component Skills 8.2-8.4)
The birth weight of a newborn kitten is normally distributed with a mean of µ = 3.5 ounces
and a standard deviation of σ = 0.7 ounces. To compute the probability that a randomly selected
newborn kitten is a heckin’ chonk like Sally with weight between 4.5 and 6 ounces, you would need
to compute the integral
P = ∫
6
4.5
e
−(x−µ)
2
2σ2
σ


dx.
This integral cannot be evaluated exactly using any of the methods you learned in your calculus
classes, so we will evaluate it using numerical integration.
a. Use the MATLAB built-in function integral to estimate the “exact” value of P. Assign A1
to this value.
Answer:
b. Use the midpoint rule to approximate P with N = 2, 4, 8, 16, and 32 subintervals. Assign the
variable A2 to a 5 × 1 column vector containing your approximations of P for each step size.
Answer:
c. Assign the variable A3 to a 5 × 1 column vector containing the errors of your approximations
from (b). Define the error to be the difference in absolute value of the approximations obtained in (b) minus the exact value of the integral obtained in (a).
Answer:
4
d. Use the trapesoidal rule to approximate P with N = 2, 4, 8, 16, and 32 subintervals. Assign
the variable A4 to a 5×1 column vector containing your approximations of P for each step size.
Note: Please use the MATLAB built-in function trapz.
Answer:
e. Assign the variable A5 to a 5 × 1 column vector containing the errors of your approximations
from (d). Define the error to be the difference in absolute value of the approximations obtained in (d) minus the exact value of the integral obtained in (a).
Answer:
f. Use Simpson’s 1/3 rule to approximate P with N = 2, 4, 8, 16, and 32 subintervals. Assign
the variable A6 to a 5×1 column vector containing your approximations of P for each step size.
Answer:
g. Assign the variable A7 to a 5 × 1 column vector containing the errors of your approximations
from (f). Define the error to be the difference in absolute value of the approximations obtained
5
in (f) minus the exact value of the integral obtained in (a).
Answer:
h. Create the a plot in MATLAB that meets the following specifications:
• Plot A3 as a function of N. Instead of the usual plot command, use semilogy to create
a plot with a logarithmic scale on the y-axis. Adjust the line width to 2. Use blue for
the line color.
• Superimpose a plot of A5 as a function of N. Instead of the usual plot command, use
semilogy to create a plot with a logarithmic scale on the y-axis. Adjust the line width
to 2. Use red for the line color.
• Superimpose a plot of A7 as a function of N. Instead of the usual plot command, use
semilogy to create a plot with a logarithmic scale on the y-axis. Adjust the line width
to 2. Use black for the line color.
• Add a legend in the northeast corner of the graph. Use the label “Midpoint” for the first
plot, the label “Trapezoid” for the second plot, and the label “Simpson” for the third plot.
• Set the domain of the plot to be 0 ≤ N ≤ 33. Set the range of the plot to be 10−8 ≤ y ≤ 10−1
.
Set the font size to 10.
• Add the label “N” for the x-axis and the label “log10(error)” for the y-axis. Set the font
sizes of these labels to 20. Add the title “Error of Numerical Integration Methods.” Set
the font size to 20.
• Turn on the grid and box.
Answer:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Homework 8. amath 301 beginning scientific computing[SOLVED] Homework 8. amath 301 beginning scientific computing
$25