;;; Parameters (define \$x [| θ φ |]) (define \$X [|(* r (sin θ) (cos φ)) ; = x (* r (sin θ) (sin φ)) ; = y (* r (cos θ)) ; = z |]) ;;; Local basis (define \$e ((flip ∂/∂) x~# X_#)) e ;[|[|(* r (cos θ) (cos φ)) (* r (cos θ) (sin φ)) (* -1 r (sin θ)) |] ; [|(* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ)) 0 |] ; |]_#~# ;;; Metric tensor (define \$g__ (generate-tensor 2#(V.* e_%1 e_%2) {2 2})) (define \$g~~ (M.inverse g_#_#)) g_#_#;[| [| r^2 0 |] [| 0 (* r^2 (sin θ)^2) |] |]_#_# g~#~#;[| [| (/ 1 r^2) 0 |] [| 0 (/ 1 (* r^2 (sin θ)^2)) |] |]~#~# ;;; Christoffel symbols (define \$Γ_j_k_l (* (/ 1 2) (+ (∂/∂ g_j_l x~k) (∂/∂ g_j_k x~l) (* -1 (∂/∂ g_k_l x~j))))) (define \$Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#))) ;;; Connection form (define \$d (lambda [%A] !((flip ∂/∂) x A))) (define \$ω0 Γ~#_#_#) ω0~#_#_1;[| [| 0 0 |] [| 0 (/ (cos θ) (sin θ)) |] |]~#_# ω0~#_#_2;[| [| 0 (* -1 (sin θ) (cos θ)) |] [| (/ (cos θ) (sin θ)) 0 |] |]~#_# (define \$A [|[| (/ 1 r) 0 |] [| 0 (/ 1 (* r (sin θ))) |]|]) (define \$ω (+ (. (M.inverse A)~i_j ω0~j_k A~k_l) (. (M.inverse A)~i_j (d A~j_l)))) ω~#_#_1;[| [| 0 0 |] [| 0 0 |] |]~#_# ω~#_#_2;[| [| 0 (* -1 (cos θ)) |] [| (cos θ) 0 |] |]~#_# ;;; Curvature form (define \$wedge (lambda [%X %Y] !(. X Y))) (define \$Ω (with-symbols {i j k} (df-normalize (+ (d ω~i_j) (wedge ω~i_k ω~k_j))))) Ω~#_#_1_2;[| [| 0 (sin θ) |] [| (* -1 (sin θ)) 0 |] |]~#_# Ω~#_#_2_1;[| [| 0 (* -1 (sin θ)) |] [| (sin θ) 0 |] |]~#_# Ω~1_2;[| [| 0 (sin θ) |] [| (* -1 (sin θ)) 0 |] |] Ω~2_1;[| [| 0 (* -1 (sin θ)) |] [| (sin θ) 0 |] |] ;;; Euler form (define \$euler-form (* (/ 1 (* 2 π)) (- Ω~1_2 Ω~2_1))) euler-form;[| [| 0 (/ (sin θ) (* 2 π)) |] [| (/ (* -1 (sin θ)) (* 2 π)) 0 |] |] ; χ(S^2) = ∫ dθ dφ (/ (sin θ) (* 2 π)) = ∫ dθ (sin θ) ; = [ (* -1 (cos θ)) ] 0-π = (cos 0) - (cos π) = 2