Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Being done in c. Algorithm: Determine the Maclaurin Series approximation to D(t) = etcos(t) as a power series in t (all variables are doubles) as
Being done in c.
Algorithm: Determine the Maclaurin Series approximation to D(t) = etcos(t) as a power series in t (all variables are doubles) as given in lectures up to the first 7 non-zero terms (you need 7 for the truncation error on 6 terms). Then as often as the user wishes to repeat, allow the user to choose the number of non-zero terms (from 1 to 6) in the series approximation and what range (between 0.0 and 4.0) of values of t to evaluate in 10 equal increments. As a check that you have to correct series, you should to derive it two ways to see if they agree: 1. from 1st principles by differentiation, 2. by the product of the separate et and cos(t) series. The purpose of the series approximation is to speed up its execution so no functions are used in the evaluation of the terms of the series, whether they be math library functions such as exp() or pow() etc., or any other function, and terms such as x for example are written explicitly in your code as x*x*x and factorials are precalculated and written in as numbers. For each value of t the Maclaurin series approximation is output together with the exact value from the math library. Also output the relative error in two ways: 1. From comparison with the exact value calculated using the math library functions: Exact % Error = 100*(exact value - series value)/exact value 2. From the first truncated term. This gives you an idea of how well the first truncated term approximates to the error. Truncation % Error = 100*first truncated term/series value. Example Output Evaluate the Maclaurin Series approximation to D(t) = exp (t) *cos(t) 1: Evaluate the series 2: quit Evaluating the series Please enter the number of (non-zero) terms in the series (1, 2, 3, 4, 5 or 6): Please enter the range of t to evaluate in 10 increments (0.0Step 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