Numerical Analysis
Fall 2014
Lab. work 2. Due December 6th
1
Root finding
√ Find the root of the function f (x) = x − e−x on the interval [0, 1.2] with error tolerance of 10−4 . a) Apply the bisection method starting with a = 0 and b = 1.2; b) Apply the false position method starting with a = 0 and b = 1.2; c) Apply the Newton’s method starting with x0 = 0.6; d) Apply the simplified Newton’s method starting with x0 = 0.6; e) Apply the secant method with x0 = 0.6 and x1 = 1; For each method compute also the absolute errors |xk − x∗ | for each iterate. Note: the true zero ∗ x ≈ 0.42630275100686. Present results in a table. Discuss these results.
2
Root Finding Part II
Using the programs from previous problem, solve the equation f (x) ≡ x3 − 3x2 + 3x − 1 = 0 with an accuracy of 10−6 . Experiment with different ways of evaluating f (x); for example, use (i) the given form, (ii) reverse its order, and (iii) the nested form. Try various initial intervals (for example [0, 1.5] , [0.2, 2.0] , and [0.6, 1.1]) or initial guesses (for example x0 = −10, x0 = 0, and x0 = 1.1; x1 = 10, x1 = 0.6, and x1 = 0.9). Note that x∗ = 1 is the only root. Discuss your results.
3
Fixed-point iteration method
Compute the fixed point for the following functions if initial guess is x0 a)g(x) = 2e−x x0 = 0.8 0.9 x0 = 0.75 b)g(x) = 1 + x4 c)g(x) = 6.28 + sin x x0 = 6 Using Aitken extrapolation estimate the error and improve the approximated solution. Repeat the problem using the active Aitken extrapolation. Discuss the results.
1
4
Fixed-point iterations. Chaotic behaviour
Consider the equation x = cx(1 − x) = g(x) with a nonzero constant c. Denote the nonzero solution by αc . For what values of c will the the iteration xn+1 = g(xn ) converge? Slowly increase the value of c past the interval found earlier, keeping c < 4. Observe the behaviour. Comment your results.
5
Big Bank of Ionland
Big Bank of Ionland is launching a new promo campaign on its new ”unbelievable offer” for mort¯ are an ordinary citizen of Ionland with a good job which pays you a good salary. You gages. You ¯ are young and healthy and consider to have a family and since every family should have its own nest you are interested in the offer. The only thing that is missing from the picture is how much actually should you pay each month. A typical mortgage loan will consist of an amount a that is borrowed at an annual interest rate of r% for n years. Show that if the borrower makes a monthly payment of p ionian dollars, then the total amount left to pay after n year is n
a(1 + r) −
12∗n−1 X i=0
(1 + r/12)12n − 1 p(1 + r/12) = a(1 + r) − p r/12 i
n
Hint: Look at how much is left to pay after 1 year, 2 years, etc. • Big Bank of Ionland is offering a mortgage for nice apartment for $50,000 at 8% with $700 monthly payments. How long will it take to pay off the mortgage? In your answer, describe the methods you used to find out if ”unbelievable offer” is suitable for you. Could you solve it directly? If not, you will have to use one of our root-finding algorithms. Which algorithm did you use and why? • Suppose you want to live in a town-house and for that you will need a mortgage of $100,000. How large must the yearly payments be for the loan to be paid off in 20 years at 8% interest? Describe which processes and algorithms you used to solve this question. • For a mortgage of $100,000 and monthly payments of $1,000, what interest rate is required for the loan to be paid off in 20 years? Again, describe which processes and algorithms you used to solve this question. • Suppose the market now is high and you decided that buying a house in such bullish market might be a costly decision. Incidentally the same bank has some savings offers at 10% rate. Find when deposited amount of money p will double its value. Could you find an faster way to approximate this kind of calculations giving up the precision? Additional non-graded work: Make an analysis of banks’ offers in your country. Do some conclusions for yourself and share your thought with colleagues. 2