Loops – Arithmetic – Problem #2
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Difficulty: Hard
Problem Statement
Compute the following function given a value of x ( a real number) with the accuracy of 10^-6 :f(x)= 1-x^2/2! + x^4/4! –x^6/6!+..... Provide outputs for x= 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 and 1.0. For each value of x print also the number of iterations required to converge with the said accuracy.