The Taylor series for the square root function can be written as
Microsoft Equation 3.0
where the value of Microsoft Equation 3.0should be a perfect square that is "close" to the value of x. First, derive the formula given above from the general definition of a Taylor series. Implement this formula in a function called double mysqrt(double x). Next, write your C++ function so that each term of the series is based on the previous term. When evaluating the series in your function, use different strategies to examine the effects of truncation and roundoff error. For example, try using a fixed number of terms (e.g., 5, 10, 20, 50), then try accumulating terms until the last term evaluated has a magnitude that is smaller than a multiple of machine epsilon, or less than the product of machine epsilon and Microsoft Equation 3.0. Feel free to try other ideas that make sense. The goal is to find an evaluation strategy that gives correct answers using a minimum number of calculations.
Write a driver program that will test your mysqrt function for values between 1.0 and 500.0.