(define \$N 3) (define \$params [| x y z |]) (define \$g [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |]) (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 . (. A_[j_1]..._[j_k] (ε' N k)_[i_1]..._[i_N]) (map 1#g~[i_%1]~[j_%1] (between 1 k)))))))) (define \$dx [| 1 0 0 |]) (define \$dy [| 0 1 0 |]) (define \$dz [| 0 0 1 |]) (define \$ι (lambda [%X %Y] (with-symbols {i} (* (df-order Y) (. X...~i (df-normalize Y..._i)))))) (define \$Lie (lambda [%X %Y] (match (df-order Y) integer {[,0 (ι X (d Y))] [,N (d (ι X Y))] [_ (+ (ι X (d Y)) (d (ι X Y)))]}))) (define \$ρ (function [t x y z])) (define \$*ρ (df-normalize (hodge ρ))) (define \$u_ (generate-tensor 1#(function [t x y z]) {3})) (define \$u [| u_1 u_2 u_3 |]) (df-normalize (+ (∂/∂ *ρ t) (Lie u *ρ))) ;(tensor {3 3 3} {0 0 0 0 0 (/ (+ ρ|t (* u_1|x ρ) (* u_1 ρ|x) (* u_2|y ρ) (* u_2 ρ|y) (* u_3|z ρ) (* u_3 ρ|z)) 6) 0 (/ (+ (* -1 ρ|t) (* -1 u_1|x ρ) (* -1 u_1 ρ|x) (* -1 u_3|z ρ) (* -1 u_3 ρ|z) (* -1 u_2|y ρ) (* -1 u_2 ρ|y)) 6) 0 0 0 (/ (+ (* -1 ρ|t) (* -1 u_2|y ρ) (* -1 u_2 ρ|y) (* -1 u_1|x ρ) (* -1 u_1 ρ|x) (* -1 u_3|z ρ) (* -1 u_3 ρ|z)) 6) 0 0 0 (/ (+ ρ|t (* u_2|y ρ) (* u_2 ρ|y) (* u_3|z ρ) (* u_3 ρ|z) (* u_1|x ρ) (* u_1 ρ|x)) 6) 0 0 0 (/ (+ ρ|t (* u_3|z ρ) (* u_3 ρ|z) (* u_1|x ρ) (* u_1 ρ|x) (* u_2|y ρ) (* u_2 ρ|y)) 6) 0 (/ (+ (* -1 ρ|t) (* -1 u_3|z ρ) (* -1 u_3 ρ|z) (* -1 u_2|y ρ) (* -1 u_2 ρ|y) (* -1 u_1|x ρ) (* -1 u_1 ρ|x)) 6) 0 0 0 0 0} ) (df-normalize (+ (∂/∂ *ρ t) (Lie u *ρ)))_1_2_3 ;(/ (+ ρ|t ; (* u_1|x ρ) (* u_1 ρ|x) ; (* u_2|y ρ) (* u_2 ρ|y) ; (* u_3|z ρ) (* u_3 ρ|z)) ; 6)