Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. The cosine function: The cosine function can be evaluated by the following infinite series 4 6 x x X COSx=1- + + 2! 4!

image text in transcribed

3. The cosine function: The cosine function can be evaluated by the following infinite series 4 6 x x" X COSx=1- + + 2! 4! 6! (a) Write a function that needs as an input the number of terms n of the cosine series and the value of x and then it calculates the series up to the nth term. Make sure that the function does the following: (i) calculates and stores the value of the true percent relative error for each value of k from k = 1 to k = n where n is the number of terms given by the user. (ii) plots the true percent relative error for each value of k from k 1 to k = n. it labels the x- axis, the y-axis and adds a legend. The plot has to be logarithmic on both x and y axes (i.e. log-log plot which can be done by using loglog instead of plot) (iii) times itself using tic; toc; = (b) Run the function for the case x= n and n=170 and report the final plot, and the time of the calculation. (c) From your log-log plot in part (b), how many terms are enough to reach percent relative error less than 10-13 %. (d) If you look at the series, there is an issue in using 200 terms or more. What is the issue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

Explain the nature and role of safety, health, and wellness.

Answered: 1 week ago

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago