Ask Your Question

# how to run maxima code in Sage?

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

## 2 Answers

Sort by » oldest newest most voted

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

more

## Comments

Thanks, it works!

( 2017-12-17 22:21:14 +0200 )edit

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)
more

## Comments

Thanks, it works!

( 2017-12-17 22:21:25 +0200 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2017-12-16 16:47:28 +0200

Seen: 745 times

Last updated: Dec 17 '17