Ask Your Question

# how to re-order factors

I have

 x,y, dx, dy= var("x, y, dx, dy");
def iD(f): return diff(f, x)*dx + diff(f,y)*dy;


iD(x^3*y^5) returns

5*dy*x^3*y^4 + 3*dx*x^2*y^5


is there a way to have it return the differentials always at the end as in

5*x^3*y^4*dy + 3*x^2*y^5*dx


thank you

edit retag close merge delete

## 1 Answer

Sort by » oldest newest most voted

Hello;

You would better use differential forms directly

 sage: x, y, z = var('x, y, z')
sage: U = CoordinatePatch((x, y, z))
sage: F = DifferentialForms(U)
sage: form0 = DifferentialForm(F, 0, x^3*y^5)
sage: form0
x^3*y^5
sage: form0.diff()
3*x^2*y^5*dx + 5*x^3*y^4*dy


The exterior product is also implemented

sage: dx = DifferentialForm(F,0,x).diff()
sage: dy = DifferentialForm(F,0,y).diff()
sage: dx*dy
dx/\dy
sage: dy*dx
-1*dx/\dy


You can access the documentation by typing

sage: DifferentialForm?


and then press enter. Alternatively, you can have a look to differential forms in the reference manual.

more

## Your Answer

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

Add Answer

## Stats

Asked: 2015-02-15 23:41:17 +0200

Seen: 229 times

Last updated: Feb 17 '15