Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Laboratory Problem Description The Maclaurin series expansion of f(x) = cos x is given as: x x4 x6 x8 COS X = 1 - 2!+
Laboratory Problem Description The Maclaurin series expansion of f(x) = cos x is given as: x x4 x6 x8 COS X = 1 - 2!+ 4 6+91-.. 2 x 2n cos x = COS X = -1) 2n! n=0 Part A: Write a C program to compute the function f(x) = cos x using the series shown above. Inputs to your program will be: 1) the value of x (in radians), and 2) a pre-specified approximate relative error (%). Your program should print the final value of f(x) = cos x obtained along with the true and approximate errors. Your program needs to get the true value of f(x) = cos x using the built-in cos x function in C. Part B: Run your program to estimate the value of f(1/3) with relative error of less than 0.5%. In other words, choose your inputs as x = 1/3 and the relative error equals 0.5%. Print your result along with the final error values (true and approximate percent relative errors). You need to add the terms in the Maclaurin series until the approximate percent relative error falls below 0.5%
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started