;;; Parameters (define \$x [| θ φ |]) (define \$X [|(* '(+ (* a (cos θ)) b) (cos φ)) ; = x (* '(+ (* a (cos θ)) b) (sin φ)) ; = y (* a (sin θ)) ; = z |]) ;;; Local basis (define \$e ((flip ∂/∂) x~# X_#)) e ;[|[| (* -1 a (sin θ) (cos φ)) (* -1 a (sin θ) (sin φ)) (* a (cos θ)) |] ; [| (* -1 '(+ (* a (cos θ)) b) (sin φ)) (* '(+ (* a (cos θ)) b) (cos φ)) 0 |] ; |]~#~# ;;; Metric tensor (define \$g__ (generate-tensor 2#(V.* e_%1 e_%2) {2 2})) (define \$g~~ (M.inverse g_#_#)) g_#_#;[| [| a^2 0 |] [| 0 '(+ (* a (cos θ)) b)^2 |] |]_#_# g~#~#;[| [| (/ 1 a^2) 0 |] [| 0 (/ 1 '(+ (* a (cos θ)) b)^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 (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) |] |]~#_# ω0~#_#_2;[| [| 0 (/ (* '(+ (* a (cos θ)) b) (sin θ)) a) |] [| (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) 0 |] |]~#_# (define \$A [|[| (/ 1 a) 0 |] [| 0 (/ 1 '(+ (* a (cos θ)) b)) |]|]) (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 (sin θ) |] [| (* -1 (sin θ)) 0 |] |]~#_# ;;; Curvature form (define \$wedge (lambda [%X %Y] !(. X Y))) (define \$Ω (with-symbols {i j} (df-normalize (+ (d ω~i_j) (wedge ω~i_k ω~k_j))))) Ω~#_#_1_2;[| [| 0 (cos θ) |] [| (* -1 (cos θ)) 0 |] |]~#_# Ω~#_#_2_1;[| [| 0 (* -1 (cos θ)) |] [| (cos θ) 0 |] |]~#_# Ω~1_2;[| [| 0 (cos θ) |] [| (* -1 (cos θ)) 0 |] |] Ω~2_1;[| [| 0 (* -1 (cos θ)) |] [| (cos θ) 0 |] |] ;;; Euler form (define \$euler-form (* (/ 1 (* 2 π)) (- Ω~1_2 Ω~2_1))) euler-form;[| [| 0 (/ (cos θ) (* 2 π)) |] [| (/ (* -1 (cos θ)) (* 2 π)) 0 |] |] ; χ(T^2) = ∫ dθ dφ (/ (cos θ) (* 2 π)) = ∫ dθ (cos θ) ; = [ (sin θ) ] 0-π = (sin π) - (sin 0) = 0