Ask Your Question
2

Taylor expansion, powers of x-a

asked 2023-08-01 16:38:54 +0100

JC gravatar image

Hi all,

I noticed that taylor(...) has a somehow inconsistent behaviour. When used with a function of one variable, it returns an expression that is a sum of powers of $x-a$. For instance taylor(sin(x), x,1,2) gives the result $-\frac{1}{2} \, {\left(x - 1\right)}^{2} \sin\left(1\right) + {\left(x - 1\right)} \cos\left(1\right) + \sin\left(1\right)$ as expected. Same for taylor(sin(x*y), (x,1), (y,2),2) that gives the expected answer.

In contrast taylor(sqrt(1+4*x^2 + y^2),(x,1), (y,2),2) gives a result ending with $\frac{4}{3} x + \frac{2}{3} y + \frac{1}{3}$ , where I was expecting something containing a term on $x-1$ and a term in $y-2$.

Any ideas?

JC

edit retag flag offensive close merge delete

Comments

I cannot reproduce your result in Sagecell. Please try to update your Sage version.

Max Alekseyev gravatar imageMax Alekseyev ( 2023-08-01 19:03:29 +0100 )edit

I am using sage 10.0 on ubuntu. Perhaps adding `var('x,y')' at the very beggining helps? I tried that in sage cell server ant the restult is the one in my original post.

JC gravatar imageJC ( 2023-08-01 21:43:41 +0100 )edit

The linear part can be rewritten as follows

maxima('taylor(4/3*x + 2/3*y + 1/3,[x,1,1],[y,2,1])')

((2*(y-2))/3+3)+(4*(x-1))/3
achrzesz gravatar imageachrzesz ( 2023-08-02 11:33:57 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-08-01 22:07:57 +0100

Emmanuel Charpentier gravatar image

updated 2023-08-01 22:13:47 +0100

On a (lame for now) Sage 10.1.beta8 :

sage: var("x, y")
(x, y)
sage: taylor(sqrt(1+4*x^2+y^2),(x, 1), (y, 2), 2)
10/27*(x - 1)^2 - 8/27*(x - 1)*(y - 2) + 5/54*(y - 2)^2 + 4/3*x + 2/3*y + 1/3
sage: var("u, v")
(u, v)
sage: taylor(sqrt(1+4*x^2+y^2).subs({x:u+1, y:v+2}),(u, 0), (v, 0), 2).subs({u:x
....: -1, v:y-2})
10/27*(x - 1)^2 - 8/27*(x - 1)*(y - 2) + 5/54*(y - 2)^2 + 4/3*x + 2/3*y + 1/3

Sage insists to develop degree 1 monomials with numerical coefficients :

sage: 1/2*(x-1)+2/3*(y-2)
1/2*x + 2/3*y - 11/6

This has already caused much tears, wails and teeth grindings (on this site and elsewhere). Complain fiercely...

EDIT : Same results on Sagecell...

HTH,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-08-01 16:38:54 +0100

Seen: 267 times

Last updated: Aug 01 '23