# MATH 2308 Saint Marys University Intro to Numerical Analysis Program Questions

Description

For
computer problems, make sure to submit a copy of the source code you have written
and as well as a copy of the output produced by your program. All computer programs
should be written in Fortran 95.

2 attachmentsSlide 1 of 2attachment_1attachment_1attachment_2attachment_2

Unformatted Attachment Preview

CSCI/MATH2308.1 2020
Assignments should be submitted to the appropriately titled Brightspace Dropbox. For
computer problems, make sure to submit a copy of the source code you have written
and as well as a copy of the output produced by your program. All computer programs
should be written in Fortran 95.
1 Consider the two mathematically equivalent expressions
𝑓 (𝑥 ) = 𝑥(√𝑥 + 1 − √𝑥),
and
𝑔(𝑥 ) =
𝑥
(√𝑥+1+√𝑥)
a) Prove that the two expressions are mathematically equivalent.
b) Which of the two expressions can be evaluated more accurately in floating point
arithmetic? Why?
c) Using 4-digit precision, at 𝑥 = 500, 𝑓(500) = 10, and 𝑔(500) = 11.17. Which of
these two evaluations is correct? Explain the discrepancy by performing the
computation and analyzing the interim steps. Use an arbitrary precision calculator
such as https://apfloat.appspot.com/.
2 Assume that you are solving the quadratic equation 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0, with 𝑎 = 1.22,
𝑏 = 3.34, and 𝑐 = 2.28, using the standard quadratic formula, and using 3-digit
arithmetic with rounding. Use an arbitrary precision calculator such as
https://apfloat.appspot.com/.
a. What is the computed value for 𝑏 2 − 4𝑎𝑐 ?
2
b. What is the exact value for 𝑏 − 4𝑎𝑐?
c. What is the relative error for the computed value for 𝑏 2 − 4𝑎𝑐 ?
3 When 𝑎 and 𝑏 are the same sign, which of the following two formulas is preferable
for computing the midpoint 𝑚 of an interval [𝑎, 𝑏], in floating point arithmetic with
rounding? Why? [Hint: It is possible to devise example(s) in which the midpoint lies
outside the interval [𝑎, 𝑏], for only one the formulas above.]
𝑚=
𝑎+𝑏
2
𝑜𝑟
𝑚=𝑎+
𝑏−𝑎
2
Programming Questions
1)
Write a program to compute the mathematical constant 𝑒, the base of natural logarithms
from the definition
1.0 𝑛
𝑒 = lim (1.0 +
) .
𝑛→∞
𝑛
1.0 𝑛
Specifically, compute (1.0 + 𝑛 ) for 𝑛 = 10𝑘 , 𝑘 = 1, 2, … ,20. Determine the error in your
successive approximations by comparing them with the exact value, 𝑒. Does the error
always decrease as 𝑛 increases? Explain your results.
2)
a) Consider the function
𝑓 (𝑥 ) =
Use L’ Hospital’s rule to show that
(𝑒 𝑥 − 1)
.
𝑥
(𝑒 𝑥 − 1)
= 1.
𝑥→0
𝑥
lim 𝑓 (𝑥 ) = lim
𝑥→0
b) Check this result empirically by writing a program to compute 𝑓(𝑥) for
𝑥 = 10.0−𝑘 , 𝑘 = 1, … … … . . , 15 . Do your results agree with theoretical
expectations? Explain why.
3)
Write a program to compute the absolute and relative errors in Stirling’s approximation
𝑛! ≈ √2𝜋𝑛 (𝑛⁄𝑒)𝑛 .
for 𝑛 = 1, 2, … … … ,10. Does the absolute error grow or shrink as 𝑛 increases? Does the
relative error grow or shrink as 𝑛 increases?
CSCI/MATH 2308 Assignment Help
Overview: All of the questions in this assignment exemplify the complications encountered
when numerical computations are carried out in floating point arithmetic.
It is important to realize that often times, computations done with finite precision arithmetic,
produce results which will eventually diverge from theoretical expectations, much like in the
case of the finite difference approximation discussed in class. These assignment questions are
no exception, so you should expect to see some anomalies in the computed solution that will
require some analysis.
When attempting to answer any of these questions, you must put on your numerical analysis
thinking cap and assess the problem in the context of numerical issues such as, machine
precision, underflow, overflow, truncation error, round-off error and catastrophic
cancelation. This is because at least one of these culprits is inevitably responsible for anomalies
in the computed solution.
What to look out for:
Catastrophic cancellation: Beware of expressions or numbers with different or alternate signs
(plus & minus) which are added together. These must be analyzed carefully as a potential
source of the cancellation of significant digits.
Machine precision: This is the smallest positive number in a floating point system whose sum
with 1 is larger than 1, that is,
1 + 𝜖𝑀𝐴𝐶𝐻 > 1

## Reviews, comments, and love from our customers and community:

This page is having a slideshow that uses Javascript. Your browser either doesn't support Javascript or you have it turned off. To see this page as it is meant to appear please use a Javascript enabled browser. Peter M.
So far so good! It's safe and legit. My paper was finished on time...very excited! Sean O.N.
Experience was easy, prompt and timely. Awesome first experience with a site like this. Worked out well.Thank you. Angela M.J.
Good easy. I like the bidding because you can choose the writer and read reviews from other students Lee Y.
My writer had to change some ideas that she misunderstood. She was really nice and kind. Kelvin J.
I have used other writing websites and this by far as been way better thus far! =) Antony B.
I received an, "A". Definitely will reach out to her again and I highly recommend her. Thank you very much.  