# Taylor expansion assumptions

This is a very simply question, but I can't seem to get an appropriate answer in Sage. Let's say I have the following function:f(x,y,z)=sqrt(x^2+(y+1-z)^2). The taylor expansion around x=0 is sqrt((y+1-z)^2)+x^2/(2*sqrt((y+1-z)^2)) (analytic form, not the value Sage gives). Is it possible for Sage to take assumptions into account when expanding? For example, if I have assume(y>0,z>0,z>y+1), then clearly, (y+1-z)<0, so when simplifying, sqrt((y+1-z)^2)=z-y-1. However, Sage simply gives me the same answer regardless of assumption. Is there a way to fix this?

edit retag close merge delete

Sort by » oldest newest most voted

On 6.8.beta4, i have the following behaviour, with no assumption:

sage: f(x, y, z) = sqrt(x^2 + (y+1-z)^2)
sage: f.taylor(x, 0, 3)
(x, y, z) |--> -1/2*x^2/(y - z + 1) - y + z - 1


This can be considered as a bug of too much simplifying.

more

I have the same thing; however, I was considering the case where z>y+1, so the solution given isn't correct in that case. The solution I gave was the general analytic form, not the one Sage gave.