Recall that the equation of the tangent line to \( y = f(x) \) at a point \( x=a \) is \[ y = f(a) + f'(a)(x-a). \] When \(f'(a) \ne 0\), this straight line intersects the \(x\)-axis at \[ x = a-\frac {f(a)}{f'(a)}. \] When we apply this to \( a = x_k \), we conclude that given a \(k\)-th Newton iterate \( x_{k} \), with \( f'(x_k) \ne 0 \), we can obtain \( x_{k+1} \) by the formula \[ x_{k+1} = x_k-\frac {f(x_k)}{f'(x_k)}. \]
Now that we understand the method, let’s use SageMath to speed up calculations. The SageMath demo below allows you to input a function and a starting point \(x_0\) that you want to use Newton’s method on. You can control the number of approximations \(n\) computed using the slider bar. Try this with the graph of \(f(x) = x^3-x\), starting at the point \(x_0 = 2\). Increase the number of approximations and/or change the initial point \(x_0\) to see what happens.
2. Consider the function \( f(x) \) given by your instructor with the value \( x_0 \) given by your instructor. Use the SageMath interactive cell above to compute \( x_n \) for the value of \( n \) in your lab report. (Hint: You can use the output of the cell to check your answers for \( x_1 \) and \( x_2 \) from Exercise 1.)
3. Consider the function \( f(x) \) given by your instructor. Use the SageMath interactive cell above Exercise 2 to answer the following questions.
(a) Set \( x_0 \) to the value given in 3(a) in your lab report. Use that to compute \( x_n \) for the value of \( n \) given by your instructor.
(b) Set \( x_0 \) to the value given in 3(b) in your lab report. Use that to compute \( x_n \) for the value of \( n \) given by your instructor.
(c) What did you observe in parts (a) and (b)? Did you find the same root in both parts? Was it the root you expected? In your lab report, describe a potential difficulty you discovered which can occur when using Newton’s method.
4. In some situations, we have a symbol for the exact root of a function. For example, \(\sqrt{2}\) is one of the exact roots of the function \(f(x) = x^2-2\). Newton’s method gives us a way to approximate the first few digits of such numbers. Use the SageMath interactive cell above Exercise 2 to answer the following questions.
(a) Use \( f(x) = x^2-2 \) and \(x_0 = 1\) to approximate \( \sqrt{2} \). To find this approximation, select \( n \) so that \( x_n \) appears to remain unchanged when \( n \) is further increased. The value \( x_n \) is an approximation of \( \sqrt{2} \) that is correct to 4 decimal places.
(b) Consider the number \( a \) given by your instructor. Find a polynomial function \( f(x) \), using only integer coefficients, so that \( a \) is a root of \( f(x) \). Record the polynomial in your lab report.
(c) Using the function \( f(x) \) from part (b) and \( x_0 = 2 \), find an approximation for \( a \). (Select \( n \) as you did in part (a).) Attach a printout to your lab report of the interactive plot which shows these iterations of Newton’s method.
(d) Repeat steps (b) and (c) to find an approximation for the expression in your lab report. (Select \( n \) as you did in part (a).) Attach a printout to your lab report of the interactive plot which shows these iterations of Newton’s method.