Question: Hello please use c programming In this extra credit assignment, you'll write your own square-root function that corresponds to the following prototype: double mySqrt (double

Hello please use c programming
In this extra credit assignment, you'll write your own square-root function that

In this extra credit assignment, you'll write your own square-root function that corresponds to the following prototype: double mySqrt (double x); (for x 0) Now, computers can only perform: +, -,,/, and do some comparisons. So for any mathematical function (e.g. tan, sin, square-root, log......) to be programable on a computer, you need to find a way to calculate the answer that only uses: +, -, *,/, and some comparisons. For a square-root function you can use the Newton-Raphson method. The Newton-Raphson method is a general method that will find the value of x that makes a function f(x) = 0. (under the constraint that the function f(x) is differentiable). In our case, we are trying to determine x for the equation: x = a Which can be rearranged to: and finally in standard polynomial form: x = a x-a=0 So our function f(x) = 0, can be written as: f (x) = x - a = 0 The Newton-Raphson equation for iteratively solving an equation f(x) = 0 is: xk+1 = X - - f(xk) f'(xk) Where for our case: f(x) = x - a f'(x)=2.x (i.e. the derivative of f(x)) After substituting f(x) and f'(x) into the Newton-Raphson equation and simplifying, we have: xk+1 = 0.5.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!