CAN YOU PLEASE ANSWER ALL 3 QUESTIONS ? I NEED HELP WITH ALL 3 NOT JUST THE FIRS
ID: 3283123 • Letter: C
Question
CAN YOU PLEASE ANSWER ALL 3 QUESTIONS ? I NEED HELP WITH ALL 3 NOT JUST THE FIRST ONE. PLEASE DON'T ANSWER JUST THE FIRST ONE LIKE THE OTHER QUESTIONS ANSWERED
Part B - Taylor series The taylor series is a special series that approximates complicated functions as a polynomial. It is given by ?! where?(a) is the nth derivative of r(x) evaluated at a. To create the approximation, we truncate the series at some maximum term N to give n-1 The Taylor series is used in many scenarios, including when certain mathematical methods may not applicable (such as integration). Or for creating the finite difference approximations, as seen in the week 7 worksheet. 1) Write an algorithm for computing a taylor series to N term. 2) Write a MATLAB function that accepts three inputs (FUN, a, N), where FUN is an annonymous function, a is the point the taylor series is centered around and N is the order of the taylor series. The MATLAB function should output the Nth order Taylor series for the function about a. You are not permitted to use the taylor function in MATLAB to solve the problem. 3) Apply the function to solve the 10th order Taylor series of fx) e abouta 0 hint: if you choose to test your function, you can compare it to the output from wolframalpha here.Explanation / Answer
1) ALGORITHM :
Step 1- Take inputs FUN, a, N, and choose x as a symbol.
Step 2- Take sum = FUN(a) and g = diff(FUN) .
Step 3- Use for loop from i=1 to N, and do
sum = sum + g(a) * (x-a)^n / factorial(i)
Step 4- Set retval = sum. Then print retval, and it is the required Taylor series.
########################
2) MATLAB program:
function retval = taylor_series(FUN, a, N)
syms x
Sum = FUN(a);
for i = 1:N
g = diff(FUN,i);
Sum = Sum + g(a)* (x-a)^i / factorial(i);
end
retval = Sum;
end
#########################
3) Taylor series for f(x) = exp(x) about a=0 and N= 10
Running the above file in MATLAB we get,
retval = x^10/3628800 + x^9/362880 + x^8/40320 + x^7/5040 + x^6/720 + x^5/120 + x^4/24 + x^3/6 + x^2/2 + x + 1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.