Is there an error in the Maple 13 'tensor' package algorithm?

  • Context: Maple 
  • Thread starter Thread starter Orion1
  • Start date Start date
  • Tags Tags
    Maple Tensor
Click For Summary
SUMMARY

The discussion centers on the discrepancies found in the Maple 13 'tensor' package when calculating the G_{rr} component of the Einstein tensor for a General Relativity metric. The user implemented the source code from the Maple 13 help index, but the output generated was incorrect compared to the known solution. Specifically, the Maple output was G_{rr} = \frac{- r \nu'(r) + e^{\lambda(r)} - 1}{r^2}, while the correct solution is G_{rr} = \frac{e^{-\lambda(r)} (-r \nu'(r) + e^{\lambda(r)} - 1)}{r^2}. This indicates a potential algorithmic error in the Maple package.

PREREQUISITES
  • Familiarity with Maple 13 'tensor' package
  • Understanding of General Relativity and Einstein tensor calculations
  • Knowledge of metric tensor components and their significance
  • Experience with mathematical programming in Maple
NEXT STEPS
  • Investigate the algorithmic structure of the Maple 13 'tensor' package
  • Compare the Maple 13 implementation with the Mathematica 'Einsteintensor' package
  • Review the mathematical derivation of the Einstein tensor for various metrics
  • Explore debugging techniques for Maple packages to identify potential errors
USEFUL FOR

Researchers and practitioners in theoretical physics, particularly those focused on General Relativity, as well as developers working with the Maple 13 'tensor' package and those comparing results with Mathematica's Einstein tensor calculations.

Orion1
Messages
961
Reaction score
3

I attempted to use the Maple 13 'tensor' package to solve the G_{rr}[/tex] component of the Einstein_tensor for a General Relativity generic metric for which the solution is already known.<br /> <br /> General Relativity generic metric: (reference 2 - eq. 1)<br /> c^{2} d\tau^{2} = e^{\nu(r)} dt^{2} - e^{\lambda(r)} dr^{2} - r^2 d\theta^{2} - r^2 \sin^2 \theta d\phi^2<br /> <br /> I used the exact same source code listed in the Maple 13 software help index and reference 1, except the definitions of the g_{11} and g_{22} matrix elements.<br /> <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"> <div class="bbCodeBlock-title"> <i class="fa--xf fal fa-code "><svg xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" ><use href="/data/local/icons/light.svg?v=1767548553#code"></use></svg></i> Code: </div> <div class="bbCodeBlock-content" dir="ltr"> <pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang=""><code>&gt; with(tensor); coord := [t, r, th, ph]; g_compts := array(symmetric, sparse, 1 .. 4, 1 .. 4); g_compts[1, 1] := exp(nu(r)); g_compts[2, 2] := -exp(lambda(r)); g_compts[3, 3] := -r^2; g_compts[4, 4] := -r^2*sin(th)^2; g := create([-1, -1], eval(g_compts)); ginv := invert(g, &#039;detg&#039;); D1g := d1metric(g, coord); D2g := d2metric(D1g, coord); Cf1 := Christoffel1(D1g); RMN := Riemann(ginv, D2g, Cf1); RICCI := Ricci(ginv, RMN); RS := Ricciscalar(ginv, RICCI); Estn := Einstein(g, RICCI, RS)</code></pre> </div> </div><br /> The Maple 13 &#039;tensor&#039; package generated this solution for the G_{rr} component:<br /> G_{rr} = \frac{- r \nu&amp;#039;(r) + e^{\lambda(r)} - 1}{r^2}<br /> <br /> However, the correct solution is: (reference 2 - eq. 4) <br /> G_{rr} = \frac{e^{-\lambda(r)} (-r \nu&amp;#039;(r) + e^{\lambda(r)} - 1)}{r^2}<br /> <br /> Can anyone here identify any algorithmic error in my source code?<br /> [/Color]<br /> Reference:<br /> <a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=tensor/Einstein&quot;" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://www.maplesoft.com/support/help/AddOns/view.aspx?path=tensor/Einstein&quot;</a><br /> &quot;www.new.dli.ernet.in/rawdataupload/upload/insa/INSA_2/20005a87_195.pdf&quot;[/URL]
 
Last edited by a moderator:
Physics news on Phys.org
Mathematica Einsteintensor package...


Schwarzschild metric: (reference 2 - eq. 1)
c^{2} d\tau^{2} = e^{\nu(r)} dt^{2} - e^{\lambda(r)} dr^{2} - r^2 d\theta^{2} - r^2 \sin^2 \theta d\phi^2

Mathematica 'Einsteintensor' package source code:
Code:
ToFileName[{$TopDirectory, "AddOns", "Applications"}]
<< einsteintensor.m
x = {t, r, \[Theta], \[Phi]}
(metric = {{\[ExponentialE]^\[Nu][r]*c^2, 0, 0, 
     0}, {0, -\[ExponentialE]^\[Lambda][r], 0, 0}, {0, 0, -r^2, 
     0}, {0, 0, 0, -r^2*Sin[\[Theta]]^2}}) // MatrixForm
Simplify[(Einstein = 
    Inverse[metric].Simplify[EinsteinTensor[metric, x]]) // 
  MatrixForm]

Mathematica 6 'Einsteintensorr' package generated this solution for the G_{11} component:
G_{11} = \frac{e^{-\lambda} (-r \nu&#039; + e^{\lambda} - 1)}{r^2}

According to reference 2 - eq. 4, the solution solution for the G_{11} component:
G_{11} = \frac{e^{-\lambda} (r \nu&#039; - e^{\lambda} + 1)}{r^2}

Which package is generating the correct solution?
[/Color]
Reference:
http://library.wolfram.com/infocenter/MathSource/162/"
http://www.new.dli.ernet.in/rawdataupload/upload/insa/INSA_2/20005a87_195.pdf"
 
Last edited by a moderator:
Mathematica 6 Einstein Tensor package...



Code:
(* Package written by 
      Pekka Janhunen
      Finnish Meteorological Institute
      Geophysics Dept. *)

BeginPackage["EinsteinTensor`"]

EinsteinTensor::usage = "EinsteinTensor[g,x] with g a nxn-matrix
  (the metric with lower indices) and x n-vector (the coordinates)
  gives the Einstein tensor (a nxn-matrix) with lower indices."

Begin["`Private`"]

EinsteinTensor[metric_,x_]:=
  Block[ {Dim,Metric, PreChristoffel, Christoffel, Riemann,
          PreRiemann, Ricci, CurvatureScalar,
          sigma, mu, nu, alpha, beta, gamma},
          Dim = Length[x];
          Metric = Simplify[Inverse[metric]];
            (* Metric with upper indices *)
          PreChristoffel =
            Table[ D[metric[[gamma,alpha]],x[[beta]]]
                 + D[metric[[beta,gamma]],x[[alpha]]]
           		    - D[metric[[alpha,beta]],x[[gamma]]],
           	   	 {gamma,Dim}, {alpha,Dim}, {beta,Dim} ];
           	 (* The "lower index part" of Christoffel symbols *)
          PreChristoffel = Simplify[PreChristoffel];
          Christoffel = (1/2) Metric . PreChristoffel;
             (* The full Christoffel symbols *)
          Christoffel = Simplify[Christoffel];
          PreRiemann = 
             Table[ D[Christoffel[[sigma,alpha,nu]],x[[mu]]]
                    + Sum[Christoffel[[gamma,alpha,nu]]
                            Christoffel[[sigma,gamma,mu]],
                          {gamma,Dim} ],
                    {sigma,Dim}, {alpha,Dim}, {mu,Dim}, {nu,Dim} ];
           	(* PreRiemann has to be antisymmetrized to yield
           	   Riemann tensor: *)
          Riemann = Table[ PreRiemann[[sigma,alpha,mu,nu]]
                         - PreRiemann[[sigma,alpha,nu,mu]],
                           {sigma,Dim}, {alpha,Dim},
                           {mu,Dim}, {nu,Dim} ];
          Ricci = Table[ Sum[Riemann[[sigma,alpha,sigma,beta]],
                             {sigma,Dim}],
                         {alpha,Dim}, {beta,Dim} ];
          CurvatureScalar = Sum[ Metric[[alpha,beta]]
                                 Ricci[[alpha,beta]],
                                 {alpha,Dim}, {beta,Dim} ];
          (* Return Einstein tensor: *)
          Ricci - (1/2) CurvatureScalar metric ]

End[]

EndPackage[]

Print[{EinsteinTensor}]
The output appears to be in the form:
G^i_j

G^1_1 = g^{1i}G_{1i} = g^{11}G_{11}

The Mathematica 6 'Einstein Tensor' package generated this solution for the G^i_j component:
G^1_1} = \frac{e^{-\lambda} (-r \nu&#039; + e^{\lambda} - 1)}{r^2}

The correct G^1_1 component is:
G^1_1} = - \frac{e^{- \lambda} (-r {\nu}&#039; + e^{\lambda} - 1)}{r^2}
[/Color]
Reference:
http://library.wolfram.com/infocenter/MathSource/162/"
 
Last edited by a moderator:

Mathematica Ricci tensor:
R_{ab} = R^c_{acb}

Maple Ricci tensor:
R_{ac} = R^b_{acb}

Package criteria:
R^{Mathematica} = -R^{Maple}

G^{Mathematica}_{ij} = - G^{Maple}_{ij}

The different signs are due to the use of different Ricci tensors.

Mathematica generated output:
G^1_1 = g^{1i}G_{1i}=g^{11}G_{11} = -e^{-\lambda}\frac{ r{\nu}&#039; - e^{\lambda} + 1}{r^2} = \frac{e^{-\lambda} (-r{\nu}&#039;+ e^{\lambda} - 1)}{r^2}

Maple generated output:
G_{11} = \frac{- r \nu&#039; + e^{\lambda} - 1}{r^2}
[/Color]
 

Similar threads

Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
Replies
12
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 15 ·
Replies
15
Views
5K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K