Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Taylor series approaches provide efficient ways to computes the slope of a funct

ID: 3656601 • Letter: T

Question

Taylor series approaches provide efficient ways to computes the slope of a function. Consider f(x) = ex + x and the step size h = 0.25. Using the forward formula of 0(h), write a Matlab script to evaluate f'(1). (Hint: refer to page 13 of the lecture note "Numerical differentiation".) Using the forward formula of o(h2), write a Matlab script to evaluate f'(l). (Hint: refer to page 13 of the lecture note "Numerical differentiation".) Show that the error of the centred formula = f'(xi) = f(x i + 1) - f (x i - 1)/2h is of order o(h2). (Hint: refer to page 6 of the lecture note "Numerical differentiation".) Using the central formula of o(h4). write a Matlab script to evaluate f'(1). (Hint: refer to page 15 of the lecture note "Numerical differentiation".)

Explanation / Answer

%This will compute the Taylor Series expansion of e^x+x for a user defined %x value for the number of terms required by the user. It will do this about the point %a=0. The result of the %nth term will be compared to the computer generated value of e^x+x x = input ('Enter a value for x:'); % user input of which value to use for x i = input ('Enter the non-zero number of terms for this Taylor Series expansion:'); %user input of number of terms to use % g_n: the nth term in Taylor Series k=2; % initialize k g_n=x^(k-1)/factorial(k-1) % begin with the first term g=g_n; while i>k; % let index increase until number of desired terms reached k=k+1; % increase index by 1 g_n=x^(k-1)/factorial(k-1); g=g+g_n; %add the next term in the series end disp(g)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote