Odd Ricci scalar in Sagemanifolds

60 views
Skip to first unread message

Rogerio

unread,
Nov 19, 2023, 10:44:49 PM11/19/23
to sage-support

Recently I encountered an odd result while using Sagemanifolds to calculate the Ricci scalar for a specific 2D metric. I was trying to reproduce Eq. (37) of this paper, but the result was quite different. Here is the code

 N = Manifold(2,'N')
 X.<M,J> = N.chart(r' M:(0,oo) J:(-oo,oo)')
 
 dM = X.coframe()[0]
 dJ = X.coframe()[1]
 g0 = 2/(1-J^2/M^4)^(3/2)*(-2*((1-J^2/M^4)^(3/2) +1-3*J^2/M^4)*dM*dM - 2*J/M^3*dM*dJ - 2*J/M^3*dJ*dM + dJ*dJ/M^2)
 
 g = N.metric('g')
 g[:] = g0[:]
 ric = g.ricci_scalar()

The result is a high order rational function not resembling the paper result. However, taking

 R = N.scalar_field(1/(4*M^2)*(sqrt(1-J^2/M^4)-2)/sqrt(1-J^2/M^4),name='R')
 delta_R = ric-R
 
 delta_R == 0

Results True.

How to express the Ricci scalar as shown in the paper?

Thanks in advance!

Eric Gourgoulhon

unread,
Nov 20, 2023, 8:55:45 AM11/20/23
to sage-support
Hi, 

The complicated result that you get is due to a lack of simplification in Sage. More precisely, the default simplification chain automatically applied in tensor calculus on manifolds, namely
yields overcomplicated expressions in your case. 
To get a much simpler result, which looks much closer to Eq. (37) of the paper, you have to replace the default simplification chain by a customized one. In your case, it suffices to use the function factor().
For this, use the manifold's method set_simplify_function() just after the declaration of the chart X
i.e. start you notebook with

N = Manifold(2,'N')
X.<M,J> = N.chart(r' M:(0,oo) J:(-oo,oo)')
N.set_simplify_function(factor)

Best wishes,

Eric.

Rogerio

unread,
Nov 20, 2023, 4:11:59 PM11/20/23
to sage-support
Thank you again, Eric!
Reply all
Reply to author
Forward
0 new messages