Question: 2. Write a function that computes the approximate value of cos x using Taylor's series cosx = 1 - x x x6 2! 4!
2. Write a function that computes the approximate value of cos x using Taylor's series cosx = 1 - x x x6 2! 4! 6! +... The function should use the while loop, which is terminated when the magnitude of the last term becomes smaller than 10%. The function should output the value of the truncated series as well as, as an option, the number of terms myvec (1) and compare the result to cos(x) that were used in the calculation. Use your function for x evaluated in Matlab. Is the difference smaller than 10-8?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
