First time here? Check out the FAQ!

Ask Your Question
2

how to run maxima code in Sage?

asked 7 years ago

danielvolinski gravatar image

updated 7 years ago

calc314 gravatar image

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

assume(r0)$

assume(theta0,theta2*π)$

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 7 years ago

calc314 gravatar image

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

Preview: (hide)
link

Comments

Thanks, it works!

danielvolinski gravatar imagedanielvolinski ( 7 years ago )
2

answered 7 years ago

eric_g gravatar image

updated 7 years ago

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)
Preview: (hide)
link

Comments

Thanks, it works!

danielvolinski gravatar imagedanielvolinski ( 7 years ago )

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: 7 years ago

Seen: 1,423 times

Last updated: Dec 17 '17