;;; Parameters and metrics (define \$N 3) (define \$params [| x y z |]) (define \$g__ [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |]) (define \$g~~ (M.inverse g_#_#)) ;;; Hodge Laplacian (define \$d (lambda [%X] !((flip ∂/∂) params X))) (define \$hodge (lambda [%A] (let {[\$k (df-order A)]} (with-symbols {i j} (* (sqrt (abs (M.det g_#_#))) (foldl . (. (ε' N k)_[i_1]..._[i_N] A..._[j_1]..._[j_k]) (map 1#g~[i_%1]~[j_%1] (between 1 k)))))))) (define \$δ (lambda [%A] (let {[\$r (df-order A)]} (* (** -1 (+ (* N r) 1)) (hodge (d (hodge A))))))) (define \$Δ (lambda [%A] (match (df-order A) integer {[,0 (δ (d A))] [,3 (d (δ A))] [_ (+ (d (δ A)) (δ (d A)))]}))) (define \$ux (function [t x y z])) (define \$uy (function [t x y z])) (define \$uz (function [t x y z])) (define \$u [| ux uy uz |]) (Δ u) ;[| (+ ux|x|x ux|z|z ux|y|y) (+ uy|y|y uy|z|z uy|x|x) (+ uz|z|z uz|y|y uz|x|x) |] (define \$vx (function [t x y z])) (define \$vy (function [t x y z])) (define \$vz (function [t x y z])) (define \$v [|[| 0 vz (* -1 vy) |] [| (* -1 vz) 0 vx |] [| vy (* -1 vx) 0 |]|]) (df-normalize (Δ v)) ;[| [| 0 (+ vz|x|x vz|z|z vz|y|y) (+ (* -1 vy|x|x) (* -1 vy|y|y) (* -1 vy|z|z)) |] [| (+ (* -1 vz|y|y) (* -1 vz|x|x) (* -1 vz|z|z)) 0 (+ vx|y|y vx|x|x vx|z|z) |] [| (+ vy|z|z vy|x|x vy|y|y) (+ (* -1 vx|z|z) (* -1 vx|y|y) (* -1 vx|x|x)) 0 |] |]