Info
This question is closed. Reopen it to edit or answer.
I tried to solve this quistion about
2 views (last 30 days)
Show older comments
(find Taylor polynomials of order 3 near x=1 for f(x)=ln(x). I got the answer that is log(x) but whene I calclated it I got x-x^2/2+x^3/3)
I wrote
syms x;
f(x)=log(x)
t3=taylor(f,x,1,'order',4);
and I got the answer that is log(x)
MATLAB R2019b
1 Comment
Walter Roberson
on 5 Apr 2020
f(x)=log(x)
That command has no semi-colon at the end of it, so MATLAB is going to display the result of f(x), which is going to be log(x)
t3=taylor(f,x,1,'order',4);
That command does have a semi-colon at the end of it, so MATLAB is not going to automatically display the result of the calculation. If you were to remove the semi-colon you would see the taylor approximation.
Answers (1)
David Hill
on 5 Apr 2020
What I got, which should be good for log(x) close to 1, is:
t3 = x - (x - 1)^2/2 + (x - 1)^3/3 - 1;
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!