Homework 4 Solutions - Numerical Analysis | MATH 128A, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Assignment; Class: Numerical Analysis; Subject: Mathematics; University: University of California - Berkeley; Term: Spring 2002;

Typology: Assignments

Pre 2010

Uploaded on 10/01/2009

koofers-user-u3s
koofers-user-u3s 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 128a - Homework 4 - Due Feb 28 at the beginning of class
1) Section 3.3, Problem 8
2) You have just had a new baby, and realize that you have to start saving a lot of money to afford to
send the child to college. Planning for the worst case, you ask yourself how much you would have to
save to send your child to Stanford in 18 years. Assuming 7% inflation for college tuition (a widely
recommended number for concerned parents), you compute that the current $30,000/year cost of
Stanford (out-of-date cost, but good enough for this question) will rise to $30000·1.0718 $101398
per year, or $405592 for four years. By eating a lot of macaroni and cheese, you figure you can save
$10000/year to invest for the next 18 years. Assume that all your investment income will be taxed
at a 20% rate at the end of 18 years. What interest rate do you need to get to have saved $405592,
after taxes, after 18 years? Given that the historic rate of return of the stock market is around
10%, do you expect to have saved enough? Hint: Use the formulation from the last question. Note
that you pay tax only on the interest you earn, not the $180000 you invest (which would be double
taxation). Explain how you got your answer; “I plugged it into an HP-12C financial calculator” is
not good enough. We note that the solver for this problem on the HP-12C was designed by Prof.
W. Kahan in our department.
3) Consider the following system of two simultaneous equations in two unknowns xand y:
f1(x, y)=x2+a·y21=0
f2(x, y)=(x1)2+y21=0
where ais a parameter.
Part 1 . Solve the equations explicitly by hand. Show that for all but a finite number of (complex)
values of a, there are four (possibly complex) solutions (x, y), but for this finite set of a’s,
there are fewer solutions. Exhibit all solutions, and the finite set of a’s, explicitly. Four is
the upper bound on the number of solutions given by Bezout’s theorem as described in class
(the product of the degrees of the polynomials f1and f2, which are both 2). This example
shows that the upper bound is attainable for most, but not necessarily all, coefficients.
Part 2 . Write down two explicit formulas for Newton iteration for this system. First, write it in
the form xi+1
yi+1 =xi
yiJ1·x2
i+a·y2
i1
(xi1)2+y2
i1
where you explicitly exhibit the Jacobian Jand its inverse J1. Second, evaluate this ex-
pression explicitly, i.e. multiply it out and simplify.
Part 3 . Using these formulas, write a (very short) Matlab program to implement Newton iteration
just for this example. It need only implement one step, i.e. not test test convergence, so that
you can just run it ”by hand” and look at the iterates to determine convergence. Thus it
need only be a few lines long at most.
1. Try it for each of the nite values of athat only have two solutions, and starting guesses
equal to the true solutions times (1+rand(1)/100), i.e. change the true solution by about
1%. How many steps does it take to converge to machine precision? Do the number of
correct digits roughly double at each step?
1
pf2

Partial preview of the text

Download Homework 4 Solutions - Numerical Analysis | MATH 128A and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Math 128a - Homework 4 - Due Feb 28 at the beginning of class

  1. Section 3.3, Problem 8
  2. You have just had a new baby, and realize that you have to start saving a lot ofmoney to afford to send the child to college. Planning for the worst case, you ask yourself how much you would have to save to send your child to Stanford in 18 years. Assuming 7% inflation for college tuition (a widely recommended number for concerned parents), you compute that the current $30,000/year cost of Stanford (out-of-date cost, but good enough for this question) will rise to $30000 · 1. 0718 ≈ $ per year, or $405592 for four years. By eating a lot of macaroni and cheese, you figure you can save $10000/year to invest for the next 18 years. Assume that all your investment income will be taxed at a 20% rate at the end of18 years. What interest rate do you need to get to have saved $405592, after taxes, after 18 years? Given that the historic rate of return of the stock market is around 10%, do you expect to have saved enough? Hint: Use the formulation from the last question. Note that you pay tax only on the interest you earn, not the $180000 you invest (which would be double taxation). Explain how you got your answer; “I plugged it into an HP-12C financial calculator” is not good enough. We note that the solver for this problem on the HP-12C was designed by Prof. W. Kahan in our department.
  3. Consider the following system of two simultaneous equations in two unknowns x and y:

f 1 (x, y) = x^2 + a · y^2 − 1 = 0 f 2 (x, y) = (x − 1)^2 + y^2 − 1 = 0

where a is a parameter.

Part 1. Solve the equations explicitly by hand. Show that for all but a finite number of (complex) values of a, there are four (possibly complex) solutions (x, y), but for this finite set of a’s, there are fewer solutions. Exhibit all solutions, and the finite set of a’s, explicitly. Four is the upper bound on the number ofsolutions given by Bezout’s theorem as described in class (the product ofthe degrees ofthe polynomials f 1 and f 2 , which are both 2). This example shows that the upper bound is attainable for most, but not necessarily all, coefficients.

Part 2. Write down two explicit formulas for Newton iteration for this system. First, write it in the form (^) [ xi+ yi+

]

[

xi yi

]

− J−^1 ·

[

x^2 i + a · y^2 i − 1 (xi − 1)^2 + y^2 i − 1

]

where you explicitly exhibit the Jacobian J and its inverse J−^1. Second, evaluate this ex- pression explicitly, i.e. multiply it out and simplify.

Part 3. Using these formulas, write a (very short) Matlab program to implement Newton iteration just for this example. It need only implement one step, i.e. not test test convergence, so that you can just run it ”by hand” and look at the iterates to determine convergence. Thus it need only be a few lines long at most.

  1. Try it for each of the finite values of a that only have two solutions, and starting guesses equal to the true solutions times (1+rand(1)/100), i.e. change the true solution by about 1%. How many steps does it take to converge to machine precision? Do the number of correct digits roughly double at each step?
  1. Try it for 3 random complex choices of a (=randn(1)+sqrt(-1)*randn(1)), and again take the true solutions, perturb them randomly by 1%, and see ifNewton converges quadratically.