Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with the codes for the C/C++ program. Part A = Calculate the Maclaurin Series expansion of f(x) cos(x) for five terms. Generalize
Please help me with the codes for the C/C++ program.
Part A = Calculate the Maclaurin Series expansion of f(x) cos(x) for five terms. Generalize this result for an infinite number of terms, expressing your solution as a summation. Write a ClC++ program to compute the Maclaurin Series expansion of f(x) = cos x using the series derived from part A above. You need to add the terms in the Maclaurin series until the percent relative error falls below a certain pre-specified relative error (%). Inputs to your program will be x (in radians)) and the pre-specified relative error (%). Your program should print the number of terms, cos x value obtained along with the true, absolute and relative approximate errors (%). Your program needs to get the true value of f(x) = cos x using the built-in cos x function in CIC++. Print your result as shown in the sample run. Enter your approx. relative error bound: 0.001 Enter you angle in in radians: 1.04719 N.terms Exact aproximate value 1 0.500007 0.451697 2 0.500007 0.501803 3 0.500007 0.499971 4 0.500007 0.500007 absolute error 0.048310 0.001796 0.000035 0.000000 %trelative error 9.661871 0.359220 0.007086 0.000087 Process exited after 33.23 seconds with return value o Press any key to continueStep 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