1 view (last 30 days)

Hello everyone,

First, I would like to thank any help provided, I truly appreciated.

Here's my problem:

Consider the function 𝑓(𝑥)=3𝑥^3+𝑥.

a. Without MATLAB, compute the first 5 (𝑛 = 0,1,2,3,4) Taylor Series coefficients (Cn) for the function about 𝑎=2.

After computation I got:

3x^3+x approx 26 + 37(x-2) + 18(x-2)^2 + 3(x-2)^3 + 0(x-2)^4

So, the first thing I noticed was that the fuction is not infinitely differentiable since the fourth derivative is zero and so on.

b. How many terms in the Taylor Series would you need for a good approximation of this target function? Justify your answer in three sentences or less.

HERE is where I'm having trouble and is simply because I might be missing something about Taylor Series, but I understand that having 5 and 4 terms would be exacly the same since the last of the 5 term is zero, regardless, I have tried 3 terms, got the relative error, and it is soo similar to having 4 terms. The difference is so big between the function and the taylor polynomial when x=0 or any other number, that is not even an approximation...

Thanks for the help!

John D'Errico
on 22 Sep 2020

Edited: John D'Errico
on 22 Sep 2020

Your question has absolutely nothing to do with MATLAB, but you seem to have made some effort. So I will point out that you may be mistaken that the difference between the original polynomial and the Taylor polynomial is in fact zero.

And, since this forum is explicitly about MATLAB, and I really don't care what the rules for your homework assignment are... :)

syms x

taylor(3*x^3 + x,x,'expansion',2,'order',4)

ans =

37*x + 18*(x - 2)^2 + 3*(x - 2)^3 - 48

Which admittedly, does not look like the original polynomial, but is it really different? Note that you did seem to have gotten the correct Taylor polynomial. My constnt term is different from what you show, but you should see that the linear term does not have a constant term in it. MATLAB combined those terms.

simplify(taylor(3*x^3 + x,x,'expansion',2,'order',4) - (3*x^3 + x))

ans =

0

Just because it looks different, does not mean it really is.

Opportunities for recent engineering grads.

Apply TodayFind the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 4 Comments

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018717

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018717

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018720

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018720

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018729

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018729

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018738

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/597604-taylor-polynomial-of-a-not-infinitely-differentiable-function#comment_1018738

Sign in to comment.