Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

DAKAR AMERICAN UNIVERSITY OF SCIENCE AND TECHNOLOGY

Fall 2020

Numerical Analysis
hw2
Issued: Nov. 17. 2020 Due: Dec. 10. 2020

1) Improving the quadratic formula.


Assume that 𝑎 ≠ 0 𝑎𝑛𝑑 𝑏 2 − 4𝑎𝑐 > 0 and consider the equation 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0
The roots can be computed with quadratic formulas
−𝑏+√𝑏2 −4𝑎𝑐 −𝑏−√𝑏2 −4𝑎𝑐
(i) 𝑥1 = , 𝑥2 =
2𝑎 2𝑎

Show that these roots can be calculate with the equivalent formulas
−2𝑐 −2𝑐
(ii) 𝑥1 = 𝑥2 =
𝑏+√𝑏 2 −4𝑎𝑐 𝑏−√𝑏2 −4𝑎𝑐

2) Use the result of exercise (1) to construct an algorithm and matlab program that will
accurately compute the root of a quadratic equation in all situation including the
troublesome one 𝑏 ≈ √𝑏 2 − 4𝑎𝑐 .

3) Write a program to evaluate e by the series:


1 1 1 1
𝑒 = 1+1+ + + + +⋯
2! 3! 4! 5!
Test your program as you increase the number of terms in the series. Determine how many
significant digits of precision that you obtain in your answer as a function of the number of
terms in the series. How many terms are necessary to reach machine precision?

4) Use Taylor series expansions with n = 0 to 6 to approximate 𝑓(𝑥) = cos 𝑥 at 𝑥𝑖+1 =


𝜋⁄3 on the basis of the value of 𝑓(𝑥) and its derivatives at 𝑥𝑖 = 𝜋⁄3. Note that this
means that h = π/3 - π/4 = π/12

You might also like