packages feed

egison-3.7.11: sample/math/geometry/riemann-curvature-tensor-of-spherical-space.egi

;;;
;;; Parameters
;;;

(define $x [|r θ φ|])

;;
;; Metric tensor
;;

(define $g__
  [|[| 1 0 0 |]
    [| 0 r^2 0 |]
    [| 0 0 (* r^2 (sin θ)^2) |]
    |])

(define $g~~ (M.inverse g_#_#))
g~#~#
;[|[| 1 0 0 |]
;  [| 0 (/ 1 r^2) 0 |]
;  [| 0 0 (/ 1 (* r^2 (sin θ)^2)) |]|]~#~#

(with-symbols {i j k} (. g~i~j g_j_k))
;[| [| 1 0 0 |] [| 0 1 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 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#
Γ_2_#_#;[| [| 0 r 0 |] [| r 0 0 |] [| 0 0 (* -1 r^2 (sin θ) (cos θ)) |] |]_#_#
Γ_3_#_#;[| [| 0 0 (* r (sin θ)^2) |] [| 0 0 (* r^2 (sin θ) (cos θ)) |] [| (* r (sin θ)^2) (* 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 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#
Γ~2_#_#;[| [| 0 (/ 1 r) 0 |] [| (/ 1 r) 0 0 |] [| 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#
Γ~3_#_#;[| [| 0 0 (/ 1 r) |] [| 0 0 (/ (cos θ) (sin θ)) |] [| (/ 1 r) (/ (cos θ) (sin θ)) 0 |] |]_#_#

;;
;; Riemann curvature tensor
;;

(define $R~i_j_k_l
  (with-symbols {m}
    (+ (- (∂/∂ Γ~i_j_l x~k) (∂/∂ Γ~i_j_k x~l))
       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))

R~#_#_#_#;(tensor {3 3 3 3} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )~#_#_#_#