Ask Your Question
1

how to run maxima code in Sage?

asked 2017-12-16 09:47:28 -0500

danielvolinski gravatar image

updated 2017-12-17 14:15:11 -0500

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
1

answered 2017-12-17 14:17:58 -0500

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 15:21:14 -0500 )edit
1

answered 2017-12-17 07:59:47 -0500

eric_g gravatar image

updated 2017-12-17 08:40:38 -0500

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 15:21:25 -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: 2017-12-16 09:47:28 -0500

Seen: 75 times

Last updated: Dec 17 '17