Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I tried to solve this quistion about

1 Ansicht (letzte 30 Tage)
Khalid Al-Yousef
Khalid Al-Yousef am 4 Apr. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
(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 Kommentar
Walter Roberson
Walter Roberson am 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.

Antworten (1)

David Hill
David Hill am 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;

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by