Low order Taylor expansion

asked 2024-10-27 17:03:42 +0100

davy gravatar image

updated 2024-10-27 18:33:53 +0100

Max Alekseyev gravatar image

When I try to Taylor expand the following expression

f(x) = sin(x)^6 / ( 8 - 15*cos(x) + 10*cos(x)^3 - 3*cos(x)^5)

up to a low order like 4, sage returns 0, but for higher orders like 6 and up, it correctly Taylor expands the function but it suddenly also finds lower order terms. the following code shows the issue

[taylor(f(x), x, 0, i) for i in range(8) ]

the first 5 expansions give 0, from order 6 on, sage finds also lower order terms.

edit retag flag offensive close merge delete

Comments

1

It looks like a bug. Please report at https://github.com/sagemath/sage/issues

Max Alekseyev gravatar imageMax Alekseyev ( 2024-10-27 18:34:44 +0100 )edit
1

FWIW, the .series() method computes these developments correctly :

sage: {u:f(x).series(x==0, u+1).truncate()-taylor(f(x), x, 0, u) for u in (1..8)}
{1: 2/5,
 2: -3/20*x^2 + 2/5,
 3: -3/20*x^2 + 2/5,
 4: 13/800*x^4 - 3/20*x^2 + 2/5,
 5: 13/800*x^4 - 3/20*x^2 + 2/5,
 6: 0,
 7: 0,
 8: 0}

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-10-27 23:19:06 +0100 )edit