[sage-support] Re: Odd Ricci scalar in Sagemanifolds

2023-11-20 Thread Rogerio
Thank you again, Eric!

Em segunda-feira, 20 de novembro de 2023 às 10:55:45 UTC-3, Eric 
Gourgoulhon escreveu:

> 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
>
> https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/utilities.html#sage.manifolds.utilities.simplify_chain_real
> 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
>
> https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/manifold.html#sage.manifolds.manifold.TopologicalManifold.set_simplify_function
> i.e. start you notebook with
>
> N = Manifold(2,'N')
> X. = N.chart(r' M:(0,oo) J:(-oo,oo)')
> N.set_simplify_function(factor)
>
> Best wishes,
>
> Eric. 
>
> Le lundi 20 novembre 2023 à 04:44:49 UTC+1, Rogerio a écrit :
>
> 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. = 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!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/5f748bc5-742a-41a7-86d3-ddd1adc6bbe9n%40googlegroups.com.


[sage-support] Re: Odd Ricci scalar in Sagemanifolds

2023-11-20 Thread Eric Gourgoulhon
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
https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/utilities.html#sage.manifolds.utilities.simplify_chain_real
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
https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/manifold.html#sage.manifolds.manifold.TopologicalManifold.set_simplify_function
i.e. start you notebook with

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

Best wishes,

Eric. 

Le lundi 20 novembre 2023 à 04:44:49 UTC+1, Rogerio a écrit :

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. = 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!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b01ced68-390f-4a1f-ae64-0b5b4617f806n%40googlegroups.com.