Thank you for your answer and sorry for the typo mistake.
Your solution works well with the example given but doesn't work as I would 
like with exponents (x^2, ...).

What I would like to get is Sage returning expressions with coefficients 
sorted by the value of the exponents, like when using multivariate 
polynomial rings.

Here is an example :

*****************************
var('x y z A B')

f = (1+B*(x+y))^((B-1)/(2*B)) * exp(z/2) / (1+(x-y)/A)

f = taylor(f,(x,0),(y,0),(z,0),2)

#this definition of a polynomial ring is useless
R.<A,B> = QQ[]
R.<x,y,z> = PolynomialRing(QQ[A,B],order='deglex')

print f
*****************************

I want to sort the terms of a polynomial obtained with a Taylor expansion. 
I cannot declare a polynomial ring to have the terms automatically sorted 
because the initial expression is not a polynomial. I tried to ask Sage to 
switch to a polynomial ring after applying the Taylor expansion, but it 
doesn't change anyting.

What I would like to obtain is the following answer (I copied/pasted the 
solution of the Taylor expansion and I worked in a polynomial ring) :

*****************************
R.<A,B> = QQ[]
R.<x,y,z> = PolynomialRing(QQ[A,B],order='deglex')

f = 1/2*(((B - 1)*A - 2)*x + ((B - 1)*A + 2)*y + A*z)/A + 1/8*(A^2*z^2 -
((B^2 - 1)*A^2 - 4*(B - 1)*A - 8)*y^2 - ((B^2 - 1)*A^2 + 4*(B - 1)*A -
8)*x^2 + 2*((B - 1)*A^2 + 2*A)*y*z - 2*(((B^2 - 1)*A^2 + 8)*y - ((B -
1)*A^2 - 2*A)*z)*x)/A^2 + 1

print f
*****************************

Is there a solution to my problem ?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to