Borrar filtros
Borrar filtros

Please help with Taylor Series Expansion for x^n

2 visualizaciones (últimos 30 días)
Swati Umamaheshwaran
Swati Umamaheshwaran el 5 de Dic. de 2017
Comentada: Swati Umamaheshwaran el 5 de Dic. de 2017
Please help with Taylor series expansion for x^(1/2). I have tried to use the general taylor series expansion formula to find the solution, But I am not able to get the right answer. I am trying to find the square root of 5 about the expansion point 4.(x=5; a=4)
root_five = vpa(sqrt(5));
n = input ('Enter number of intervals: ');
syms a
func = (a)^(0.5);
a = 4;
x = 5;
f = subs (func,a);
for i = 1:n
f = f + ((diff(func,i)*(x-a)^i)/factorial (i));
root_five_4(i) = vpa(subs(f,a));
end
err = abs(root_five-root_five_4)

Respuesta aceptada

Birdman
Birdman el 5 de Dic. de 2017
Actually, your answer is correct. At each step of n, you become closer to zero, which means the real value of square root of 5 and estimated from Taylor expansion are becoming closer as the expansion degree increases and that is actually what we expect from Taylor expansion. For instance when n is 10 in your code, the answer is
0.00000000313464
which is nearly zero and this is what we want to see.
  3 comentarios
Birdman
Birdman el 5 de Dic. de 2017
Actually, I did not receive any erratic result. The convergence is better for every step of n.
Swati Umamaheshwaran
Swati Umamaheshwaran el 5 de Dic. de 2017
I got the answer too. I had made a silly mistake. Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by