Write an algorithm and program to compute e and compute the


This program is to be writen in C (just plain old C, not any other one). Full and complete answer in order to receive full credit. Please read twice what is required.

Write an algorithm and program to compute e and compute the square root (v). The calculation of the important mathematical constant e and the square root (v) will be done as the sum of an infinite series:

8 8

e = ? 1/n! & vS = ? xn+1 = 1/2(xn + S/xn)

n=0 n=0

where x0 is the initial "guess"

Output: Output will include your computed value for e, the library expected value for e, the number of terms (iterations) it took to reach sixteen decimal-place accuracy, and the time (in milliseconds) that it takes to compute the constant.

Output will also include your computed value for the square root of a value input by the user, the number of terms (iterations) it took to reach sixteen decimal-place accuracy, and the time (in milliseconds) that it takes to compute the square root.

Each set of results above should be displayed so as to allow easy comparison of the computed and expected values. Labels should be included, where appropriate.

Input: Accept user input for the value for which the square root is sought. This number will be a real value, and for this assignment will be limited to a real value >= zero. Prompting and validation of the input is, of course, required.

You may NOT use the math library functions sqrt() or exp() in your computations - directly or indirectly. Instead, use only the delta (difference) of your running computation to determine when to stop. No rounding is permitted.

Program must include (minimum) one function for each computation, in addition to the main program. Other functions developed (likely), as required. Test your program completely.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write an algorithm and program to compute e and compute the
Reference No:- TGS02900822

Expected delivery within 24 Hours