Ask Your Question
0

How to calculate Work from Potential

asked 2018-03-15 21:19:33 +0100

danielvolinski gravatar image

I'm using SageMath 8.1 on Window 10 Native with Jupyter Notebook.

This is a continuation to Potential from an exact differential form

R3 = Manifold(3, 'R3', start_index=1, latex_name=r'\mathbb{R}^3')
cartesian3d.<x,y,z> = R3.chart()
R1 = Manifold(1, 'R1', start_index=1, latex_name=r'\mathbb{R}')
cartesian1d.<t> = R1.chart()
g = R1.diff_map(R3, [e^(t^3), t^3-t^2+sin(2*pi*t^5), t^2-1])
omega = R3.diff_form(1, 'omega', latex_name=r'\omega')
omega[:] = (x^2+y*z+e^y, y^3+x*z+x*e^y+z^2, e^z+x*y+2*y*z)

Potential

aux_omega = omega
G1 = R3.diff_form(0); G1.set_expr(integral(aux_omega[1].expr(), cartesian3d[1]))
aux_omega = aux_omega - G1.differential()
G2 = R3.diff_form(0); G2.set_expr(integral(aux_omega[2].expr(), cartesian3d[2]))
aux_omega = aux_omega - G2.differential()
G3 = R3.diff_form(0); G3.set_expr(integral(aux_omega[3].expr(), cartesian3d[3]))
G = G1 + G2 + G3

Then I have to calculate G(g(1)) - G(g(0)). I came up with the following code:

A = G.expr()(x=g.expr()[0](t=1),y=g.expr()[1](t=1),z=g.expr()[2](t=1))
B = G.expr()(x=g.expr()[0](t=0),y=g.expr()[1](t=0),z=g.expr()[2](t=0))
N(A - B)

I consider this last code snippet to be brute-force, and extremely cumbersome. Is there a more elegant way to obtain the same?

Thanks,

Daniel

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-03-16 21:12:17 +0100

eric_g gravatar image

Yes, there is a more elegant way:

A = G(g(R1((1,))))
B = G(g(R1((0,))))

Explanations: R1((1,)) is the point of coordinate t=1 on the manifold R1, g(R1((1,))) is the image of this point by the map g; by the very definition of g, this is a point of R3 and finally, G(g(R1((1,)))) is the image by G of this last point.

Even better, if instead of declaring R1 as a manifold of dimension 1, you declare it as the real line manifold via RealLine (see this documentation), i.e. if you replace the two lines

R1 = Manifold(1, 'R1', start_index=1, latex_name=r'\mathbb{R}')
cartesian1d.<t> = R1.chart()

by the following single one:

R1.<t> = RealLine()

then you can use directly the notation g(1) instead of g(R1((1,))):

A = G(g(1))
B = G(g(0))
edit flag offensive delete link more

Comments

Hi Eric, it works, thanks!

danielvolinski gravatar imagedanielvolinski ( 2018-03-17 16:49:09 +0100 )edit

More generally, I would recommend to use systematically RealLine instead of Manifold(1,...); indeed RealLine inherits from DifferentiableManifold, so it has all the properties of a manifold, plus some extra properties, like forming an element from the value of the canonical coordinate instead of a single-element tuple of coordinate values. Another nice property is to construct the (canonical) chart at the same time as the manifold, hence the writing R1.<t> = RealLine().

eric_g gravatar imageeric_g ( 2018-03-18 12:38:21 +0100 )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: 2018-03-15 21:19:33 +0100

Seen: 317 times

Last updated: Mar 16 '18