;;; ;;; Polar coordinates ;;; (define \$x [|r θ|]) (define \$X [|(* r (cos θ)) ; = x (* r (sin θ)) ; = y |]) ;; ;; Local coordinates ;; (define \$e ((∂/∂ X_# \$) x~#)) e ;[| [| (cos θ) (sin θ) |] [| (* -1 r (sin θ)) (* r (cos θ)) |] |] ;; ;; Metric tensor ;; (define \$g__ (generate-tensor 2#(V.* e_%1 e_%2) {2 2})) (define \$g~~ (with-symbols {i j} (/ (unit-tensor {2 2})_i_j g_i_j))) g_#_#;[| [| 1 0 |] [| 0 r^2 |] |]_#_# g~#~#;[| [| 1 0 |] [| 0 (/ 1 r^2) |] |]~#~# ;; ;; 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)))))) Γ_#_#_#;(tensor {2 2 2} {0 0 0 (* -1 r) 0 r r 0} )_#_#_# Γ_1_#_#;[| [| 0 0 |] [| 0 (* -1 r) |] |]_#_# Γ_2_#_#;[| [| 0 r |] [| r 0 |] |]_#_# ;; ;; Christoffel symbols of the second kind ;; (define \$Γ~__ (with-symbols {i j k l} (. g~i~j Γ_j_k_l))) Γ~#_#_#;(tensor {2 2 2} {0 0 0 (* -1 r) 0 (/ 1 r) (/ 1 r) 0} )~#_#_# Γ~1_#_#;[| [| 0 0 |] [| 0 (* -1 r) |] |]_#_# Γ~2_#_#;[| [| 0 (/ 1 r) |] [| (/ 1 r) 0 |] |]_#_# ;; ;; Derive Laplacian ;; (. g~i~j (∂/∂ (∂/∂ (f r θ) x~j) x~i)) ;(/ (+ (* (f|1|1 r θ) r^2) (f|2|2 r θ)) r^2) (. (. g~i~j Γ~k_i_j) (∂/∂ (f r θ) x~k)) ;(/ (* -1 (f|1 r θ)) r) (define \$Laplacian (- (. g~i~j (∂/∂ (∂/∂ (f r θ) x~j) x~i)) (. (. g~i~j Γ~k_i_j) (∂/∂ (f r θ) x~k)))) Laplacian ;(/ (+ (* (f|1|1 r θ) r^2) (f|2|2 r θ) (* (f|1 r θ) r)) r^2)