Ask Your Question
2

how to run maxima code in Sage?

asked 2017-12-16 16:47:28 +0100

danielvolinski gravatar image

updated 2017-12-17 21:15:11 +0100

calc314 gravatar image

I have the following code in maxima to calculate the laplacian of a function in parabolic coordinates.

assume(r≥0)$

assume(theta≥0,theta≤2*π)$

load(vect)$

derivabbrev:true$

scalefactors(parabolic)$

declare(f,scalar)$

depends(f,rest(parabolic))$

ev(express(laplacian(f)),diff,expand,factor);

What is the proper way to run those Maxima commands in SageMath?

Thanks,

Daniel

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2017-12-17 21:17:58 +0100

calc314 gravatar image

Try placing the magic %maxima at the beginning of a Sage cell. Then, you can execute Maxima commands.

edit flag offensive delete link more

Comments

Thanks, it works!

danielvolinski gravatar imagedanielvolinski ( 2017-12-17 22:21:14 +0100 )edit
2

answered 2017-12-17 14:59:47 +0100

eric_g gravatar image

updated 2017-12-17 15:40:38 +0100

I am not sure that I fully understand the question, but in SageMath you may do the following:

sage: M = Manifold(2, 'M')  # the 2-dimensional plane as a smooth manifold
sage: X.<s,t> = M.chart()   # parabolic coordinates
sage: g = M.riemannian_metric('g')   # the standard Euclidean metric in the plane
sage: g[0,0] = s^2 + t^2   # the metric coefficient g_{ss}
sage: g[1,1] = s^2 + t^2   # the metric coefficient g_{tt}
sage: g.display()
g = (s^2 + t^2) ds*ds + (s^2 + t^2) dt*dt
sage: F = M.scalar_field(function('f')(s,t))  # a generic smooth function M --> R
sage: nabla = g.connection()  # the Levi-Civita connection associated with g
sage: lapF = nabla(nabla(F).up(g)).trace()  # the Laplacian of F
sage: lapF.display()
M --> R
(s, t) |--> (d^2(f)/ds^2 + d^2(f)/dt^2)/(s^2 + t^2)
sage: lapF.expr()  # the coordinate expression of Lap(F) as a symbolic expression
(diff(f(s, t), s, s) + diff(f(s, t), t, t))/(s^2 + t^2)
sage: lapF.coord_function()  # same thing but with abriged notations
(d^2(f)/ds^2 + d^2(f)/dt^2)/(s^2 + t^2)
edit flag offensive delete link more

Comments

Thanks, it works!

danielvolinski gravatar imagedanielvolinski ( 2017-12-17 22:21:25 +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: 2017-12-16 16:47:28 +0100

Seen: 1,409 times

Last updated: Dec 17 '17