Problem 5 The Taylor series expansion for sin(x) is sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... = ?? ((-1)^n / (2n+1)!) * x^(2n+1) where x is in radians. Write a MATLAB program that determines sin(x) using the Taylor series expansion. The program asks the user to type a value for an angle in degrees. Then the program uses a while loop for adding the terms of the Taylor series. If an n is the nth term in the series, then the sum S_new of the n terms is S_new = S_old + ?. In each pass calculate the estimated error given by Error = |(S_new - S_old) / S_old|. Stop adding terms when Error ? 1E-8. The program displays the value of sin(x). Use the program for calculating sin(45
Added by Luis H.
Close
Step 1
First, we need to convert the angle from degrees to radians: `x_rad = x_deg * (pi/180)`. Show moreā¦
Show all steps
Your feedback will help us improve your experience
Madhur L and 66 other Calculus 3 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
Problem 5 The Taylor series expansion for sin(x) is sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... = ̲̲̲ (-1)^n/(2n+1)! * x^(2n+1) where x is in radians. Write a MATLAB program that determines sin(x) using the Taylor series expansion. The program asks the user to type a value for an angle in degrees. Then the program uses a while loop for adding the terms of the Taylor series. If an n is the nth term in the series, then the sum S_new of the n terms is S_new = S_old + ̲. In each pass calculate the estimated error given by Error = |(S_new - S_old)/S_old|. Stop adding terms when Error ⤠1E-8. The program displays the value of sin(x). Use the program for calculating sin(45
Sri K.
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 =
The Maclaurin series expansion for the arctangent of x is defined for |x| < 1, as arctan x = āā n=0 (-1)^n / (2n + 1) x^(2n+1) (4). 1. Write out (by hand) the first four terms (n = 0, ..., 3) of the series in (4). 2. Develop a Matlab script file to estimate arctan(Ļ/6). Starting with the simplest version, arctan x = x, add terms one at a time. After each new term is added, compute the true and approximate percent relative errors. Use a stopping criterion of |ε|s = 0.001%. Also generate one plot for the value of arctan x versus number of iterations and another plot for the true and approximate relative percent errors, eqs. (5) and (6) respectively, versus number of iterations. εt = ([true value] - [approximate value]) / [true value] Ć 100% (5) εa = ([current value] - [previous value]) / [current value] Ć 100% (6)
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
Watch the video solution with this free unlock.
EMAIL
PASSWORD