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

Problem #2 Write a function called myexp2 that will take x as an input argument

ID: 3733849 • Letter: P

Question

Problem #2 Write a function called myexp2 that will take x as an input argument and return y which is an approximation of Taylor series. 72 y- n! 0 The approximation will stop when the absolute error is less than 5*eps E is given as E- ly- exp(x)l 5 eps Test your code before submitting your function as m file via blackboard. To help you start, use the following code: unction [y.n]-My_exp2(x) y-0; E-1; n 0 % use while loop while (E>5*eps) % newterm-xxxx % y-y+new-term E- abs(y-exp(x); -

Explanation / Answer

function [y, n] = My_exp2(x) y = 0; E = 1; n = 1; f = 1; y = 1; while E > 5*10^-10 new_term = (x^n)/f; y = y+new_term; E = abs(y-exp(x)); n = n+1; f = f*n; end end

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