I am currently trying to use the code linked in the catalog of spacetimes pdf to calculate chirstoffel symbols for a metric which follows as

    n := 4
    coord := {t, r, θ, Φ}
metric := {{-(1 - rs/r) c^2, 0, 0, 0},
{0, 1/(1 - rs/r), 0, 0},
{0, 0, r^2, 0},
{0, 0, 0, r ^2 Sin[θ]^2}}
inversemetric := Simplify[Inverse[metric]]
   affine := affine = Simplify[
Table[(1/2) Sum[inversemetric[[Mu, Rho]] (
D[metric[[Rho, Nu]], coord[[Lambda]]] +
D[metric[[Rho, Lambda]], coord[[Nu]]] -
D[metric[[Nu, Lambda]], coord[[Rho]]]),
{Rho, 1, n}], {Nu, 1, n}, {Lambda, 1, n}, {Mu, 1, n}]]
    listaffine :=
Table[If[UnsameQ[affine[[Nu, Lambda, Mu]], 0],
{Style[ Subsuperscript[\[CapitalGamma],
Row[{coord[[Nu]], coord[[Lambda]]}], coord[[Mu]]], 18],
Style[affine[[Nu, Lambda, Mu]], 14]}],
{Lambda, 1, n}, {Nu, 1, Lambda}, {Mu, 1, n}]
Null], 3],
TableSpacing -> {1, 2}]


But when I copy and paste the output from the code say $-\sin(\theta)\cos(\theta)$, the output options I get follow as this. As shown in the image I no longer have the options to carry out mathematical operations on the expression. What part of the code is causing this problems and how can the code be fixed such that I can have all the options shown in the first image?

  • $\begingroup$ What is metric, coord and inversemetric? My initial guess is that such behavior is caused by *Form wrappers that leave expressions in non-computable formats. $\endgroup$
    – Syed
    May 23, 2022 at 23:03
  • $\begingroup$ @Syed I have fiexed the post to define the metric coord and inversemetric. Is there a way I can modify the code to change thef orm just that is does leave an expression in a computable format? $\endgroup$
    – aygx
    May 23, 2022 at 23:13
  • $\begingroup$ Now you are missing r, \[Theta], \[CapitalPhi]? The code run as such throws recursion errors. Also in your post a and b show up in blue color which signifies that these are yet undefined. Please present a minimal working example that can be copied to notebooks. Same comment goes for Style showing up in a statement unless it is for presentation. Thanks. $\endgroup$
    – Syed
    May 23, 2022 at 23:18
  • $\begingroup$ What is meant my minimal working example? What type of example should I provide? $\endgroup$
    – aygx
    May 24, 2022 at 0:26
  • 1
    $\begingroup$ Your problem arises frim using Style[...]. Eliminate these. $\endgroup$ May 24, 2022 at 8:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.