egison-3.7.11: sample/math/geometry/riemann-curvature-tensor-of-empty-Schwarzschild-spacetime.egi
;;;
;;; Parameters
;;;
(define $x [|t r θ φ|])
;;
;; Metric tensor
;;
(define $g__
[|[| 1 0 0 0 |]
[| 0 -1 0 0 |]
[| 0 0 (* -1 r^2) 0 |]
[| 0 0 0 (* -1 r^2 (sin θ)^2) |]
|])
(define $g~~ (M.inverse g_#_#))
g~#~#
;[|[| 1 0 0 0 |]
; [| 0 -1 0 0 |]
; [| 0 0 (/ 1 (* -1 r^2)) 0 |]
; [| 0 0 0 (/ 1 (* -1 r^2 (sin θ)^2)) |]
; |]~#~#
(with-symbols {i j k} (. g~i~j g_j_k))
;[| [| 1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |]
;;
;; Christoffel symbols of the first kind
;;
(define $Γ___
(with-symbols {j k l}
(* (/ 1 2)
(+ (∂/∂ g_j_l x~k)
(∂/∂ g_j_k x~l)
(* -1 (∂/∂ g_k_l x~j))))))
Γ_1_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#
Γ_2_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 r 0 |] [| 0 0 0 (* r (sin θ)^2) |] |]_#_#
Γ_3_#_#;[| [| 0 0 0 0 |] [| 0 0 (* -1 r) 0 |] [| 0 (* -1 r) 0 0 |] [| 0 0 0 (* r^2 (sin θ) (cos θ)) |] |]_#_#
Γ_4_#_#;[| [| 0 0 0 0 |] [| 0 0 0 (* -1 r (sin θ)^2) |] [| 0 0 0 (* -1 r^2 (sin θ) (cos θ)) |] [| 0 (* -1 r (sin θ)^2) (* -1 r^2 (sin θ) (cos θ)) 0 |] |]_#_#
;;
;; Christoffel symbols of the second kind
;;
(define $Γ~__
(with-symbols {i j k l}
(. g~i~j Γ_j_k_l)))
Γ~1_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |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