Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recall the Taylor expansion for sin(x) sin(x) centered around the point a = 0a = 0 is given by sin(x) = x - x3

image text in transcribedimage text in transcribed

Recall the Taylor expansion for sin(x) sin(x) centered around the point a = 0a = 0 is given by sin(x) = x - x3 x5 + - x7 + +(-1)". x2n+1 (2n+1)! + 3! 5! 7! =(-1)". n=0 x2n+1 (2n+1)! sin(x) = x 00 8 - 3 + x + +(-1)" x2n+1 (2n+1)! 3! 5! 7! =(-1)" n=0 2n+1 (2n+1)! I wrote the following algorithm to compute an approximation to sin(x) sin(x) using this expansion. The approximation is good for x0 = 9 = 2' 9T x=2, but it does not compute valid approximations for x0 = 2 , for instance. Run the code and generate both approximations using n = 3n = 3, n = 10n = 10, and n = 20n = 20. Why do you think there is error in the approximations generated? Submit the MATLAB computed values for sin(x) sin(x) evaluated at these points and the approximations generated with the code. Provide your ideas on the reasons for the differences you may see in the numbers. %% compute sin(x) using Taylor expansions % define the number of terms to use n = 10; % define the evaluation point x0 = pi/2; % initialize the first term and the sum term = x0; sum = term; % accumulate the sum for i = 1:n end % alternate the sign in the Taylor expansion sign = (-1)^i; % compute the next term % this is based on the previous term term = term*x*x0/(2*i)/(2*i+1); % add the new term to the existing sum sum + sign*term; sum = sum

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_2

Step: 3

blur-text-image_3

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

Vector Mechanics For Engineers Statics

Authors: R.C.Hibbeler

7th Edition

978-0072931105, 0072931108

More Books

Students also viewed these Mechanical Engineering questions