Using as at least four different methods, calculate the values of \cos(x) and \frac{d(\cos(x))}{dx} for x = 1.0 radians. Determine the absolute and relative errors for each of the values you calculate. Present your results as clearly as you can.
Added by Kelli B.
Close
Step 1
Here's how we can do it: ```python import math x = 1.0 # radians cos_x = math.cos(x) dx = math.cos(x + 0.0001) - math.cos(x) # Absolute error abs_error = abs(cos_x - dx) # Relative error rel_error = abs_error / cos_x print("cos(x) =", cos_x) print("dx =", Show more…
Show all steps
Your feedback will help us improve your experience
Lien Le and 92 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a MATLAB program to compute cos x using Taylor series. Inputs to your program will be x (in radians), the beginning point and εs, the pre-specified approximate relative error (%). Your program should print the final value obtained along with the true and approximate errors. Your program needs to get the true value of cos x using the built-in cos( ) function in MATLAB. Use the Taylor series expansion below. Submit your code: cosx =
Sri K.
Use the first four terms of the Taylor expansion of fx=e-x+2 about x=2 and use it to approximate the function to estimate f(0.5). Compute the absolute true percent relative error. All angles are assumed to be in radian. Use at least 4 decimal digits in your calculations
Madhur L.
Compute the absolute and relative errors in using $c$ to approximate $x$ $$x=\pi ; c=3.14$$
Integration Techniques
Numerical Integration
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD