Question: 1. Write a function squareRoot(x) to compute the square root of the positive number by newton-raphson method. Calculators and computers use Newton's Method to compute
1. Write a function squareRoot(x) to compute the square root of the positive number by newton-raphson method. Calculators and computers use Newton's Method to compute square roots. We'll see how to compute \sqrt(2) Finding the square root of 2 is the same thing as solving x^(2)-2=0. So we set f(x)=x^(2)-2,f^(')(x)=2x, and apply the recursive formula x_(n 1)=x_(n)-(f(x_(n)))/(f^(')(x_(n)))=x_(n)-(x_(n)^(2)-2)/(2x_(n)) It only takes a few steps to get 10 or 20 decimal places. (The computed value is correct up to the final underlined digit.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
