Ask Your Question
1

how to re-order factors

asked 2015-02-15 16:41:17 -0500

userX gravatar image

updated 2015-02-16 21:22:38 -0500

kcrisman gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2015-02-16 12:05:44 -0500

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.

edit flag offensive delete link more

Comments

very nice thank you! its perfect!

userX gravatar imageuserX ( 2015-02-16 13:32:06 -0500 )edit

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: 2015-02-15 16:41:17 -0500

Seen: 93 times

Last updated: Feb 16 '15