The cosine function can be evaluated by the following infinite series: Write an algorithm to implement this

Question:

The cosine function can be evaluated by the following infinite series:

image

Write an algorithm to implement this formula so that it computes and prints out the values of cos x as each term in the series is added. In other words, compute and print in sequence the values for

cos x = 1

cos x = 1 ? x2/2!

cos x = 1 ? x2/2! + x4/x!

Up to the order term n of your choosing. For each of the preceding, compute and display the percent relative error as % error = true ? series approximation/true x 100%

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Numerical Methods For Engineers

ISBN: 9780071244299

5th Edition

Authors: Steven C. Chapra, Raymond P. Canale

Question Posted: