packages feed

egison 3.7.7 → 3.7.8

raw patch · 72 files changed

+4115/−2 lines, 72 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

egison.cabal view
@@ -1,5 +1,5 @@ Name:                egison-Version:             3.7.7+Version:             3.7.8 Synopsis:            Programming language with non-linear pattern-matching against non-free data Description:   An interpreter for Egison, a **pattern-matching-oriented**, purely functional programming language.@@ -60,7 +60,7 @@ Extra-Source-Files:  benchmark/Benchmark.hs  Data-files:          lib/core/*.egi lib/math/*.egi lib/math/common/*.egi lib/math/algebra/*.egi lib/math/analysis/*.egi lib/math/geometry/*.egi-                     sample/*.egi sample/io/*.egi+                     sample/*.egi sample/io/*.egi sample/math/algebra/*.egi sample/math/analysis/*.egi sample/math/geometry/*.egi sample/math/number/*.egi sample/math/others/*.egi                      elisp/egison-mode.el  source-repository head
hs-src/Language/Egison/Types.hs view
@@ -1822,3 +1822,9 @@ isHash' (Intermediate (IIntHash _)) = return $ Value $ Bool True isHash' (Intermediate (IStrHash _)) = return $ Value $ Bool True isHash' _ = return $ Value $ Bool False++readUTF8File :: FilePath -> (IO String)+readUTF8File name = do+  h <- openFile name ReadMode+  hSetEncoding h utf8+  hGetContents h
+ sample/math/algebra/cubic-equation.egi view
@@ -0,0 +1,45 @@+(define $cubic-formula c-f)++(define $c-f+  (lambda [$f $x]+    (match (coefficients f x) (list math-expr)+      {[<cons $a_0 <cons $a_1 <cons $a_2 <cons $a_3 <nil>>>>>+        (c-f' a_3 a_2 a_1 a_0)]})))++(define $c-f'+  (lambda [$a $b $c $d]+    (match [a b c d] [math-expr math-expr math-expr math-expr]+      {[[,1 ,0 $p $q]+        (let {[[$s1 $s2] (2#[(rt 3 %1) (rt 3 %2)] (q-f' 1 (* 27 q) (* -27 p^3)))]}+          [(/ (+ s1 s2) 3)               ; r1+           (/ (+ (* w^2 s1) (* w s2)) 3) ; r2+           (/ (+ (* w s1) (* w^2 s2)) 3) ; r3+           ])]+       [[,1 _ _ _]+        (3#[(- %1 (/ b 3)) (- %2 (/ b 3)) (- %3 (/ b 3))]+           (with-symbols {x y}+             (c-f (substitute {[x (- y (/ b 3))]} (+ x^3 (* b x^2) (* c x) d)) y)))]+       [[_ _ _ _] (c-f' 1 (/ b a) (/ c a) (/ d a))]})))++(define $w (/ (+ -1 (* i (sqrt 3))) 2))++(* (- x 1) (- x 2) (- x 3))+;=>(+ x^3 (* -6 x^2) (* 11 x) -6)++(c-f (+ x^3 (* -6 x^2) (* 11 x) -6) x)+;=>[2 1 3]++(3#%1 (c-f (+ x^3 (* p x) q) x))+;=>+;(/ (+ (rt 3 (+ (* -108 q)+;               (* 12 (sqrt (+ (* 81 q^2) (* 12 p^3))))))+;      (rt 3 (+ (* -108 q)+;               (* -12 (sqrt (+ (* 81 q^2) (* 12 p^3)))))))+;   6)++(3#%1 (c-f (+ (* a x^3) (* b x^2) (* c x) d) x))+;=>+;(/ (+ (* (rt 3 (/ (+ (* -108 d a^3) (* 36 c b a^2) (* -8 b^3 a) (* 12 (sqrt (+ (* 81 a^6 d^2) (* -54 a^5 d c b) (* 12 a^4 d b^3) (* -3 a^4 c^2 b^2) (* 12 a^5 c^3))))) a^4)) a)+;      (* (rt 3 (/ (+ (* -108 d a^3) (* 36 c b a^2) (* -8 b^3 a) (* -12 (sqrt (+ (* 81 a^6 d^2) (* -54 a^5 d c b) (* 12 a^4 d b^3) (* -3 a^4 c^2 b^2) (* 12 a^5 c^3))))) a^4)) a)+;      (* -2 b))+;    (* 6 a))
+ sample/math/algebra/quadratic-equation.egi view
@@ -0,0 +1,36 @@+(define $quadratic-formula q-f)++(define $q-f+  (lambda [$f $x]+    (match (coefficients f x) (list math-expr)+      {[<cons $a_0 <cons $a_1 <cons $a_2 <nil>>>>+        (q-f' a_2 a_1 a_0)]})))++(define $q-f'+  (lambda [$a $b $c]+    (match [a b c] [math-expr math-expr math-expr]+      {[[,1 ,0 _]+        [(sqrt (* -1 c)) (* -1 (sqrt (* -1 c)))]]+       [[,1 _ _]+        (2#[(+ (* -1 (/ b 2)) %1) (+ (* -1 (/ b 2)) %2)]+           (with-symbols {x y}+             (q-f (substitute {[x (- y (/ b 2))]} (+ x^2 (* b x) c)) y)))]+       [[_ _ _] (q-f' 1 (/ b a) (/ c a))]})))+++(q-f (+ x^2 x 1) x)+;=>+;[(/ (+ -1 (* i (sqrt 3))) 2)+; (/ (+ -1 (* -1 i (sqrt 3))) 2)]++(q-f (+ (* a x^2) (* b x) c) x)+;=>+;[(/ (+ (* -1 b) (sqrt (+ b^2 (* -4 c a))))+;    (* 2 a))+; (/ (+ (* -1 b) (* -1 (sqrt (+ b^2 (* -4 c a)))))+;    (* 2 a))]++(q-f (+ (* a x^2) (* 2 b x) c) x)+;=>+;[(/ (+ (* -1 b) (sqrt (+ b^2 (* -1 c a)))) a)+; (/ (+ (* -1 b) (* -1 (sqrt (+ b^2 (* -1 c a))))) a)]
+ sample/math/algebra/quartic-equation.egi view
@@ -0,0 +1,34 @@+(define $quartic-formula qt-f)++(define $qt-f+  (lambda [$f $x]+    (match (coefficients f x) (list math-expr)+      {[<cons $a_0 <cons $a_1 <cons $a_2 <cons $a_3 <cons $a_4 <nil>>>>>>+        (qt-f' a_4 a_3 a_2 a_1 a_0)]})))++(define $qt-f'+  (lambda [$a $b $c $d $e]+    (match [a b c d e] [math-expr math-expr math-expr math-expr math-expr]+      {[[,1 ,0 $p ,0 $q]+        (let* {[[$s1 $s2] (q-f' 1 p q)]+               [[$r1 $r2] (q-f' 1 0 (* -1 s1))]+               [[$r3 $r4] (q-f' 1 0 (* -1 s2))]}+          [r1 r2 r3 r4])]+       [[,1 ,0 $p $q $r]+        (let* {[$u (3#%1 (with-symbols {u} (c-f (+ (* u (+ p u)^2) (* -4 r u) (* -1 q^2)) u)))]+               [[$r1 $r2] (q-f (+ y^2 (/ (+ p u) 2) (* (sqrt u) (- y (/ q (* 2 u))))) y)]+               [[$r3 $r4] (q-f (+ y^2 (/ (+ p u) 2) (* -1 (sqrt u) (- y (/ q (* 2 u))))) y)]}+          [r1 r2 r3 r4])]+       [[,1 _ _ _ _]+        (4#[(- %1 (/ b 4)) (- %2 (/ b 4)) (- %3 (/ b 4)) (- %4 (/ b 4))]+           (with-symbols {x y}+             (qt-f (substitute {[x (- y (/ b 4))]} (+ x^4 (* b x^3) (* c x^2) (* d x) e)) y)))]+       [[_ _ _ _ _] (qt-f' 1 (/ b a) (/ c a) (/ d a) (/ e a))]})))++(define $w (/ (+ -1 (* i (sqrt 3))) 2))++(* (- x 1) (- x 2) (- x 3) (- x 4))+;=>(+ x^4 (* -10 x^3) (* 35 x^2) (* -50 x) 24)++(qt-f (+ x^4 (* -10 x^3) (* 35 x^2) (* -50 x) 24) x)+;=>[4 1 3 2]
+ sample/math/algebra/quartic-formula.egi view
@@ -0,0 +1,28 @@+(define $quartic-formula qt-f)++(define $qt-f+  (lambda [$f $x]+    (match (coefficients f x) (list math-expr)+      {[<cons $a_0 <cons $a_1 <cons $a_2 <cons $a_3 <cons $a_4 <nil>>>>>>+        (qt-f' a_4 a_3 a_2 a_1 a_0)]})))++(define $qt-f'+  (lambda [$a $b $c $d $e]+    (match [a b c d e] [math-expr math-expr math-expr math-expr math-expr]+      {[[,1 ,0 $p ,0 $q]+        (let* {[[$s1 $s2] (q-f' 1 p q)]+               [[$r1 $r2] (q-f' 1 0 (* -1 s1))]+               [[$r3 $r4] (q-f' 1 0 (* -1 s2))]}+          [r1 r2 r3 r4])]+       [[,1 ,0 $p $q $r]+        (let* {[$u '(3#%1 (with-symbols {u} (c-f (+ (* u (+ p u)^2) (* -4 r u) (* -1 q^2)) u)))]+               [[$r1 $r2] (q-f (+ y^2 (/ (+ p u) 2) (* (sqrt u) (- y (/ q (* 2 u))))) y)]+               [[$r3 $r4] (q-f (+ y^2 (/ (+ p u) 2) (* -1 (sqrt u) (- y (/ q (* 2 u))))) y)]}+          [r1 r2 r3 r4])]+       [[,1 _ _ _ _]+        (4#[(- %1 (/ b 4)) (- %2 (/ b 4)) (- %3 (/ b 4)) (- %4 (/ b 4))]+           (with-symbols {x y}+             (qt-f (substitute {[x (- y (/ b 4))]} (+ x^4 (* b x^3) (* c x^2) (* d x) e)) y)))]+       [[_ _ _ _ _] (qt-f' 1 (/ b a) (/ c a) (/ d a) (/ e a))]})))++;(define $w (/ (+ -1 (* i (sqrt 3))) 2))
+ sample/math/analysis/complex-analysis.egi view
@@ -0,0 +1,47 @@+;;;;;+;;;;; Complex Integration+;;;;;++(define $C1 (dSd x 0 a x))+(define $C2 (dSd y 0 b (* i (- a (* i y)))))++(define $C2' (dSd y 0 b (* i (* -1 (* i y)))))+(define $C1' (dSd x 0 a (- x (* i b))))++C1 ;=>(/ a^2 2)+C2 ;=>(/ (+ (* 2 i a b) b^2) 2)++C2';=>(/ b^2 2)+C1';=>(/ (+ a^2 (* -2 i b a)) 2)++(+ C1 C2);=>(/ (+ a^2 (* 2 i a b) b^2) 2)+(+ C2' C1');=>(/ (+ b^2 a^2 (* -2 i b a)) 2)++(- (+ C1 C2)+   (+ C2' C1'))+;=>(* 2 i a b)+++(define $D1 (dSd x 0 a x))+(define $D2 (dSd y 0 b (* i (+ a (* i y)))))++(define $D2' (dSd y 0 b (* i (* i y))))+(define $D1' (dSd x 0 a (+ x (* i b))))++D1 ;=>(/ a^2 2)+D2 ;=>(/ (+ (* 2 i a b) (* -1 b^2)) 2)++D2';=>(/ (* -1 b^2) 2)+D1';=>(/ (+ a^2 (* 2 i b a)) 2)++(- (+ D1 D2)+   (+ D2' D1'))+;=>0++(define $E (dSd t 0 (* 2 pi) (* r (** e (* -1 i t)) i r (** e (* i t)))))++E;=>(* 2 i r^2 pi)++(define $F (dSd t 0 (* 2 pi) (exp (* i t))))++F;=>0
+ sample/math/analysis/eulers-formula.egi view
@@ -0,0 +1,11 @@+(take 8 (taylor-expansion (** e (* i x)) x 0))+;{1 (* i x) (/ (* -1 x^2) 2) (/ (* -1 i x^3) 6) (/ x^4 24) (/ (* i x^5) 120) (/ (* -1 x^6) 720) (/ (* -1 i x^7) 5040)}++(take 8 (taylor-expansion (cos x) x 0))+;{1 0 (/ (* -1 x^2) 2) 0 (/ x^4 24) 0 (/ (* -1 x^6) 720) 0}++(take 8 (taylor-expansion (* i (sin x)) x 0))+;{0 (* i x) 0 (/ (* -1 i x^3) 6) 0 (/ (* i x^5) 120) 0 (/ (* -1 i x^7) 5040)}++(take 8 (map2 + (taylor-expansion (cos x) x 0) (taylor-expansion (* i (sin x)) x 0)))+;{1 (* i x) (/ (* -1 x^2) 2) (/ (* -1 i x^3) 6) (/ x^4 24) (/ (* i x^5) 120) (/ (* -1 x^6) 720) (/ (* -1 i x^7) 5040)}
+ sample/math/analysis/laplacian-hessian-jacobian.egi view
@@ -0,0 +1,33 @@+(define $parameters [| x y z |]) ++(define $∂ (∂/∂ $ parameters))++(∂_i [| x^2 y^2 z^2 |]_i)+;[| (* 2 x) (* 2 y) (* 2 z) |]_i++(∂_i [| x^2 y^2 z^2 |]_j)+;[| [| (* 2 x) 0 0 |] [| 0 (* 2 y) 0 |] [| 0 0 (* 2 z) |] |]_i_j++(define $Δ+  (lambda [%f]+    (with-symbols {i}+      (contract + (∂~i (∂_i f))))))++(define $Hessian+  (lambda [%f]+    (with-symbols {i j}+      (∂_i (∂_j f)))))++(define $Jacobian+  (lambda [%v]+    (with-symbols {i j}+      (M.det (∂_i v_j)))))++(Δ (+ x^2 y^2 z^2))+;6++(Hessian (+ x^2 y^2 z^2))+;[| [| 2 0 0 |] [| 0 2 0 |] [| 0 0 2 |] |]++(Jacobian [| x^2 y^2 z^2 |])+;(* 8 x y z)
+ sample/math/analysis/leibniz-formula.egi view
@@ -0,0 +1,41 @@+(define $f (lambda [$x] x))++(define $multSd+  (lambda [$x $f $G]+    (let {[$F (Sd x f)]}+      (- (* F G)+         (Sd x (* f (d/d G x)))))))++(multSd x (cos x) (f x));(+ (* (sin x) x) (* -1 (sin x)))+(multSd x (cos (* 2 x)) (f x));(/ (+ (* 2 (sin (* 2 x)) x) (* -2 (sin (* 2 x)))) 4)+(multSd x (cos (* n x)) (f x));(/ (+ (* (sin (* n x)) x n) (* -1 (sin (* n x)) n)) n^2)++(multSd x (sin x) (f x));(+ (* -1 (cos x) x) (cos x))+(multSd x (sin (* 2 x)) (f x));(/ (+ (* -1 (cos (* 2 x)) x) (cos (* 2 x))) 2)+(multSd x (sin (* n x)) (f x));(/ (+ (* -1 (cos (* n x)) x) (cos (* n x))) n)+++(define $as (map (lambda [$n] (let {[$F (multSd x (cos (* n x)) (f x))]}+                                (/ (- (substitute {[x π]} F) (substitute {[x (* -1 π)]} F))+                                   π)))+                 nats))+(take 10 as)+;{0 0 0 0 0 0 0 0 0 0}++(define $bs (map (lambda [$n] (let {[$F (multSd x (sin (* n x)) (f x))]}+                                (/ (- (substitute {[x π]} F) (substitute {[x (* -1 π)]} F))+                                   π)))+                 (take 10 nats)))+(take 10 bs)+;{2 -1 (/ 2 3) (/ -1 2) (/ 2 5) (/ -1 3) (/ 2 7) (/ -1 4) (/ 2 9) (/ -1 5)}++(define $f' (map (lambda [$k $b] (* b (sin (* k x)))) (zip nats bs)))++(take 10 f')+;{(* 2 (sin x)) (* -1 (sin (* 2 x))) (/ (* 2 (sin (* 3 x))) 3) (/ (* -1 (sin (* 4 x))) 2) (/ (* 2 (sin (* 5 x))) 5) (/ (* -1 (sin (* 6 x))) 3) (/ (* 2 (sin (* 7 x))) 7) (/ (* -1 (sin (* 8 x))) 4) (/ (* 2 (sin (* 9 x))) 9) (/ (* -1 (sin (* 10 x))) 5)}++(take 10 (map (substitute {[x (/ π 2)]} $) f'))+;{2 0 (/ -2 3) 0 (/ 2 5) 0 (/ -2 7) 0 (/ 2 9) 0} ; = (/ pi 2)++(map (/ $ 2) (take 10 (map (substitute {[x (/ π 2)]} $) f')))+;{1 0 (/ -1 3) 0 (/ 1 5) 0 (/ -1 7) 0 (/ 1 9) 0} ; = (/ pi 4)
+ sample/math/analysis/order-of-partial-derivative.egi view
@@ -0,0 +1,13 @@+(define $f+  (lambda [$x $y $z]+    (/ (* x^5 y^3) z)))++(f x y z);(/ (* x^5 y^3) z)++(∂/∂x (f x y z));(/ (* 5 x^4 y^3) z)+(∂/∂y (∂/∂x (f x y z)));(/ (* 15 x^4 y^2) z)+(∂/∂z (∂/∂y (∂/∂x (f x y z))));(/ (* 15 x^4 y^2) z)++(∂/∂x (∂/∂y (∂/∂z (f x y z))));(/ (* 15 x^4 y^2) z)+(∂/∂y (∂/∂z (∂/∂x (f x y z))));(/ (* 15 x^4 y^2) z)+(∂/∂z (∂/∂y (∂/∂x (f x y z))));(/ (* 15 x^4 y^2) z)
+ sample/math/analysis/vector-analysis.egi view
@@ -0,0 +1,112 @@+;;+;; Tensor Arithmetics+;;+(+ 1 [| 1 2 3 |])+;=>[|2 3 4|]++(+ [| 1 2 3 |] 1)+;=>[|2 3 4|]++(+ [| 1 2 3 |]_i [| 1 2 3 |]_i)+;=>[|2 4 6|]_i++(+ [| 10 20 30 |] [| 1 2 3 |])+;=>[| [| 11 12 13 |] [| 21 22 23 |] [| 31 32 33 |] |]++(+ [| 100 200 300 |]_i+   [|[| 1 2 3 |]+     [| 10 20 30 |]|]_j_i)+;=>[| [| 101 110 |] [| 202 220 |] [| 303 330 |] |]_i_j++(+ [|[| 11 12 |]+     [| 21 22 |]+     [| 31 32 |]|]_i_j+   [| 100 200 300 |]_i)+;=>[| [| 111 112 |] [| 221 222 |] [| 331 332 |] |]_i_j++(+ [| 100 200 300 |]_i+   [|[| 11 12 |]+     [| 21 22 |]+     [| 31 32 |]|]_i_j)+;=>[| [| 111 112 |] [| 221 222 |] [| 331 332 |] |]_i_j++;;+;; Derivative+;;+(∂/∂ (f x y z) x)+;=>(f_1 x y z)++(∂/∂ [| (f x) (g x) |] x)+;=>[| (f_1 x) (g_1 x) |]++(∂/∂ (f x y z) [| x y z |])+;=>[| (f_1 x y z) (f_2 x y z) (f_3 x y z) |]++([| (∂/∂ $ x) (∂/∂ $ y) |] (f x y))+;=>[| (f_1 x y) (f_2 x y) |]++([| (∂/∂ $ x) (∂/∂ $ y) |] [| (f x y) (g x y) |])+;=>[| [| (f_1 x y) (g_1 x y) |] [| (f_2 x y) (g_2 x y) |] |]++;;+;; Nabla+;;+(define $∇ ∂/∂)++(∇ (f x y) [| x y |])+;=>[| (f_1 x y) (f_2 x y) |]++(∇ [| (f x y) (g x y) |] [| x y |])+;=>[| [| (f_1 x y) (f_2 x y) |] [| (g_1 x y) (g_2 x y) |] |]++;;+;; Contraction+;;+(contract + (* [|1 2 3|]~i [|10 20 30|]_i))+;=>+140++(define $trace (lambda [%t] (with-symbols {i} (contract + t~i_i))))++(trace [|[|10 20 30|] [|20 40 60|] [|30 60 90|]|])+;=>+140++;;+;; Divergence+;;+(define $div (compose ∇ (trace $)))++(div [| (f x y z) (g x y z) (h x y z) |] [| x y z |])+;=>(+ (f_1 x y z) (g_2 x y z) (h_3 x y z))++;;+;; Taylor Expansion+;;+(define $taylor-expansion+  (lambda [%f %xs %as]+    (with-symbols {h}+      (let {[$hs (generate-tensor 1#h_%1 (tensor-size xs))]}+        (map2 *+              (map 1#(/ 1 (fact %1)) nats0)+              (map (compose (V.substitute xs as $)+                            (V.substitute hs (with-symbols {i} (- xs_i as_i)) $))+                   (iterate (compose (∇ $ xs) (V.* hs $)) f)))))))++(take 3 (taylor-expansion (f x) x 0))+;=>+;{(f 0)+; (* x (f_1 0))+; (/ (* x^2 (f_1_1 0))+;    2)}++(take 3 (taylor-expansion (f x y) [| x y |] [| 0 0 |]))+;=>+;{(f 0 0)+; (+ (* x (f_1 0 0))+;    (* y (f_2 0 0)))+; (/ (+ (* x^2 (f_1_1 0 0))+;       (* x y (f_2_1 0 0))+;       (* y x (f_1_2 0 0))+;       (* y^2 (f_2_2 0 0)))+;    2)}
+ sample/math/geometry/curvature-form.egi view
@@ -0,0 +1,54 @@+;;; Parameters and Metric tensor++(define $x [| θ φ |])++(define $g__ [| [| r^2 0 |] [| 0 (* r^2 (sin θ)^2) |] |])+(define $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_#_#)))++;;; Riemann curvature tensor++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (sin θ)^2 |] [| -1 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (* -1 (sin θ)^2) |] [| 1 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]~#_#++;;; Connection form++(define $ω Γ~#_#_#)++;;; Curvature form++(define $d+  (lambda [%A]+    !((flip ∂/∂) x A)))++(define $wedge+  (lambda [%X %Y]+    !(. X Y)))++(define $Ω+  (with-symbols {i j}+    (df-normalize (+ (d ω~i_j)+                     (wedge ω~i_k ω~k_j)))))++Ω~#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]~#_#+Ω~#_#_1_2;[| [| 0 (/ (sin θ)^2 2) |] [| (/ -1 2) 0 |] |]~#_#+Ω~#_#_2_1;[| [| 0 (/ (* -1 (sin θ)^2) 2) |] [| (/ 1 2) 0 |] |]~#_#+Ω~#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]~#_#++
+ sample/math/geometry/curvature.egi view
@@ -0,0 +1,45 @@+(define $d/dt (d/d $ t))++(define $ds/dt (sqrt (+ (d/dt (x t))^2 (d/dt (y t))^2)))++ds/dt;(sqrt (+ (x' t)^2 (y' t)^2))++(define $dt/ds (/ 1 ds/dt))++dt/ds;(/ 1 (sqrt (+ (x' t)^2 (y' t)^2)))++(define $e1 [(* (d/dt (x t)) dt/ds)+             (* (d/dt (y t)) dt/ds)])++e1+;[(/ (x' t)+;    (sqrt (+ (x' t)^2 (y' t)^2)))+; (/ (y' t)+;    (sqrt (+ (x' t)^2 (y' t)^2)))]++(define $e2 [(* -1 (d/dt (y t)) dt/ds)+             (* (d/dt (x t)) dt/ds)])++e2+;[(/ (* -1 (y' t))+;    (sqrt (+ (x' t)^2 (y' t)^2)))+; (/ (x' t)+;    (sqrt (+ (x' t)^2 (y' t)^2)))]++(define $de1/ds [(* (d/dt (fst e1)) dt/ds)+                 (* (d/dt (snd e1)) dt/ds)])++de1/ds+;[(/ (+ (* (y' t)^2 (x'' t))+;       (* -1 (y' t) (y'' t) (x' t)))+;    (+ (x' t)^4 (* 2 (y' t)^2 (x' t)^2) (y' t)^4))+; (/ (+ (* (x' t)^2 (y'' t))+;       (* -1 (x' t) (x'' t) (y' t)))+;    (+ (x' t)^4 (* 2 (y' t)^2 (x' t)^2) (y' t)^4))]++(define $K (/ (fst de1/ds) (fst e2)))++K+;(/ (+ (* (y' t) (x'' t) (sqrt (+ (x' t)^2 (y' t)^2)))+;      (* -1 (y'' t) (x' t) (sqrt (+ (x' t)^2 (y' t)^2))))+;   (+ (* -1 (x' t)^4) (* -2 (y' t)^2 (x' t)^2) (* -1 (y' t)^4)))
+ sample/math/geometry/euler-form-of-S2.egi view
@@ -0,0 +1,74 @@+;;; 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}+    (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
+ sample/math/geometry/euler-form-of-T2.egi view
@@ -0,0 +1,74 @@+;;; 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
+ sample/math/geometry/exterior-derivative.egi view
@@ -0,0 +1,13 @@+(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)))++(d (f x y z))+;[| (f|1 x y z) (f|2 x y z) (f|3 x y z) |]++(df-normalize (d (d (f x y z))))+;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 0 |] |]
+ sample/math/geometry/hodge-E3.egi view
@@ -0,0 +1,22 @@+(define $N 3)+(define $params [| x y z |])+(define $g [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |])++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 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 |])++(hodge dx)+;[| [| 0 0 0 |] [| 0 0 1 |] [| 0 0 0 |] |] = (wedge dy dz)++(hodge (wedge dx dy))+;[| 0 0 1 |] = dz
+ sample/math/geometry/hodge-Minkowski.egi view
@@ -0,0 +1,25 @@+(define $N 4)+(define $params [| t x y z |])+(define $g [| [| -1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |])++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (map 1#g~[i_%1]~[j_%1] (between 1 k))))))))++(define $dt [| 1 0 0 0 |])+(define $dx [| 0 1 0 0 |])+(define $dy [| 0 0 1 0 |])+(define $dz [| 0 0 0 1 |])++(hodge (wedge dt dx))+;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 -1 |] [| 0 0 0 0 |] |]+;= (* -1 (wedge dy dz))++(hodge (wedge dy dz))+;[| [| 0 1 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]+;= (wedge dt dx)
+ sample/math/geometry/hodge-laplacian-polar.egi view
@@ -0,0 +1,39 @@+;;; Parameters and metrics++(define $N 2)++(define $x [|r θ|])++(define $g__ [| [| 1 0 |] [| 0 r^2 |] |])+(define $g~~ (M.inverse g_#_#))++;;; Hodge Laplacian++(define $d+  (lambda [%X]+    !((flip ∂/∂) x X)))++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (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))]+       [,2 (d (δ A))]+       [_ (+ (d (δ A)) (δ (d A)))]})))++(Δ (f r θ))+;(/ (+ (* -1 (f|2|2 r θ)) (* -1 r (f|1 r θ)) (* -1 r^2 (f|1|1 r θ))) r^2)
+ sample/math/geometry/hodge-laplacian-spherical.egi view
@@ -0,0 +1,46 @@+;;; Parameters and metrics++(define $N 3)++(define $x [|r θ φ|])++(define $g__ [| [| 1 0 0 |] [| 0 r^2 0 |] [| 0 0 (* r^2 (sin θ)^2) |] |])+(define $g~~ (M.inverse g_#_#))++;;; Hodge Laplacian++(define $d+  (lambda [%X]+    !((flip ∂/∂) x X)))++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (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))]+       [,N (d (δ A))]+       [_ (+ (d (δ A)) (δ (d A)))]})))++(Δ (f r θ φ))+;(/ (+ (f|3|3 r θ φ) (* (sin θ) (cos θ) (f|2 r θ φ)) (* (sin θ)^2 (f|2|2 r θ φ)) (* 2 r (sin θ)^2 (f|1 r θ φ)) (* r^2 (sin θ)^2 (f|1|1 r θ φ))) (* (sin θ)^2 r^2))+;=+;(/ (+ (* r^2 (sin θ)^2 (f|1|1 r θ φ))+;      (* 2 r (sin θ)^2 (f|1 r θ φ))+;      (* (sin θ) (cos θ) (f|2 r θ φ))+;      (* (sin θ)^2 (f|2|2 r θ φ))+;      (f|3|3 r θ φ))+;   (* (sin θ)^2 r^2))
+ sample/math/geometry/hodge-laplacian.egi view
@@ -0,0 +1,43 @@+;;; Parameters and metrics++(define $N 2)++(define $params [|x y|])++(define $g__ [| [| (G_1_1 x y) (G_1_2 x y) |] [| (G_2_1 x y) (G_2_2 x y) |] |])+(define $g~~ [| [| (G~1~1 x y) (G~1~2 x y) |] [| (G~2~1 x y) (G~2~2 x y) |] |])++;;; 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 . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (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))]+       [,2 (d (δ A))]+       [_ (+ (d (δ A)) (δ (d A)))]})))++(d (f x y))+(hodge (d (f x y)))+(d (hodge (d (f x y))))+(δ (d (f x y)))+(Δ (f x y))+;
+ sample/math/geometry/polar-laplacian-2d-2.egi view
@@ -0,0 +1,68 @@+;;;+;;; 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)
+ sample/math/geometry/polar-laplacian-2d-3.egi view
@@ -0,0 +1,38 @@+;;;+;;; 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) |] |]~#~#++;;+;; Derive Laplacian+;;++(define $sqrt-g (sqrt (M.det g_#_#)))+sqrt-g;r++(define $Laplacian (/ (contract + (∂/∂ (* sqrt-g (. g~i~j (∂/∂ (f r θ) x_j))) x_i)) sqrt-g))+Laplacian+;(/ (+ (* (f|1 r θ) r) (* r^2 (f|1|1 r θ)) (f|2|2 r θ)) r^2)
+ sample/math/geometry/polar-laplacian-2d.egi view
@@ -0,0 +1,39 @@+(define $x (* r (cos θ)))+(define $y (* r (sin θ)))++(define $u-r (∂/∂ (u x y) r))+u-r+;(+ (* (u|1 (* r (cos θ)) (* r (sin θ))) (cos θ))+;   (* (u|2 (* r (cos θ)) (* r (sin θ))) (sin θ)))++(define $u-r-r (∂/∂ (∂/∂ (u x y) r) r))+u-r-r+;(+ (* (u|1|1 (* r (cos θ)) (* r (sin θ))) (cos θ)^2)+;   (* (u|1|2 (* r (cos θ)) (* r (sin θ))) (sin θ) (cos θ))+;   (* (u|2|1 (* r (cos θ)) (* r (sin θ))) (cos θ) (sin θ))+;   (* (u|2|2 (* r (cos θ)) (* r (sin θ))) (sin θ)^2))++(define $u-θ (∂/∂ (u x y) θ))+u-θ+;(+ (* -1 (u|1 (* r (cos θ)) (* r (sin θ))) r (sin θ))+;   (* (u|2 (* r (cos θ)) (* r (sin θ))) r (cos θ)))++(define $u-θ-θ (∂/∂ (∂/∂ (u x y) θ) θ))+u-θ-θ+;(+ (* (u|1|1 (* r (cos θ)) (* r (sin θ))) r^2 (sin θ)^2)+;   (* -1 (u|1|2 (* r (cos θ)) (* r (sin θ))) r^2 (cos θ) (sin θ))+;   (* -1 (u|1 (* r (cos θ)) (* r (sin θ))) r (cos θ))+;   (* -1 (u|2|1 (* r (cos θ)) (* r (sin θ))) r^2 (sin θ) (cos θ))+;   (* (u|2|2 (* r (cos θ)) (* r (sin θ))) r^2 (cos θ)^2)+;   (* -1 (u|2 (* r (cos θ)) (* r (sin θ))) r (sin θ)))++(+ u-r-r (* (/ 1 (** r 2)) u-θ-θ))+;(/ (+ (* -1 (u|1 (* r (cos θ)) (* r (sin θ))) (cos θ))+;      (* -1 (u|2 (* r (cos θ)) (* r (sin θ))) (sin θ))+;      (* (u|1|1 (* r (cos θ)) (* r (sin θ))) r)+;      (* (u|2|2 (* r (cos θ)) (* r (sin θ))) r))+;   r)++(+ u-r-r (* (/ 1 r) u-r) (* (/ 1 (** r 2)) u-θ-θ))+;(+ (u|1|1 (* r (cos θ)) (* r (sin θ)))+;   (u|2|2 (* r (cos θ)) (* r (sin θ))))
+ sample/math/geometry/polar-laplacian-3d-2.egi view
@@ -0,0 +1,73 @@+;;;+;;; Spherical coordinates+;;;++(define $x [|r θ φ|])++(define $X [|(* r (sin θ) (cos φ)) ; = x+             (* r (sin θ) (sin φ)) ; = y+             (* r (cos θ))         ; = z+             |])++;;+;; Local coordinates+;;++(define $e ((∂/∂ X~# $) x_#))+e+;[|[| (* (sin θ) (cos φ)) (* (sin θ) (sin φ)) (cos θ) |]+;  [| (* 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) {3 3}))+(define $g~~ (with-symbols {i j} (/ (unit-tensor {3 3})_i_j g_i_j)))++g_#_#;[| [| 1 0 0 |] [| 0 r^2 0 |] [| 0 0 (* r^2 (sin θ)^2) |] |]_#_#+g~#~#;[| [| 1 0 0 |] [| 0 (/ 1 r^2) 0 |] [| 0 0 (/ 1 (* r^2 (sin θ)^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 {3 3 3} {0 0 0 0 (* -1 r) 0 0 0 (* -1 r (sin θ)^2) 0 r 0 r 0 0 0 0 (* -1 r^2 (sin θ) (cos θ)) 0 0 (* r (sin θ)^2) 0 0 (* r^2 (sin θ) (cos θ)) (* r (sin θ)^2) (* r^2 (sin θ) (cos θ)) 0} )_#_#_#+Γ_1_#_#;[| [| 0 0 0 |] [| 0 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#+Γ_2_#_#;[| [| 0 r 0 |] [| r 0 0 |] [| 0 0 (* -1 r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_3_#_#;[| [| 0 0 (* r (sin θ)^2) |] [| 0 0 (* r^2 (sin θ) (cos θ)) |] [| (* r (sin θ)^2) (* r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~#_#_#;(tensor {3 3 3} {0 0 0 0 (* -1 r) 0 0 0 (* -1 r (sin θ)^2) 0 (/ 1 r) 0 (/ 1 r) 0 0 0 0 (* -1 (sin θ) (cos θ)) 0 0 (/ 1 r) 0 0 (/ (cos θ) (sin θ)) (/ 1 r) (/ (cos θ) (sin θ)) 0} )~#_#_#+Γ~1_#_#;[| [| 0 0 0 |] [| 0 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ 1 r) 0 |] [| (/ 1 r) 0 0 |] [| 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~3_#_#;[| [| 0 0 (/ 1 r) |] [| 0 0 (/ (cos θ) (sin θ)) |] [| (/ 1 r) (/ (cos θ) (sin θ)) 0 |] |]_#_#++;;+;; Laplacian+;;++(. g~i~j (∂/∂ (∂/∂ (f r θ φ) x_j) x_i))+;(/ (+ (* (f|1|1 r θ φ) r^2 (sin θ)^2) (* (f|2|2 r θ φ) (sin θ)^2) (f|3|3 r θ φ)) (* r^2 (sin θ)^2))+(. (. g~i~j Γ~k_i_j) (∂/∂ (f r θ φ) x_k))+;(/ (+ (* -2 (f|1 r θ φ) r (sin θ)) (* -1 (cos θ) (f|2 r θ φ))) (* r^2 (sin θ)))++(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 (sin θ)^2) (* (f|2|2 r θ φ) (sin θ)^2) (f|3|3 r θ φ) (* 2 (f|1 r θ φ) r (sin θ)^2) (* (cos θ) (f|2 r θ φ) (sin θ))) (* r^2 (sin θ)^2))
+ sample/math/geometry/polar-laplacian-3d-3.egi view
@@ -0,0 +1,41 @@+;;;+;;; Spherical coordinates+;;;++(define $x [|r θ φ|])++(define $X [|(* r (sin θ) (cos φ)) ; = x+             (* r (sin θ) (sin φ)) ; = y+             (* r (cos θ))         ; = z+             |])++;;+;; Local coordinates+;;++(define $e ((∂/∂ X~# $) x_#))+e+;[|[| (* (sin θ) (cos φ)) (* (sin θ) (sin φ)) (cos θ) |]+;  [| (* 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) {3 3}))+(define $g~~ (with-symbols {i j} (/ (unit-tensor {3 3})_i_j g_i_j)))++g_#_#;[| [| 1 0 0 |] [| 0 r^2 0 |] [| 0 0 (* r^2 (sin θ)^2) |] |]_#_#+g~#~#;[| [| 1 0 0 |] [| 0 (/ 1 r^2) 0 |] [| 0 0 (/ 1 (* r^2 (sin θ)^2)) |] |]~#~#++;;+;; Laplacian+;;++(define $sqrt-g (sqrt (M.det g_#_#)))+sqrt-g;(* r^2 (sin θ))++(define $Laplacian (/ (contract + (∂/∂ (* sqrt-g (. g~i~j (∂/∂ (f r θ φ) x_j))) x_i)) sqrt-g))+Laplacian+;(/ (+ (* 2 r (sin θ)^2 (f|1 r θ φ)) (* r^2 (sin θ)^2 (f|1|1 r θ φ)) (* (cos θ) (f|2 r θ φ) (sin θ)) (* (sin θ)^2 (f|2|2 r θ φ)) (f|3|3 r θ φ)) (* (sin θ)^2 r^2))
+ sample/math/geometry/polar-laplacian-3d.egi view
@@ -0,0 +1,61 @@+(define $x (* r (sin θ) (cos φ)))+(define $y (* r (sin θ) (sin φ)))+(define $z (* r (cos θ)))++(define $u-r (∂/∂ (u x y z) r))+u-r+;(+ (* (u|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ) (cos φ))+;   (* (u|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ) (sin φ))+;   (* (u|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (cos θ)))++(define $u-r-r (∂/∂ (∂/∂ (u x y z) r) r))+u-r-r+;(+ (* (u|1|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ)^2 (cos φ)^2)+;   (* (u|1|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ)^2 (sin φ) (cos φ))+;   (* (u|1|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (cos θ) (sin θ) (cos φ))+;   (* (u|2|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ)^2 (cos φ) (sin φ))+;   (* (u|2|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ)^2 (sin φ)^2)+;   (* (u|2|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (cos θ) (sin θ) (sin φ))+;   (* (u|3|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ) (cos φ) (cos θ))+;   (* (u|3|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (sin θ) (sin φ) (cos θ))+;   (* (u|3|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) (cos θ)^2))++(define $u-θ (∂/∂ (u x y z) θ))+u-θ+;(+ (* (u|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (cos θ) (cos φ))+;   (* (u|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (cos θ) (sin φ))+;   (* -1 (u|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ)))++(define $u-θ-θ (∂/∂ (∂/∂ (u x y z) θ) θ))+u-θ-θ+;(+ (* (u|1|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ)^2 (cos φ)^2)+;   (* (u|1|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ)^2 (sin φ) (cos φ))+;   (* -1 (u|1|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ) (cos θ) (cos φ))+;   (* -1 (u|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (cos φ))+;   (* (u|2|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ)^2 (cos φ) (sin φ))+;   (* (u|2|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ)^2 (sin φ)^2)+;   (* -1 (u|2|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ) (cos θ) (sin φ))+;   (* -1 (u|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (sin φ))+;   (* -1 (u|3|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ) (cos φ) (sin θ))+;   (* -1 (u|3|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (cos θ) (sin φ) (sin θ))+;   (* (u|3|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ)^2)+;   (* -1 (u|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (cos θ)))++(define $u-φ (∂/∂ (u x y z) φ))+u-φ+;(+ (* -1 (u|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (sin φ))+;   (* (u|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (cos φ)))++(define $u-φ-φ (∂/∂ (∂/∂ (u x y z) φ) φ))+u-φ-φ+;(+ (* (u|1|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ)^2 (sin φ)^2)+;   (* -1 (u|1|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ)^2 (cos φ) (sin φ))+;   (* -1 (u|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (cos φ))+;   (* -1 (u|2|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ)^2 (sin φ) (cos φ))+;   (* (u|2|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r^2 (sin θ)^2 (cos φ)^2)+;   (* -1 (u|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))) r (sin θ) (sin φ)))++(+ u-r-r (* (/ 2 r) u-r) (* (/ 1 (** r 2)) u-θ-θ) (* (/ (cos θ) (* (** r 2) (sin θ))) u-θ) (* (/ 1 (** (* r (sin θ)) 2)) u-φ-φ))+;(+ (u|3|3 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ)))+;   (u|1|1 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ)))+;   (u|2|2 (* r (sin θ) (cos φ)) (* r (sin θ) (sin φ)) (* r (cos θ))))
+ sample/math/geometry/riemann-curvature-tensor-of-FLRW-metric.egi view
@@ -0,0 +1,101 @@+;;;+;;; Parameters+;;;++(define $x [|w r θ φ|])++;;+;; Metric tensor+;;++(define $W (lambda [$r] (/ 1 '(- 1 (* K r^2)))))++(define $g__+  [|[| -1 0 0 0 |]+    [| 0 (* (`a w)^2 (W r)) 0 0 |]+    [| 0 0 (* (`a w)^2 r^2) 0 |]+    [| 0 0 0 (* (`a w)^2 r^2 (sin θ)^2) |]+    |])++(define $g~~ (M.inverse g_#_#))+g~#~#+;[|[| -1 0 0 0 |]+;  [| 0 (/ (* -1 '(+ 1 (* -1 K r^2))) (* -1 (a w)^2)) 0 0 |]+;  [| 0 0 (/ -1 (* -1 (a w)^2 r^2)) 0 |]+;  [| 0 0 0 (/ -1 (* -1 (a w)^2 r^2 (sin θ)^2)) |]|]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_k x_l)+        (∂/∂ g_j_l x_k)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_1_#_#;[| [| 0 0 0 0 |] [| 0 (/ (* -1 (a w) (a|1 w)) '(+ 1 (* -1 K r^2))) 0 0 |] [| 0 0 (* -1 (a w) (a|1 w) r^2) 0 |] [| 0 0 0 (* -1 (a w) (a|1 w) r^2 (sin θ)^2) |] |]_#_#+Γ_2_#_#;[| [| 0 (/ (* (a w) (a|1 w)) '(+ 1 (* -1 K r^2))) 0 0 |] [| (/ (* (a w) (a|1 w)) '(+ 1 (* -1 K r^2))) (/ (* K r (a w)^2) '(+ 1 (* -1 K r^2))^2) 0 0 |] [| 0 0 (* -1 (a w)^2 r) 0 |] [| 0 0 0 (* -1 (a w)^2 r (sin θ)^2) |] |]_#_#+Γ_3_#_#;[| [| 0 0 (* (a w) (a|1 w) r^2) 0 |] [| 0 0 (* (a w)^2 r) 0 |] [| (* (a w) (a|1 w) r^2) (* (a w)^2 r) 0 0 |] [| 0 0 0 (* -1 (a w)^2 r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_4_#_#;[| [| 0 0 0 (* (a w) (a|1 w) r^2 (sin θ)^2) |] [| 0 0 0 (* (a w)^2 r (sin θ)^2) |] [| 0 0 0 (* (a w)^2 r^2 (sin θ) (cos θ)) |] [| (* (a w) (a|1 w) r^2 (sin θ)^2) (* (a w)^2 r (sin θ)^2) (* (a w)^2 r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~1_#_#;[| [| 0 0 0 0 |] [| 0 (/ (* (a w) (a|1 w)) '(+ 1 (* -1 K r^2))) 0 0 |] [| 0 0 (* (a w) (a|1 w) r^2) 0 |] [| 0 0 0 (* (a w) (a|1 w) r^2 (sin θ)^2) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ (* -1 (a|1 w)) (* -1 (a w))) 0 0 |] [| (/ (* -1 (a|1 w)) (* -1 (a w))) (/ (* -1 K r) (* -1 '(+ 1 (* -1 K r^2)))) 0 0 |] [| 0 0 (* -1 '(+ 1 (* -1 K r^2)) r) 0 |] [| 0 0 0 (* -1 '(+ 1 (* -1 K r^2)) r (sin θ)^2) |] |]_#_#+Γ~3_#_#;[| [| 0 0 (/ (* -1 (a|1 w)) (* -1 (a w))) 0 |] [| 0 0 (/ -1 (* -1 r)) 0 |] [| (/ (* -1 (a|1 w)) (* -1 (a w))) (/ -1 (* -1 r)) 0 0 |] [| 0 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~4_#_#;[| [| 0 0 0 (/ (* -1 (a|1 w)) (* -1 (a w))) |] [| 0 0 0 (/ -1 (* -1 r)) |] [| 0 0 0 (/ (* -1 (cos θ)) (* -1 (sin θ))) |] [| (/ (* -1 (a|1 w)) (* -1 (a w))) (/ -1 (* -1 r)) (/ (* -1 (cos θ)) (* -1 (sin θ))) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_1_1;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (/ (* (a w) (a|1|1 w)) (+ -1 (* K r^2))) 0 0 |] [| (/ (* -1 (a|1|1 w)) (a w)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_3;[| [| 0 0 (* -1 (a w) (a|1|1 w) r^2) 0 |] [| 0 0 0 0 |] [| (/ (* -1 (a|1|1 w)) (a w)) 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_4;[| [| 0 0 0 (* -1 (a w) (a|1|1 w) r^2 (sin θ)^2) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| (/ (* -1 (a|1|1 w)) (a w)) 0 0 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (/ (* -1 (a w) (a|1|1 w)) (+ -1 (* K r^2))) 0 0 |] [| (/ (a|1|1 w) (a w)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_3;[| [| 0 0 0 0 |] [| 0 0 (+ (* -1 K r^2) (* -1 (a|1 w)^2 r^2)) 0 |] [| 0 (/ (+ (* -1 (a|1 w)^2) (* -1 K)) (+ -1 (* K r^2))) 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_4;[| [| 0 0 0 0 |] [| 0 0 0 (+ (* -1 K r^2 (sin θ)^2) (* -1 (a|1 w)^2 r^2 (sin θ)^2)) |] [| 0 0 0 0 |] [| 0 (/ (+ (* -1 (a|1 w)^2) (* -1 K)) (+ -1 (* K r^2))) 0 0 |] |]~#_#+R~#_#_3_1;[| [| 0 0 (* (a w) (a|1|1 w) r^2) 0 |] [| 0 0 0 0 |] [| (/ (a|1|1 w) (a w)) 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_2;[| [| 0 0 0 0 |] [| 0 0 (+ (* K r^2) (* (a|1 w)^2 r^2)) 0 |] [| 0 (/ (+ (a|1 w)^2 K) (+ -1 (* K r^2))) 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (+ (* -1 (a|1 w)^2 r^2 (sin θ)^2) (* -1 K r^2 (sin θ)^2)) |] [| 0 0 (+ (* (a|1 w)^2 r^2) (* K r^2)) 0 |] |]~#_#+R~#_#_4_1;[| [| 0 0 0 (* (a w) (a|1|1 w) r^2 (sin θ)^2) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| (/ (a|1|1 w) (a w)) 0 0 0 |] |]~#_#+R~#_#_4_2;[| [| 0 0 0 0 |] [| 0 0 0 (+ (* K r^2 (sin θ)^2) (* (a|1 w)^2 r^2 (sin θ)^2)) |] [| 0 0 0 0 |] [| 0 (/ (+ (a|1 w)^2 K) (+ -1 (* K r^2))) 0 0 |] |]~#_#+R~#_#_4_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (+ (* (a|1 w)^2 r^2 (sin θ)^2) (* K r^2 (sin θ)^2)) |] [| 0 0 (+ (* -1 (a|1 w)^2 r^2) (* -1 K r^2)) 0 |] |]~#_#+R~#_#_4_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_1_#;[| (/ (* -3 (a|1|1 w)) (a w)) 0 0 0 |]_#+Ric_2_#;[| 0 (/ (+ (* -1 (a w) (a|1|1 w)) (* -2 (a|1 w)^2) (* -2 K)) (+ -1 (* K r^2))) 0 0 |]_#+Ric_3_#;[| 0 0 (+ (* (a w) (a|1|1 w) r^2) (* 2 K r^2) (* 2 (a|1 w)^2 r^2)) 0 |]_#+Ric_4_#;[| 0 0 0 (+ (* (a w) (a|1|1 w) r^2 (sin θ)^2) (* 2 K r^2 (sin θ)^2) (* 2 (a|1 w)^2 r^2 (sin θ)^2)) |]_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (expand-all' (. g~j~k Ric_j_k))))++scalar-curvature+;(/ (+ (* 6 (a|1|1 w) (a w)) (* 6 (a|1 w)^2) (* 6 K))+;   (a w)^2)
+ sample/math/geometry/riemann-curvature-tensor-of-M3-conformal.egi view
@@ -0,0 +1,72 @@+;;;+;;; Parameters+;;;++(define $x [|α β γ|])++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(* (a α β γ) (G_%1_%2 α β γ)) {3 3}))+(define $g~~ (generate-tensor 2#(* (/ 1 (a α β γ)) (G~%1~%2 α β γ)) {3 3}))+g_#_#+g~#~#++;;+;; 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))))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i j k} (contract + R~i_j_k_i)))++Ric_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 3)]}+  (- (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_u_(σ 3)_(σ 2))) es))+     (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2))) os))))
+ sample/math/geometry/riemann-curvature-tensor-of-M5-conformal.egi view
@@ -0,0 +1,56 @@+;;;+;;; Parameters+;;;++(define $x [|α β γ δ ε|])++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(* (a α β γ δ ε) (G_%1_%2 α β γ δ ε)) {5 5}))+(define $g~~ (generate-tensor 2#(* (/ 1 (a α β γ δ ε)) (G~%1~%2 α β γ δ ε)) {5 5}))+g_#_#+g~#~#++;;+;; 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))))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 5)]}+  (- (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) es))+     (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) os))))
+ sample/math/geometry/riemann-curvature-tensor-of-S1.egi view
@@ -0,0 +1,80 @@+;;;+;;; Parameters+;;;++(define $x [|θ|])++(define $X [|(* r (sin θ)) ; = x+             (* r (cos θ)) ; = y+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e;[| [| (* r (cos θ)) (* -1 r (sin θ)) |] |]_#~#++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {1 1}))+(define $g~~ (M.inverse g_#_#))++g_#_#;[| [| r^2 |] |]_#_#+g~#~#;[| [| (/ 1 r^2) |] |]~#~#++;;+;; Christoffel symbols of the first kind+;;++(define $Γ___+  (with-symbols {j k l}+    (* (/ 1 2)+       (+ (∂/∂ g_j_k x_l)+          (∂/∂ g_j_l x_k)+          (* -1 (∂/∂ g_k_l x_j))))))++Γ_#_#_#;(tensor {1 1 1} {0} )_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~#_#_#;(tensor {1 1 1} {0} )~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#;(tensor {1 1 1 1} {0} )~#_#_#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#;(tensor {1 1 1 1} {0} )_#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i j k} (contract + R~i_j_k_i)))++Ric_#_#;[| [| 0 |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;0
+ sample/math/geometry/riemann-curvature-tensor-of-S2.egi view
@@ -0,0 +1,119 @@+;;;+;;; 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 of the first kind+;;++(define $Γ_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^2 (sin θ) (cos θ)) 0 (* r^2 (sin θ) (cos θ)) (* r^2 (sin θ) (cos θ)) 0} )_#_#_#+Γ_1_#_#;[| [| 0 0 |] [| 0 (* -1 r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_2_#_#;[| [| 0 (* r^2 (sin θ) (cos θ)) |] [| (* r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#;(tensor {2 2 2} {0 0 0 (* -1 (sin θ) (cos θ)) 0 (/ (cos θ) (sin θ)) (/ (cos θ) (sin θ)) 0} )~#_#_#+Γ~1_#_#;[| [| 0 0 |] [| 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ (cos θ) (sin θ)) |] [| (/ (cos θ) (sin θ)) 0 |] |]_#_#++;;+;; Covariant derivative of metric tensor+;;+(define $∇g___+  (with-symbols {i j m n}+    (- (∂/∂ g_i_j x_m)+       (. Γ~n_m_i g_n_j)+       (. Γ~n_m_j g_i_n))))++∇g_#_#_#;=>(tensor {2 2 2} {0 0 0 0 0 0 0 0} )++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#;(tensor {2 2 2 2} {0 0 0 0 0 (sin θ)^2 (* -1 (sin θ)^2) 0 0 -1 1 0 0 0 0 0} )~#_#_#_#+R~#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (sin θ)^2 |] [| -1 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (* -1 (sin θ)^2) |] [| 1 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]~#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#;(tensor {2 2 2 2} {0 0 0 0 0 (* r^2 (sin θ)^2) (* -1 r^2 (sin θ)^2) 0 0 (* -1 r^2 (sin θ)^2) (* r^2 (sin θ)^2) 0 0 0 0 0} )_#_#_#_#+R_#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]_#_#+R_#_#_1_2;[| [| 0 (* r^2 (sin θ)^2) |] [| (* -1 r^2 (sin θ)^2) 0 |] |]_#_#+R_#_#_2_1;[| [| 0 (* -1 r^2 (sin θ)^2) |] [| (* r^2 (sin θ)^2) 0 |] |]_#_#+R_#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| 1 0 |] [| 0 (sin θ)^2 |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ 2 r^2)++;;+;; Covariant derivative of Riemann curvature tensor+;;++(define $∇R_____+  (with-symbols {i j k l m n}+    (- (∂/∂ R_i_j_k_l x_m)+       (. Γ~n_m_i R_n_j_k_l)+       (. Γ~n_m_j R_i_n_k_l)+       (. Γ~n_m_k R_i_j_n_l)+       (. Γ~n_m_l R_i_j_k_n))))++∇R_#_#_#_#_#+;(tensor {2 2 2 2 2} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#_#
+ sample/math/geometry/riemann-curvature-tensor-of-S2xS3-conformal-fast.egi view
@@ -0,0 +1,78 @@+;;+;; Parameters+;;++(define $x [| φ θ ψ y α |])++;;+;; Riemann metric of S2 x S3+;;++(define $g__+  (* (a φ θ ψ y α)^2+     [|[| (/ (+ (* 3 '(+ 1 (* -1 y))^2 (sin θ)^2 '(+ a (* -1 y^2))) (* 2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ)^2 '(+ 1 (* -1 y))) (* '(+ a (* -2 y) y^2)^2 (cos θ)^2)) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) |]+       [| 0 (/ '(+ 1 (* -1 y)) 6) 0 0 0 |]+       [| (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* 2 '(+ a (* -3 y^2) (* 2 y^3)) '(+ 1 (* -1 y))) '(+ a (* -2 y) y^2)^2) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) |]+       [| 0 0 0 (/ '(+ 1 (* -1 y)) (* 2 '(+ a (* -3 y^2) (* 2 y^3)))) 0 |]+       [| (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 2 '(+ a (* -1 y^2))) '(+ 1 (* -1 y))) |]+       |]_#_#))++(define $g~~ (M.inverse g_#_#))+g~#~#++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))+Ric_#_#++;;+;; Wodzicki-Chern-Simons class+;;++(define $ret (let {[[$es $os] (even-and-odd-permutations 5)]}+               (- (sum' (map (lambda [$σ] (debug (.' R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4)))) es))+                  (sum' (map (lambda [$σ] (debug (.' R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4)))) os)))))++ret++(define $ret2 (/ (expand-all' (numerator ret)) (denominator ret)))++ret2++(define $ret3 (/ (2#%1 (P./ (numerator ret2) (* (+ 1 (* -1 y))^3 (+ a (* -1 y^2))^5) y))+                 (/ (denominator ret2) (* '(+ 1 (* -1 y))^3 '(+ a (* -1 y^2))^5))))++ret3
+ sample/math/geometry/riemann-curvature-tensor-of-S2xS3-fast.egi view
@@ -0,0 +1,80 @@+;;+;; Parameters+;;++(define $x [| φ θ ψ y α |])++;;+;; Riemann metric of S2 x S3+;;++(define $g__+  [|[| (/ (+ (* 3 '(+ 1 (* -1 y))^2 (sin θ)^2 '(+ a (* -1 y^2))) (* 2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ)^2 '(+ 1 (* -1 y))) (* '(+ a (* -2 y) y^2)^2 (cos θ)^2)) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) |]+    [| 0 (/ '(+ 1 (* -1 y)) 6) 0 0 0 |]+    [| (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* 2 '(+ a (* -3 y^2) (* 2 y^3)) '(+ 1 (* -1 y))) '(+ a (* -2 y) y^2)^2) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) |]+    [| 0 0 0 (/ '(+ 1 (* -1 y)) (* 2 '(+ a (* -3 y^2) (* 2 y^3)))) 0 |]+    [| (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 2 '(+ a (* -1 y^2))) '(+ 1 (* -1 y))) |]+    |]_#_#)++(define $g~~ (M.inverse g_#_#))+g~#~#++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))+Ric_#_#++(expand-all' (with-symbols {i j} (-' Ric_i_j (*' 4 g_i_j))))+;[| [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] |]++;;+;; Wodzicki-Chern-Simons class+;;++(define $ret (let {[[$es $os] (even-and-odd-permutations 5)]}+               (- (sum' (map (lambda [$σ] (.' R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) es))+                  (sum' (map (lambda [$σ] (.' R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) os)))))++(define $ret2 (/ (expand-all' (numerator ret)) (denominator ret)))++ret2+;(/ (+ (* -128 a^6 y (sin θ)) (* 832 a^5 y^3 (sin θ)) (* -2240 a^4 y^5 (sin θ)) (* 3200 a^3 y^7 (sin θ)) (* -2560 a^2 y^9 (sin θ)) (* 1088 a y^11 (sin θ)) (* 384 a^6 y^2 (sin θ)) (* -1984 a^5 y^4 (sin θ)) (* 4160 a^4 y^6 (sin θ)) (* -4480 a^3 y^8 (sin θ)) (* 2560 a^2 y^10 (sin θ)) (* -704 a y^12 (sin θ)) (* -704 a^6 y^3 (sin θ)) (* 2560 a^5 y^5 (sin θ)) (* -4480 a^4 y^7 (sin θ)) (* 4160 a^3 y^9 (sin θ)) (* -1984 a^2 y^11 (sin θ)) (* 384 a y^13 (sin θ)) (* 1088 a^6 y^4 (sin θ)) (* -2560 a^5 y^6 (sin θ)) (* 3200 a^4 y^8 (sin θ)) (* -2240 a^3 y^10 (sin θ)) (* 832 a^2 y^12 (sin θ)) (* -128 a y^14 (sin θ)) (* -960 a^6 y^5 (sin θ)) (* 1920 a^5 y^7 (sin θ)) (* -1920 a^4 y^9 (sin θ)) (* 960 a^3 y^11 (sin θ)) (* -192 a^2 y^13 (sin θ)) (* 320 a^6 y^6 (sin θ)) (* -640 a^5 y^8 (sin θ)) (* 640 a^4 y^10 (sin θ)) (* -320 a^3 y^12 (sin θ)) (* 64 a^2 y^14 (sin θ)) (* 64 y^14 (sin θ)) (* 64 a^7 y (sin θ)) (* -192 a^7 y^2 (sin θ)) (* 192 a^7 y^3 (sin θ)) (* -64 a^7 y^4 (sin θ)) (* -192 a^5 (sin θ) y^2) (* 960 a^4 (sin θ) y^4) (* -1920 a^3 (sin θ) y^6) (* 1920 a^2 y^8 (sin θ)) (* -960 a y^10 (sin θ)) (* -320 y^3 a^4 (sin θ)) (* 640 y^5 a^3 (sin θ)) (* -640 y^7 a^2 (sin θ)) (* 320 y^9 a (sin θ)) (* -64 y^11 (sin θ)) (* 192 y^12 (sin θ)) (* 64 a^5 y (sin θ)) (* -192 y^13 (sin θ))) (* 3 '(+ 1 (* -1 y))^8 '(+ a (* -1 y^2))^5))++(define $ret3 (/ (2#%1 (P./ (numerator ret2) (* (+ 1 (* -1 y))^3 (+ a (* -1 y^2))^5) y))+                 (/ (denominator ret2) (* '(+ 1 (* -1 y))^3 '(+ a (* -1 y^2))^5))))++ret3+;(/ (+ (* 128 a (sin θ) y) (* -64 a^2 (sin θ) y) (* -64 (sin θ) y)) (* 3 '(+ 1 (* -1 y))^5))
+ sample/math/geometry/riemann-curvature-tensor-of-S2xS3-integral.egi view
@@ -0,0 +1,57 @@+(define $ret3 (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5)))++(define $ret4 (- (let {[$θ π]} (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5)))+                 (let {[$θ 0]} (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5)))))++"ret4"+ret4+;(/ (+ (* 16 a y) (* -8 a^2 y) (* -8 y)) (* 45 '(+ 1 (* -1 y))^5))++(define $ret5 (d/d (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4)) y))++"ret5"+ret5++(define $ret6 (/ (expand-all' (numerator ret5)) (denominator ret5)))++"ret6"+ret6++(define $ret7 (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4)))++(define $y1 (* (/ 1 2) (+ 1 (* -1 λ) (* -1 (sqrt (- 1 (/ λ^2 3)))))))+(define $y2 (+ y1 λ))+++(let {[$y y2]} ret7)+(let {[$y y1]} ret7)++(define $ret8 (- (let {[$y y2]} (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4)))+                 (let {[$y y1]} (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4)))))++"ret8"+ret8+;(/ (+ (* -6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 12 a '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6 a^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 a^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 405 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4))++(define $ret9 (let {[$a (- (* 3 y1^2) (* 2 y2^3))]}+                (/ (+ (* -6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 12 a '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6 a^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 a^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 405 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4))))++"ret9"+ret9+;(/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4))++(define $ret10 (let {[$λ (/ (* 3 q) (* 2 p))]}+                 (/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4))))++"ret10"+ret10++(define $ret11 (let* {[$p 7]+                      [$q 3]+                      [$λ (/ (* 3 q) (* 2 p))]}+                 (* (/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4))+                    (* 2^4 π^4 (/ q (+ (* 3 q^2) (* -2 p^2) (* p (sqrt (+ (* 4 p^2) (* -3 q^2))))))))))+++(expand-all ret11)+;(/ (* -1849 π^4) 22050)
+ sample/math/geometry/riemann-curvature-tensor-of-S2xS3.egi view
@@ -0,0 +1,81 @@+;;+;; Parameters+;;++(define $x [| φ θ ψ y α |])++;;+;; Riemann metric of S2 x S3+;;++(define $g__+  [|[| (/ (+ (* 3 '(+ 1 (* -1 y))^2 (sin θ)^2 '(+ a (* -1 y^2))) (* 2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ)^2 '(+ 1 (* -1 y))) (* '(+ a (* -2 y) y^2)^2 (cos θ)^2)) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) |]+    [| 0 (/ '(+ 1 (* -1 y)) 6) 0 0 0 |]+    [| (/ (+ (* -2 '(+ a (* -3 y^2) (* 2 y^3)) (cos θ) '(+ 1 (* -1 y))) (* -1 '(+ a (* -2 y) y^2)^2 (cos θ))) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (+ (* 2 '(+ a (* -3 y^2) (* 2 y^3)) '(+ 1 (* -1 y))) '(+ a (* -2 y) y^2)^2) (* 18 '(+ a (* -1 y^2)) '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) |]+    [| 0 0 0 (/ '(+ 1 (* -1 y)) (* 2 '(+ a (* -3 y^2) (* 2 y^3)))) 0 |]+    [| (/ (* -1 '(+ a (* -2 y) y^2) (cos θ)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 1 '(+ a (* -2 y) y^2)) (* 3 '(+ 1 (* -1 y)))) 0 (/ (* 2 '(+ a (* -1 y^2))) '(+ 1 (* -1 y))) |]+    |]_#_#)++(define $g~~ (M.inverse g_#_#))+g~#~#++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))+Ric_#_#++(expand-all' (with-symbols {i j} (-' Ric_i_j (*' 4 g_i_j))))+;[| [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] [| 0 0 0 0 0 |] |]++;;+;; Wodzicki-Chern-Simons class+;;++(define $ret (let {[[$es $os] (even-and-odd-permutations 5)]}+               (/ (- (sum (map (lambda [$σ] (. R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) es))+                     (sum (map (lambda [$σ] (. R~u_5_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) os)))+                  (* 2 (fact 5)))))++(define $ret2 (/ (expand-all' (numerator ret)) (denominator ret)))++ret2+;++(define $ret3 (/ (2#%1 (P./ (numerator ret2) (* (+ 1 (* -1 y))^3 (+ a (* -1 y^2))^5) y))+                 (/ (denominator ret2) (* '(+ 1 (* -1 y))^3 '(+ a (* -1 y^2))^5))))++ret3+;(/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5))
+ sample/math/geometry/riemann-curvature-tensor-of-S3.egi view
@@ -0,0 +1,108 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ)) |]+;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ)) |]|]++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {3 3}))+(define $g~~ (M.inverse g_#_#))+g_#_#;[| [| r^2 0 0 |] [| 0 (* r^2 (sin θ)^2) 0 |] [| 0 0 (* r^2 (sin θ)^2 (sin φ)^2) |] |]_#_#+g~#~#;[| [| (/ 1 r^2) 0 0 |] [| 0 (/ 1 (* r^2 (sin θ)^2)) 0 |] [| 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2)) |] |]~#~#++(with-symbols {i j k} (. g~i~j g_j_k));[| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_k x_l)+        (∂/∂ g_j_l x_k)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_1_#_#;[| [| 0 0 0 |] [| 0 (* -1 r^2 (sin θ) (cos θ)) 0 |] [| 0 0 (* -1 r^2 (sin θ) (cos θ) (sin φ)^2) |] |]_#_#+Γ_2_#_#;[| [| 0 (* r^2 (sin θ) (cos θ)) 0 |] [| (* r^2 (sin θ) (cos θ)) 0 0 |] [| 0 0 (* -1 r^2 (sin θ)^2 (sin φ) (cos φ)) |] |]_#_#+Γ_3_#_#;[| [| 0 0 (* r^2 (sin θ) (cos θ) (sin φ)^2) |] [| 0 0 (* r^2 (sin θ)^2 (sin φ) (cos φ)) |] [| (* r^2 (sin θ) (cos θ) (sin φ)^2) (* r^2 (sin θ)^2 (sin φ) (cos φ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~1_#_#;[| [| 0 0 0 |] [| 0 (* -1 (sin θ) (cos θ)) 0 |] [| 0 0 (* -1 (sin θ) (cos θ) (sin φ)^2) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ (cos θ) (sin θ)) 0 |] [| (/ (cos θ) (sin θ)) 0 0 |] [| 0 0 (* -1 (sin φ) (cos φ)) |] |]_#_#+Γ~3_#_#;[| [| 0 0 (/ (cos θ) (sin θ)) |] [| 0 0 (/ (cos φ) (sin φ)) |] [| (/ (cos θ) (sin θ)) (/ (cos φ) (sin φ)) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_1_1;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (sin θ)^2 0 |] [| -1 0 0 |] [| 0 0 0 |] |]~#_#+R~#_#_1_3;[| [| 0 0 (* (sin θ)^2 (sin φ)^2) |] [| 0 0 0 |] [| -1 0 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (* -1 (sin θ)^2) 0 |] [| 1 0 0 |] [| 0 0 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 0 |] |]~#_#+R~#_#_2_3;[| [| 0 0 0 |] [| 0 0 (* (sin θ)^2 (sin φ)^2) |] [| 0 (* -1 (sin θ)^2) 0 |] |]~#_#+R~#_#_3_1;[| [| 0 0 (* -1 (sin θ)^2 (sin φ)^2) |] [| 0 0 0 |] [| 1 0 0 |] |]~#_#+R~#_#_3_2;[| [| 0 0 0 |] [| 0 0 (* -1 (sin θ)^2 (sin φ)^2) |] [| 0 (sin θ)^2 0 |] |]~#_#+R~#_#_3_3;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 0 |] |]~#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#;(tensor {3 3 3 3} {0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2) 0 (* -1 r^2 (sin θ)^2) 0 0 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 (* -1 r^2 (sin θ)^2) 0 (* r^2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2) 0 (* -1 r^2 (sin θ)^4 (sin φ)^2) 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2) 0 (* r^2 (sin θ)^4 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| 2 0 0 |] [| 0 (* 2 (sin θ)^2) 0 |] [| 0 0 (* 2 (sin θ)^2 (sin φ)^2) |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ 6 r^2)++;;+;; Conformal curvature tensor+;;++(define $C_i_k_l_m+  (+ (. R_i_k_l_m)+     (+ (- (. Ric_i_m g_k_l) (. Ric_i_l g_k_m))+        (- (. Ric_k_l g_i_m) (. Ric_k_m g_i_l)))+     (* (/ scalar-curvature 2) (- (. g_i_l g_k_m) (. g_i_m g_k_l)))))++C_#_#_#_#+;(tensor {3 3 3 3} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#
+ sample/math/geometry/riemann-curvature-tensor-of-S4.egi view
@@ -0,0 +1,145 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ η|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ) (cos η))+             (* r (sin θ) (sin φ) (sin ψ) (sin η))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ) (cos η)) (* r (cos θ) (sin φ) (sin ψ) (sin η)) |]+;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ) (cos η)) (* r (sin θ) (cos φ) (sin ψ) (sin η)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ) (cos η)) (* r (sin θ) (sin φ) (cos ψ) (sin η)) |]+;  [| 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η)) (* r (sin θ) (sin φ) (sin ψ) (cos η)) |] |]_#~#++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {4 4}))+(define $g~~ (M.inverse g_#_#))+g_#_#;[| [| r^2 0 0 0 |] [| 0 (* r^2 (sin θ)^2) 0 0 |] [| 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 |] [| 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) |] |]_#_#+g~#~#;[| [| (/ 1 r^2) 0 0 0 |] [| 0 (/ 1 (* r^2 (sin θ)^2)) 0 0 |] [| 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2)) 0 |] [| 0 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2)) |] |]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_k x_l)+        (∂/∂ g_j_l x_k)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_1_#_#;[| [| 0 0 0 0 |] [| 0 (/ (* -1 r^2 (sin (* 2 θ))) 2) 0 0 |] [| 0 0 (/ (* -1 r^2 (sin (* 2 θ)) (sin φ)^2) 2) 0 |] [| 0 0 0 (/ (* -1 r^2 (sin (* 2 θ)) (sin φ)^2 (sin ψ)^2) 2) |] |]_#_#+Γ_2_#_#;[| [| 0 (/ (* r^2 (sin (* 2 θ))) 2) 0 0 |] [| (/ (* r^2 (sin (* 2 θ))) 2) 0 0 0 |] [| 0 0 (/ (* -1 r^2 (sin θ)^2 (sin (* 2 φ))) 2) 0 |] [| 0 0 0 (/ (* -1 r^2 (sin θ)^2 (sin (* 2 φ)) (sin ψ)^2) 2) |] |]_#_#+Γ_3_#_#;[| [| 0 0 (/ (* r^2 (sin (* 2 θ)) (sin φ)^2) 2) 0 |] [| 0 0 (/ (* r^2 (sin θ)^2 (sin (* 2 φ))) 2) 0 |] [| (/ (* r^2 (sin (* 2 θ)) (sin φ)^2) 2) (/ (* r^2 (sin θ)^2 (sin (* 2 φ))) 2) 0 0 |] [| 0 0 0 (/ (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin (* 2 ψ))) 2) |] |]_#_#+Γ_4_#_#;[| [| 0 0 0 (/ (* r^2 (sin (* 2 θ)) (sin φ)^2 (sin ψ)^2) 2) |] [| 0 0 0 (/ (* r^2 (sin θ)^2 (sin (* 2 φ)) (sin ψ)^2) 2) |] [| 0 0 0 (/ (* r^2 (sin θ)^2 (sin φ)^2 (sin (* 2 ψ))) 2) |] [| (/ (* r^2 (sin (* 2 θ)) (sin φ)^2 (sin ψ)^2) 2) (/ (* r^2 (sin θ)^2 (sin (* 2 φ)) (sin ψ)^2) 2) (/ (* r^2 (sin θ)^2 (sin φ)^2 (sin (* 2 ψ))) 2) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~1_#_#;[| [| 0 0 0 0 |] [| 0 (/ (* -1 (sin (* 2 θ))) 2) 0 0 |] [| 0 0 (/ (* -1 (sin (* 2 θ)) (sin φ)^2) 2) 0 |] [| 0 0 0 (/ (* -1 (sin (* 2 θ)) (sin φ)^2 (sin ψ)^2) 2) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ (cos θ) (sin θ)) 0 0 |] [| (/ (cos θ) (sin θ)) 0 0 0 |] [| 0 0 (/ (* -1 (sin (* 2 φ))) 2) 0 |] [| 0 0 0 (/ (* -1 (sin (* 2 φ)) (sin ψ)^2) 2) |] |]_#_#+Γ~3_#_#;[| [| 0 0 (/ (cos θ) (sin θ)) 0 |] [| 0 0 (/ (cos φ) (sin φ)) 0 |] [| (/ (cos θ) (sin θ)) (/ (cos φ) (sin φ)) 0 0 |] [| 0 0 0 (/ (* -1 (sin (* 2 ψ))) 2) |] |]_#_#+Γ~4_#_#;[| [| 0 0 0 (/ (cos θ) (sin θ)) |] [| 0 0 0 (/ (cos φ) (sin φ)) |] [| 0 0 0 (/ (cos ψ) (sin ψ)) |] [| (/ (cos θ) (sin θ)) (/ (cos φ) (sin φ)) (/ (cos ψ) (sin ψ)) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_1_1;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (* -1 (sin θ)^2) 0 0 |] [| 1 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_3;[| [| 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 |] [| 0 0 0 0 |] [| 1 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_4;[| [| 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 1 0 0 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (sin θ)^2 0 0 |] [| -1 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_3;[| [| 0 0 0 0 |] [| 0 0 (+ (* -1 (sin φ)^2) (* (cos θ)^2 (sin φ)^2)) 0 |] [| 0 (sin θ)^2 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_4;[| [| 0 0 0 0 |] [| 0 0 0 (+ (* -1 (sin φ)^2 (sin ψ)^2) (* (cos θ)^2 (sin φ)^2 (sin ψ)^2)) |] [| 0 0 0 0 |] [| 0 (sin θ)^2 0 0 |] |]~#_#+R~#_#_3_1;[| [| 0 0 (* (sin θ)^2 (sin φ)^2) 0 |] [| 0 0 0 0 |] [| -1 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_2;[| [| 0 0 0 0 |] [| 0 0 (+ (sin φ)^2 (* -1 (cos θ)^2 (sin φ)^2)) 0 |] [| 0 (* -1 (sin θ)^2) 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (+ (* -1 (sin ψ)^2) (* (cos θ)^2 (sin φ)^2 (sin ψ)^2) (* (cos φ)^2 (sin ψ)^2)) |] [| 0 0 (* (sin θ)^2 (sin φ)^2) 0 |] |]~#_#+R~#_#_4_1;[| [| 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| -1 0 0 0 |] |]~#_#+R~#_#_4_2;[| [| 0 0 0 0 |] [| 0 0 0 (+ (* (sin φ)^2 (sin ψ)^2) (* -1 (cos θ)^2 (sin φ)^2 (sin ψ)^2)) |] [| 0 0 0 0 |] [| 0 (* -1 (sin θ)^2) 0 0 |] |]~#_#+R~#_#_4_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (+ (sin ψ)^2 (* -1 (cos θ)^2 (sin φ)^2 (sin ψ)^2) (* -1 (cos φ)^2 (sin ψ)^2)) |] [| 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 |] |]~#_#+R~#_#_4_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#;(tensor {4 4 4 4} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^2) 0 0 (* r^2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 (* r^2 (sin θ)^2) 0 0 (* -1 r^2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (+ (* (cos θ)^2 (sin θ)^2 r^2 (sin φ)^2) (* -1 r^2 (sin θ)^2 (sin φ)^2)) 0 0 (+ (* -1 (cos θ)^2 (sin θ)^2 r^2 (sin φ)^2) (* r^2 (sin θ)^2 (sin φ)^2)) 0 0 0 0 0 0 0 0 0 0 0 0 0 (+ (* (cos θ)^2 (sin θ)^2 r^2 (sin φ)^2 (sin ψ)^2) (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2)) 0 0 0 0 0 (+ (* -1 (cos θ)^2 (sin θ)^2 r^2 (sin φ)^2 (sin ψ)^2) (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2)) 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2) 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (+ (* (cos θ)^2 (sin θ)^2 r^2 (sin φ)^4 (sin ψ)^2) (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) (* r^2 (sin θ)^2 (sin φ)^2 (cos φ)^2 (sin ψ)^2)) 0 0 (+ (* -1 (cos θ)^2 (sin θ)^2 r^2 (sin φ)^4 (sin ψ)^2) (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) (* -1 r^2 (sin θ)^2 (sin φ)^2 (cos φ)^2 (sin ψ)^2)) 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| 3 0 0 0 |] [| 0 (* 3 (sin θ)^2) 0 0 |] [| 0 0 (* 3 (sin θ)^2 (sin φ)^2) 0 |] [| 0 0 0 (* 3 (sin θ)^2 (sin φ)^2 (sin ψ)^2) |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ 12 r^2)++;;+;; Covariant derivative of Ricci curvature+;;++(define $∇Ric___+  (with-symbols {i j k l m n}+    (- (∂/∂ Ric_i_j x_m)+       (. Γ~n_m_i Ric_n_j)+       (. Γ~n_m_j Ric_i_n)+       )))++∇Ric_#_#_#+;(tensor {4 4 4} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#++;;+;; Conformal curvature tensor+;;++(define $C_i_k_l_m+  (+ (. R_i_k_l_m)+     (+ (- (. Ric_i_m g_k_l) (. Ric_i_l g_k_m))+        (- (. Ric_k_l g_i_m) (. Ric_k_m g_i_l)))+     (* (/ scalar-curvature 2) (- (. g_i_l g_k_m) (. g_i_m g_k_l)))))++C_#_#_#_#+;;(tensor {4 4 4 4} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2) 0 0 (* -1 r^2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 (* -1 r^2 (sin θ)^2) 0 0 (* r^2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2) 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2) 0 0 (* r^2 (sin θ)^4 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 0 0 (* -1 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 (* r^2 (sin θ)^4 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 (* r^2 (sin θ)^4 (sin φ)^4 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#++;;+;; Pontryagin Class+;;++(define $P+  (let {[[$es $os] (even-and-odd-permutations 4)]}+    (- (sum (map (lambda [$σ] (. R~s_t_(σ 2)_(σ 1) R~t_s_(σ 4)_(σ 3))) es))+       (sum (map (lambda [$σ] (. R~s_t_(σ 2)_(σ 1) R~t_s_(σ 4)_(σ 3))) os)))))++P;0
+ sample/math/geometry/riemann-curvature-tensor-of-S5-conformal-weyl.egi view
@@ -0,0 +1,126 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ η δ|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ) (cos η))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ) (cos η)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (cos δ)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (sin δ)) |]+;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ) (cos η)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (cos δ)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (sin δ)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ) (cos η)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (cos δ)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (sin δ)) |]+;  [| 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (cos δ)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (sin δ)) |]+;  [| 0 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ)) (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ)) |] |]++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(* (a θ φ ψ η δ)^2 (V.* e_%1 e_%2)) {5 5}))+(define $g~~ (M.inverse g_#_#))+g_#_#+g~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature+;(/ (+ (* 20 (a θ φ ψ η δ)^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|1|1 θ φ ψ η δ) (a θ φ ψ η δ) (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|2|2 θ φ ψ η δ) (a θ φ ψ η δ) (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|3|3 θ φ ψ η δ) (a θ φ ψ η δ) (sin ψ)^2 (sin η)^2)+;      (* -8 (a|4|4 θ φ ψ η δ) (a θ φ ψ η δ) (sin η)^2)+;      (* -8 (a|5|5 θ φ ψ η δ) (a θ φ ψ η δ))+;      (* -4 (a|1 θ φ ψ η δ)^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|2 θ φ ψ η δ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|3 θ φ ψ η δ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|4 θ φ ψ η δ)^2 (sin η)^2)+;      (* -4 (a|5 θ φ ψ η δ)^2)+;      (* -32 (a|1 θ φ ψ η δ) (a θ φ ψ η δ) (cos θ) (sin θ) (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -24 (a|2 θ φ ψ η δ) (a θ φ ψ η δ) (cos φ) (sin φ) (sin ψ)^2 (sin η)^2)+;      (* -16 (a|3 θ φ ψ η δ) (a θ φ ψ η δ) (cos ψ) (sin ψ) (sin η)^2)+;      (* -8 (a|4 θ φ ψ η δ) (a θ φ ψ η δ) (cos η) (sin η))+;      )+;   (* (a θ φ ψ η δ)^4 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2))++;;+;; Weyl curvature tensor+;;+(define $C_i_k_l_m+  (+ (. R_i_k_l_m)+     (+ (- (. Ric_i_m g_k_l) (. Ric_i_l g_k_m))+        (- (. Ric_k_l g_i_m) (. Ric_k_m g_i_l)))+     (* (/ scalar-curvature 2) (- (. g_i_l g_k_m) (. g_i_m g_k_l)))))++C_#_#_#_#++(define $C~___ (with-symbols {i} (. g~i~# C_i_#_#_#)))+C~#_#_#_#++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 5)]}+  (- (sum' (map (lambda [$σ] (.' C~u_1_s_(σ 1) C~s_t_(σ 3)_(σ 2) C~t_u_(σ 5)_(σ 4))) es))+     (sum' (map (lambda [$σ] (.' C~u_1_s_(σ 1) C~s_t_(σ 3)_(σ 2) C~t_u_(σ 5)_(σ 4))) os))))+;0
+ sample/math/geometry/riemann-curvature-tensor-of-S5-conformal.egi view
@@ -0,0 +1,110 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ η δ|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ) (cos η))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ) (cos η)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (cos δ)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (sin δ)) |]+7;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ) (cos η)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (cos δ)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (sin δ)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ) (cos η)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (cos δ)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (sin δ)) |]+;  [| 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (cos δ)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (sin δ)) |]+;  [| 0 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ)) (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ)) |] |]++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(* (a θ φ ψ η δ)^2 (V.* e_%1 e_%2)) {5 5}))+(define $g~~ (M.inverse g_#_#))+g_#_#+g~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature+;(/ (+ (* 20 (a θ φ ψ η δ)^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|1|1 θ φ ψ η δ) (a θ φ ψ η δ) (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|2|2 θ φ ψ η δ) (a θ φ ψ η δ) (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -8 (a|3|3 θ φ ψ η δ) (a θ φ ψ η δ) (sin ψ)^2 (sin η)^2)+;      (* -8 (a|4|4 θ φ ψ η δ) (a θ φ ψ η δ) (sin η)^2)+;      (* -8 (a|5|5 θ φ ψ η δ) (a θ φ ψ η δ))+;      (* -4 (a|1 θ φ ψ η δ)^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|2 θ φ ψ η δ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|3 θ φ ψ η δ)^2 (sin ψ)^2 (sin η)^2)+;      (* -4 (a|4 θ φ ψ η δ)^2 (sin η)^2)+;      (* -4 (a|5 θ φ ψ η δ)^2)+;      (* -32 (a|1 θ φ ψ η δ) (a θ φ ψ η δ) (cos θ) (sin θ) (sin φ)^2 (sin ψ)^2 (sin η)^2)+;      (* -24 (a|2 θ φ ψ η δ) (a θ φ ψ η δ) (cos φ) (sin φ) (sin ψ)^2 (sin η)^2)+;      (* -16 (a|3 θ φ ψ η δ) (a θ φ ψ η δ) (cos ψ) (sin ψ) (sin η)^2)+;      (* -8 (a|4 θ φ ψ η δ) (a θ φ ψ η δ) (cos η) (sin η))+;      )+;   (* (a θ φ ψ η δ)^4 r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2))++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 5)]}+  (- (sum' (map (lambda [$σ] (debug (.' R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4)))) es))+     (sum' (map (lambda [$σ] (debug (.' R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4)))) os))))+;0
+ sample/math/geometry/riemann-curvature-tensor-of-S5-weyl.egi view
@@ -0,0 +1,113 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ η ζ|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ) (cos η))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos ζ))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (sin ζ))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ) (cos η)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (cos ζ)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (sin ζ)) |]+;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ) (cos η)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (cos ζ)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (sin ζ)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ) (cos η)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (cos ζ)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (sin ζ)) |]+;  [| 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (cos ζ)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (sin ζ)) |]+;  [| 0 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η) (sin ζ)) (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos ζ)) |] |]++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {5 5}))+(define $g~~ (M.inverse g_#_#))+g_#_#+g~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 0 |] [| 0 1 0 0 0 |] [| 0 0 1 0 0 |] [| 0 0 0 1 0 |] [| 0 0 0 0 1 |] |]++;;+;; 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))))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#+;(tensor {5 5 5 5} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2) 0 0 0 (sin θ)^2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 1 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 0 0 (* (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (sin θ)^2 0 0 0 (* -1 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (sin θ)^2 0 0 0 0 0 0 0 (* -1 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2) 0 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 (sin θ)^2 0 0 0 0 0 0 0 0 0 0 0 (* -1 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 (* -1 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 (* -1 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )~#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i j k} (contract + R~i_j_k_i)))++Ric_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature++;;+;; Weyl curvature tensor+;;+(define $δ [| [| 1 0 0 0 0 |] [| 0 1 0 0 0 |] [| 0 0 1 0 0 |] [| 0 0 0 1 0 |] [| 0 0 0 0 1 |] |])+(define $Ric~_ (with-symbols {i k h} (. g~i~h Ric_k_h)))++(define $C~___+  (with-symbols {i j k l}+    (+ R~i_j_k_l+       (* (/ -1 3) (+ (- (. δ~i_k Ric_j_l) (. δ~i_l Ric_j_k))+                      (- (. Ric~i_k g_j_l) (. Ric~i_l g_j_k))))+       (* (/ scalar-curvature 12) (- (. δ~i_k g_j_l) (. δ~i_l g_j_k))))))++C~#_#_#_#+;(tensor {5 5 5 5} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2) 0 0 0 (* 2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 2 0 0 0 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2) 0 0 0 (* 2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 2 0 0 0 0 0 0 0 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2) 0 0 0 (* -2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2) 0 0 0 0 0 0 0 (* -2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2) 0 0 0 (* -2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 (* -2 (sin θ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 (* -2 (sin θ)^2 (sin φ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (* 2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 (* -2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )~#_#_#_#++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 5)]}+  (- (sum' (map (lambda [$σ] (.' C~u_1_s_(σ 1) C~s_t_(σ 3)_(σ 2) C~t_u_(σ 5)_(σ 4))) es))+     (sum' (map (lambda [$σ] (.' C~u_1_s_(σ 1) C~s_t_(σ 3)_(σ 2) C~t_u_(σ 5)_(σ 4))) os))))+;0
+ sample/math/geometry/riemann-curvature-tensor-of-S5.egi view
@@ -0,0 +1,109 @@+;;;+;;; Parameters+;;;++(define $x [|θ φ ψ η δ|])++(define $X [|(* r (cos θ))+             (* r (sin θ) (cos φ))+             (* r (sin θ) (sin φ) (cos ψ))+             (* r (sin θ) (sin φ) (sin ψ) (cos η))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ))+             (* r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e+;[|[| (* -1 r (sin θ)) (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ) (cos ψ)) (* r (cos θ) (sin φ) (sin ψ) (cos η)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (cos δ)) (* r (cos θ) (sin φ) (sin ψ) (sin η) (sin δ)) |]+;  [| 0 (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ) (cos ψ)) (* r (sin θ) (cos φ) (sin ψ) (cos η)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (cos δ)) (* r (sin θ) (cos φ) (sin ψ) (sin η) (sin δ)) |]+;  [| 0 0 (* -1 r (sin θ) (sin φ) (sin ψ)) (* r (sin θ) (sin φ) (cos ψ) (cos η)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (cos δ)) (* r (sin θ) (sin φ) (cos ψ) (sin η) (sin δ)) |]+;  [| 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (cos δ)) (* r (sin θ) (sin φ) (sin ψ) (cos η) (sin δ)) |]+;  [| 0 0 0 0 (* -1 r (sin θ) (sin φ) (sin ψ) (sin η) (sin δ)) (* r (sin θ) (sin φ) (sin ψ) (sin η) (cos δ)) |] |]++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {5 5}))+(define $g~~ (M.inverse g_#_#))+g_#_#;[| [| r^2 0 0 0 0 |] [| 0 (* r^2 (sin θ)^2) 0 0 0 |] [| 0 0 (* r^2 (sin θ)^2 (sin φ)^2) 0 0 |] [| 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 |] [| 0 0 0 0 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) |] |]_#_#+g~#~#;[| [| (/ 1 r^2) 0 0 0 0 |] [| 0 (/ 1 (* r^2 (sin θ)^2)) 0 0 0 |] [| 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2)) 0 0 |] [| 0 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2)) 0 |] [| 0 0 0 0 (/ 1 (* r^2 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2)) |] |]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 0 |] [| 0 1 0 0 0 |] [| 0 0 1 0 0 |] [| 0 0 0 1 0 |] [| 0 0 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_#_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| 4 0 0 0 0 |] [| 0 (* 4 (sin θ)^2) 0 0 0 |] [| 0 0 (* 4 (sin θ)^2 (sin φ)^2) 0 0 |] [| 0 0 0 (* 4 (sin θ)^2 (sin φ)^2 (sin ψ)^2) 0 |] [| 0 0 0 0 (* 4 (sin θ)^2 (sin φ)^2 (sin ψ)^2 (sin η)^2) |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ 20 r^2)++;;+;; Conformal curvature tensor+;;++(define $C_i_k_l_m+  (+ (. R_i_k_l_m)+     (+ (- (. Ric_i_m g_k_l) (. Ric_i_l g_k_m))+        (- (. Ric_k_l g_i_m) (. Ric_k_m g_i_l)))+     (* (/ scalar-curvature 2) (- (. g_i_l g_k_m) (. g_i_m g_k_l)))))++C_#_#_#_#++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 5)]}+  (- (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) es))+     (sum (map (lambda [$σ] (. R~u_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4))) os))))+;0
+ sample/math/geometry/riemann-curvature-tensor-of-S7-conformal.egi view
@@ -0,0 +1,81 @@+;;;+;;; Parameters+;;;++(define $x [|α β γ δ ε ζ η|])++(define $X [|(* r (cos α))+             (* r (sin α) (cos β))+             (* r (sin α) (sin β) (cos γ))+             (* r (sin α) (sin β) (sin γ) (cos δ))+             (* r (sin α) (sin β) (sin γ) (sin δ) (cos ε))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (cos ζ))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (sin ζ) (cos η))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (sin ζ) (sin η))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(* (a α β γ δ ε ζ η)^2 (V.* e_%1 e_%2)) {7 7}))+(define $g~~ (M.inverse g_#_#))+g_#_#;+g~#~#;++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 7)]}+  (- (sum (map (lambda [$σ] (debug (. R~v_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4) R~u_v_(σ 7)_(σ 6)))) es))+     (sum (map (lambda [$σ] (debug (. R~v_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4) R~u_v_(σ 7)_(σ 6)))) os))))+;
+ sample/math/geometry/riemann-curvature-tensor-of-S7.egi view
@@ -0,0 +1,92 @@+;;;+;;; Parameters+;;;++(define $x [|α β γ δ ε ζ η|])++(define $X [|(* r (cos α))+             (* r (sin α) (cos β))+             (* r (sin α) (sin β) (cos γ))+             (* r (sin α) (sin β) (sin γ) (cos δ))+             (* r (sin α) (sin β) (sin γ) (sin δ) (cos ε))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (cos ζ))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (sin ζ) (cos η))+             (* r (sin α) (sin β) (sin γ) (sin δ) (sin ε) (sin ζ) (sin η))+             |])++;;+;; Local basis+;;++(define $e ((flip ∂/∂) x~# X_#))+e++;;+;; Metric tensor+;;++(define $g__ (generate-tensor 2#(V.* e_%1 e_%2) {7 7}))+(define $g~~ (M.inverse g_#_#))+g_#_#;[| [| r^2 0 0 0 0 0 0 |] [| 0 (* r^2 (sin α)^2) 0 0 0 0 0 |] [| 0 0 (* r^2 (sin α)^2 (sin β)^2) 0 0 0 0 |] [| 0 0 0 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2) 0 0 0 |] [| 0 0 0 0 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2) 0 0 |] [| 0 0 0 0 0 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2) 0 |] [| 0 0 0 0 0 0 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2 (sin ζ)^2) |] |]_#_#+g~#~#;[| [| (/ 1 r^2) 0 0 0 0 0 0 |] [| 0 (/ 1 (* r^2 (sin α)^2)) 0 0 0 0 0 |] [| 0 0 (/ 1 (* r^2 (sin α)^2 (sin β)^2)) 0 0 0 0 |] [| 0 0 0 (/ 1 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2)) 0 0 0 |] [| 0 0 0 0 (/ 1 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2)) 0 0 |] [| 0 0 0 0 0 (/ 1 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2)) 0 |] [| 0 0 0 0 0 0 (/ 1 (* r^2 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2 (sin ζ)^2)) |] |]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 0 0 0 |] [| 0 1 0 0 0 0 0 |] [| 0 0 1 0 0 0 0 |] [| 0 0 0 1 0 0 0 |] [| 0 0 0 0 1 0 0 |] [| 0 0 0 0 0 1 0 |] [| 0 0 0 0 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_l x_k)+        (∂/∂ g_j_k x_l)+        (* -1 (∂/∂ g_k_l x_j)))))++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;+;[|[| 6 0 0 0 0 0 0 |]+;  [| 0 (* 6 (sin α)^2) 0 0 0 0 0 |]+;  [| 0 0 (* 6 (sin α)^2 (sin β)^2) 0 0 0 0 |]+;  [| 0 0 0 (* 6 (sin α)^2 (sin β)^2 (sin γ)^2) 0 0 0 |]+;  [| 0 0 0 0 (* 6 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2) 0 0 |]+;  [| 0 0 0 0 0 (* 6 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2) 0 |]+;  [| 0 0 0 0 0 0 (* 6 (sin α)^2 (sin β)^2 (sin γ)^2 (sin δ)^2 (sin ε)^2 (sin ζ)^2) |]+;  |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ 42 r^2)++;;+;; Wodzicki-Chern-Simons class+;;++(let {[[$es $os] (even-and-odd-permutations 7)]}+  (- (sum (map (lambda [$σ] (. R~v_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4) R~u_v_(σ 7)_(σ 6))) es))+     (sum (map (lambda [$σ] (. R~v_1_s_(σ 1) R~s_t_(σ 3)_(σ 2) R~t_u_(σ 5)_(σ 4) R~u_v_(σ 7)_(σ 6))) os))))+;0
+ sample/math/geometry/riemann-curvature-tensor-of-Schwarzschild-metric.egi view
@@ -0,0 +1,87 @@+;;;+;;; Parameters+;;;++(define $x [|t r θ φ|])++;;+;; Metric tensor+;;++(define $g__+  [|[| (/ '(- (* c^2 r) (* 2 G M)) (* c^2 r)) 0 0 0 |]+    [| 0 (/ -1 (/ '(- (* c^2 r) (* 2 G M)) (* c^2 r))) 0 0 |]+    [| 0 0 (* -1 r^2) 0 |]+    [| 0 0 0 (* -1 r^2 (sin θ)^2) |]+    |])++(define $g~~ (M.inverse g_#_#))+g~#~#+;[|[| (/ (* c^2 r) '(+ (* c^2 r) (* -2 G M))) 0 0 0 |]+;  [| 0 (/ (* -1 '(+ (* c^2 r) (* -2 G M))) (* c^2 r)) 0 0 |]+;  [| 0 0 (/ -1 r^2) 0 |]+;  [| 0 0 0 (/ -1 (* r^2 (sin θ)^2)) |]|]~#~#+++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |]++;;+;; Christoffel symbols of the first kind+;;++(define $Γ_j_k_l+  (* (/ 1 2)+     (+ (∂/∂ g_j_k x_l)+        (∂/∂ g_j_l x_k)+        (* -1 (∂/∂ g_k_l x_j)))))++Γ_1_#_#;[| [| 0 (/ (+ (* c^2 r) (* -1 '(+ (* c^2 r) (* -2 G M)))) (* 2 c^2 r^2)) 0 0 |] [| (/ (+ (* c^2 r) (* -1 '(+ (* c^2 r) (* -2 G M)))) (* 2 c^2 r^2)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#+Γ_2_#_#;[| [| (/ (+ (* -1 c^2 r) '(+ (* c^2 r) (* -2 G M))) (* 2 c^2 r^2)) 0 0 0 |] [| 0 (/ (+ (* -1 c^2 '(+ (* c^2 r) (* -2 G M))) (* c^4 r)) (* 2 '(+ (* c^2 r) (* -2 G M))^2)) 0 0 |] [| 0 0 r 0 |] [| 0 0 0 (* r (sin θ)^2) |] |]_#_#+Γ_3_#_#;[| [| 0 0 0 0 |] [| 0 0 (* -1 r) 0 |] [| 0 (* -1 r) 0 0 |] [| 0 0 0 (* r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_4_#_#;[| [| 0 0 0 0 |] [| 0 0 0 (* -1 r (sin θ)^2) |] [| 0 0 0 (* -1 r^2 (sin θ) (cos θ)) |] [| 0 (* -1 r (sin θ)^2) (* -1 r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~1_#_#;[| [| 0 (/ (+ (* c^2 r) (* -1 '(+ (* c^2 r) (* -2 G M)))) (* 2 '(+ (* c^2 r) (* -2 G M)) r)) 0 0 |] [| (/ (+ (* c^2 r) (* -1 '(+ (* c^2 r) (* -2 G M)))) (* 2 '(+ (* c^2 r) (* -2 G M)) r)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#+Γ~2_#_#;[| [| (/ (+ (* '(+ (* c^2 r) (* -2 G M)) c^2 r) (* -1 '(+ (* c^2 r) (* -2 G M))^2)) (* 2 c^4 r^3)) 0 0 0 |] [| 0 (/ (+ '(+ (* c^2 r) (* -2 G M)) (* -1 c^2 r)) (* 2 r '(+ (* c^2 r) (* -2 G M)))) 0 0 |] [| 0 0 (/ (* -1 '(+ (* c^2 r) (* -2 G M))) c^2) 0 |] [| 0 0 0 (/ (* -1 '(+ (* c^2 r) (* -2 G M)) (sin θ)^2) c^2) |] |]_#_#+Γ~3_#_#;[| [| 0 0 0 0 |] [| 0 0 (/ 1 r) 0 |] [| 0 (/ 1 r) 0 0 |] [| 0 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~4_#_#;[| [| 0 0 0 0 |] [| 0 0 0 (/ 1 r) |] [| 0 0 0 (/ (cos θ) (sin θ)) |] [| 0 (/ 1 r) (/ (cos θ) (sin θ)) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (expand-all (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+                   (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l))))))++R~#_#_1_1;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (/ (* 2 G M) (+ (* c^2 r^3) (* -2 G M r^2))) 0 0 |] [| (/ (+ (* 2 G M c^2 r) (* -4 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_3;[| [| 0 0 (/ (* -1 G M) (* c^2 r)) 0 |] [| 0 0 0 0 |] [| (/ (+ (* -1 G M c^2 r) (* 2 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_1_4;[| [| 0 0 0 (/ (* -1 G M (sin θ)^2) (* c^2 r)) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| (/ (+ (* -1 G M c^2 r) (* 2 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (/ (* -2 G M) (+ (* c^2 r^3) (* -2 G M r^2))) 0 0 |] [| (/ (+ (* -2 G M c^2 r) (* 4 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_3;[| [| 0 0 0 0 |] [| 0 0 (/ (* -1 G M) (* c^2 r)) 0 |] [| 0 (/ (* G M) (+ (* r^3 c^2) (* -2 r^2 G M))) 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_2_4;[| [| 0 0 0 0 |] [| 0 0 0 (/ (* -1 G M (sin θ)^2) (* c^2 r)) |] [| 0 0 0 0 |] [| 0 (/ (* G M) (+ (* r^3 c^2) (* -2 r^2 G M))) 0 0 |] |]~#_#+R~#_#_3_1;[| [| 0 0 (/ (* G M) (* c^2 r)) 0 |] [| 0 0 0 0 |] [| (/ (+ (* G M c^2 r) (* -2 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_2;[| [| 0 0 0 0 |] [| 0 0 (/ (* G M) (* r c^2)) 0 |] [| 0 (/ (* -1 G M) (+ (* r^3 c^2) (* -2 r^2 G M))) 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#+R~#_#_3_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (/ (* 2 G M (sin θ)^2) (* c^2 r)) |] [| 0 0 (/ (* -2 G M) (* c^2 r)) 0 |] |]~#_#+R~#_#_4_1;[| [| 0 0 0 (/ (* G M (sin θ)^2) (* c^2 r)) |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| (/ (+ (* G M c^2 r) (* -2 G^2 M^2)) (* c^4 r^4)) 0 0 0 |] |]~#_#+R~#_#_4_2;[| [| 0 0 0 0 |] [| 0 0 0 (/ (* G M (sin θ)^2) (* r c^2)) |] [| 0 0 0 0 |] [| 0 (/ (* -1 G M) (+ (* r^3 c^2) (* -2 r^2 G M))) 0 0 |] |]~#_#+R~#_#_4_3;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 (/ (* -2 G M (sin θ)^2) (* c^2 r)) |] [| 0 0 (/ (* 2 G M) (* c^2 r)) 0 |] |]~#_#+R~#_#_4_4;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]~#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#
+ sample/math/geometry/riemann-curvature-tensor-of-T2.egi view
@@ -0,0 +1,126 @@+;;;+;;; Coordinates for Torus+;;;++(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 of the first kind+;;++(define $Γ_i_j_k+  (* (/ 1 2)+     (+ (∂/∂ g_i_j x_k)+        (∂/∂ g_i_k x_j)+        (* -1 (∂/∂ g_j_k x_i)))))++Γ_#_#_#;(tensor {2 2 2} {0 0 0 (* '(+ (* a (cos θ)) b) a (sin θ)) 0 (* -1 '(+ (* a (cos θ)) b) a (sin θ)) (* -1 '(+ (* a (cos θ)) b) a (sin θ)) 0} )_#_#_#+Γ_1_#_#;[| [| 0 0 |] [| 0 (* '(+ (* a (cos θ)) b) a (sin θ)) |] |]_#_#+Γ_2_#_#;[| [| 0 (* -1 '(+ (* a (cos θ)) b) a (sin θ)) |] [| (* -1 '(+ (* a (cos θ)) b) a (sin θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__ (with-symbols {i} (. g~#~i Γ_i_#_#)))++Γ~#_#_#;(tensor {2 2 2} {0 0 0 (/ (* '(+ (* a (cos θ)) b) (sin θ)) a) 0 (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) 0} )~#_#_#+Γ~1_#_#;[| [| 0 0 |] [| 0 (/ (* '(+ (* a (cos θ)) b) (sin θ)) a) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) |] [| (/ (* -1 a (sin θ)) '(+ (* a (cos θ)) b)) 0 |] |]_#_#++;;+;; Covariant derivative of metric tensor+;;+(define $∇g___+  (with-symbols {i j m n}+    (- (∂/∂ g_i_j x_m)+       (. Γ~n_m_i g_n_j)+       (. Γ~n_m_j g_i_n))))++∇g_#_#_#;=>(tensor {2 2 2} {0 0 0 0 0 0 0 0} )++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#;(tensor {2 2 2 2} {0 0 0 0 0 (/ (* '(+ (* a (cos θ)) b) (cos θ)) a) (/ (* -1 '(+ (* a (cos θ)) b) (cos θ)) a) 0 0 (/ (* -1 a (cos θ)) '(+ (* a (cos θ)) b)) (/ (* a (cos θ)) '(+ (* a (cos θ)) b)) 0 0 0 0 0} )~#_#_#_#+R~#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]~#_#+R~#_#_1_2;[| [| 0 (/ (* '(+ (* a (cos θ)) b) (cos θ)) a) |] [| (/ (* -1 a (cos θ)) '(+ (* a (cos θ)) b)) 0 |] |]~#_#+R~#_#_2_1;[| [| 0 (/ (* -1 '(+ (* a (cos θ)) b) (cos θ)) a) |] [| (/ (* a (cos θ)) '(+ (* a (cos θ)) b)) 0 |] |]~#_#+R~#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]~#_#++(define $R____ (with-symbols {i} (. g_i_# R~i_#_#_#)))++R_#_#_#_#;(tensor {2 2 2 2} {0 0 0 0 0 (* a '(+ (* a (cos θ)) b) (cos θ)) (* -1 a '(+ (* a (cos θ)) b) (cos θ)) 0 0 (* -1 '(+ (* a (cos θ)) b) a (cos θ)) (* '(+ (* a (cos θ)) b) a (cos θ)) 0 0 0 0 0} )_#_#_#_#+R_#_#_1_1;[| [| 0 0 |] [| 0 0 |] |]_#_#+R_#_#_1_2;[| [| 0 (* a '(+ (* a (cos θ)) b) (cos θ)) |] [| (* -1 '(+ (* a (cos θ)) b) a (cos θ)) 0 |] |]_#_#+R_#_#_2_1;[| [| 0 (* -1 a '(+ (* a (cos θ)) b) (cos θ)) |] [| (* '(+ (* a (cos θ)) b) a (cos θ)) 0 |] |]_#_#+R_#_#_2_2;[| [| 0 0 |] [| 0 0 |] |]_#_#++;;+;; Ricci curvature+;;++(define $Ric__ (with-symbols {i} (contract + R~i_#_i_#)))++Ric_#_#;[| [| (/ (* a (cos θ)) '(+ (* a (cos θ)) b)) 0 |] [| 0 (/ (* '(+ (* a (cos θ)) b) (cos θ)) a) |] |]_#_#++;;+;; Scalar curvature+;;++(define $scalar-curvature (with-symbols {j k} (. g~j~k Ric_j_k)))++scalar-curvature;(/ (* 2 (cos θ)) (* a '(+ (* a (cos θ)) b)))++;;+;; Covariant derivative of Riemann curvature tensor+;;++(define $∇R_____+  (with-symbols {i j k l m n}+    (- (∂/∂ R_i_j_k_l x_m)+       (. Γ~n_m_i R_n_j_k_l)+       (. Γ~n_m_j R_i_n_k_l)+       (. Γ~n_m_k R_i_j_n_l)+       (. Γ~n_m_l R_i_j_k_n))))++∇R_#_#_#_#_#+;(tensor {2 2 2 2 2} {0 0 0 0 0 0 0 0 0 0 (+ (* -1 a '(+ (* a (cos θ)) b) (sin θ)) (* a^2 (sin θ) (cos θ))) 0 (+ (* a '(+ (* a (cos θ)) b) (sin θ)) (* -1 a^2 (sin θ) (cos θ))) 0 0 0 0 0 (+ (* '(+ (* a (cos θ)) b) a (sin θ)) (* -1 a^2 (sin θ) (cos θ))) 0 (+ (* -1 '(+ (* a (cos θ)) b) a (sin θ)) (* a^2 (sin θ) (cos θ))) 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#_#++;;+;; Second Bianchi identity+;;++(with-symbols {i j k l m} (+ ∇R_i_j_k_l_m ∇R_i_j_l_m_k ∇R_i_j_m_k_l))+;(tensor {2 2 2 2 2} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )
+ sample/math/geometry/riemann-curvature-tensor-of-empty-Schwarzschild-spacetime.egi view
@@ -0,0 +1,68 @@+;;;+;;; Parameters+;;;++(define $x [|t r θ φ|])++;;+;; Metric tensor+;;++(define $g__+  [|[| 1 0 0 0 |]+    [| 0 -1 0 0 |]+    [| 0 0 (* -1 r^2) 0 |]+    [| 0 0 0 (* -1 r^2 (sin θ)^2) |]+    |])++(define $g~~ (M.inverse g_#_#))+g~#~#+;[|[| 1 0 0 0 |]+;  [| 0 -1 0 0 |]+;  [| 0 0 (/ 1 (* -1 r^2)) 0 |]+;  [| 0 0 0 (/ 1 (* -1 r^2 (sin θ)^2)) |]+;  |]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |]++;;+;; 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))))))++Γ_1_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#+Γ_2_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 r 0 |] [| 0 0 0 (* r (sin θ)^2) |] |]_#_#+Γ_3_#_#;[| [| 0 0 0 0 |] [| 0 0 (* -1 r) 0 |] [| 0 (* -1 r) 0 0 |] [| 0 0 0 (* r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_4_#_#;[| [| 0 0 0 0 |] [| 0 0 0 (* -1 r (sin θ)^2) |] [| 0 0 0 (* -1 r^2 (sin θ) (cos θ)) |] [| 0 (* -1 r (sin θ)^2) (* -1 r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~1_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]_#_#+Γ~2_#_#;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 (* -1 r) 0 |] [| 0 0 0 (* -1 r (sin θ)^2) |] |]_#_#+Γ~3_#_#;[| [| 0 0 0 0 |] [| 0 0 (/ -1 (* -1 r)) 0 |] [| 0 (/ -1 (* -1 r)) 0 0 |] [| 0 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~4_#_#;[| [| 0 0 0 0 |] [| 0 0 0 (/ -1 (* -1 r)) |] [| 0 0 0 (/ (* -1 (cos θ)) (* -1 (sin θ))) |] [| 0 (/ -1 (* -1 r)) (/ (* -1 (cos θ)) (* -1 (sin θ))) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))+++R~#_#_#_#;(tensor {4 4 4 4} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )~#_#_#_#
+ sample/math/geometry/riemann-curvature-tensor-of-spherical-space.egi view
@@ -0,0 +1,62 @@+;;;+;;; Parameters+;;;++(define $x [|r θ φ|])++;;+;; Metric tensor+;;++(define $g__+  [|[| 1 0 0 |]+    [| 0 r^2 0 |]+    [| 0 0 (* r^2 (sin θ)^2) |]+    |])++(define $g~~ (M.inverse g_#_#))+g~#~#+;[|[| 1 0 0 |]+;  [| 0 (/ 1 r^2) 0 |]+;  [| 0 0 (/ 1 (* r^2 (sin θ)^2)) |]|]~#~#++(with-symbols {i j k} (. g~i~j g_j_k))+;[| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |]++;;+;; 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))))))++Γ_1_#_#;[| [| 0 0 0 |] [| 0 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#+Γ_2_#_#;[| [| 0 r 0 |] [| r 0 0 |] [| 0 0 (* -1 r^2 (sin θ) (cos θ)) |] |]_#_#+Γ_3_#_#;[| [| 0 0 (* r (sin θ)^2) |] [| 0 0 (* r^2 (sin θ) (cos θ)) |] [| (* r (sin θ)^2) (* r^2 (sin θ) (cos θ)) 0 |] |]_#_#++;;+;; Christoffel symbols of the second kind+;;++(define $Γ~__+  (with-symbols {i j k l}+    (. g~i~j Γ_j_k_l)))++Γ~1_#_#;[| [| 0 0 0 |] [| 0 (* -1 r) 0 |] [| 0 0 (* -1 r (sin θ)^2) |] |]_#_#+Γ~2_#_#;[| [| 0 (/ 1 r) 0 |] [| (/ 1 r) 0 0 |] [| 0 0 (* -1 (sin θ) (cos θ)) |] |]_#_#+Γ~3_#_#;[| [| 0 0 (/ 1 r) |] [| 0 0 (/ (cos θ) (sin θ)) |] [| (/ 1 r) (/ (cos θ) (sin θ)) 0 |] |]_#_#++;;+;; Riemann curvature tensor+;;++(define $R~i_j_k_l+  (with-symbols {m}+    (+ (- (∂/∂ Γ~i_j_l x_k) (∂/∂ Γ~i_j_k x_l))+       (- (. Γ~m_j_l Γ~i_m_k) (. Γ~m_j_k Γ~i_m_l)))))++R~#_#_#_#;(tensor {3 3 3 3} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )~#_#_#_#
+ sample/math/geometry/surface.egi view
@@ -0,0 +1,55 @@+; We can bound f to a specific function.+; (define $f (lambda [$x $y] (+ (** x 2) (** y 2))))++(define $v1 [| 1 0 (∂/∂ (f x y) x) |])+(define $v2 [| 0 1 (∂/∂ (f x y) y) |])++v1;[| 1 0 (f|1 x y) |]+v2;[| 0 1 (f|2 x y) |]++(define $v3 (cross-product v1 v2))++v3;[| (* -1 (f|1 x y)) (* -1 (f|2 x y)) 1 |]++(define $e3 (/ v3 (sqrt '(V.* v3 v3))))++e3+;[|(/ (* -1 (f|1 x y))+;     (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))+;  (/ (* -1 (f|2 x y))+;     (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))+;  (/ 1+;     (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))|]++(define $E (V.* v1 v1))+(define $F (V.* v1 v2))+(define $G (V.* v2 v2))++E;(+ 1 (f|1 x y)^2)+F;(* (f|1 x y) (f|2 x y)+G;(+ 1 (f|2 x y)^2)++(define $L (V.* (∂/∂ v1 x) e3))+(define $M (V.* (∂/∂ v1 y) e3))+;(define $M (V.* (∂/∂ v2 x) e3))+(define $N (V.* (∂/∂ v2 y) e3))++L;(/ (f|1|1 x y) (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))+M;(/ (f|1|2 x y) (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))+N;(/ (f|2|2 x y) (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1)))++(define $K (/ (- (* L N) (** M 2))+              '(- (* E G) (** F 2))))+(define $H (/ (+ (* 'E N) (* 'G L) (* -2 F M))+              (* 2 '(- (* E G) (** F 2)))))++K+;(/ (+ (* (f|1|1 x y) (f|2|2 x y)) (* -1 (f|1|2 x y)^2))+;   '(+ (f|1 x y)^2 (f|2 x y)^2 1)^2)+H+;(/ (+ (* '(+ 1 (f|1 x y)^2) (f|2|2 x y))+;      (* '(+ 1 (f|2 x y)^2) (f|1|1 x y))+;      (* -2 (f|1 x y) (f|2 x y) (f|1|2 x y)))+;   (* 2+;      (sqrt '(+ (f|1 x y)^2 (f|2 x y)^2 1))+;      '(+ 1 (f|2 x y)^2 (f|1 x y)^2)))
+ sample/math/geometry/trigonometric-identities.egi view
@@ -0,0 +1,42 @@+(coefficients (* (+ (cos α) (* i (sin α))) (+ (cos β) (* i (sin β))))+              i)+;{(+ (* (cos α) (cos β)) (* -1 (sin α) (sin β))) (+ (* (cos α) (sin β)) (* (sin α) (cos β)))}++;(cos (+ α β)) = (+ (* (cos α) (cos β)) (* -1 (sin α) (sin β)))+;(sin (+ α β)) = (+ (* (cos α) (sin β)) (* (sin α) (cos β)))+++(coefficients (* (+ (cos α) (* i (sin α))) (- (cos β) (* i (sin β))))+              i)+;{(+ (* (cos α) (cos β)) (* (sin α) (sin β))) (+ (* -1 (cos α) (sin β)) (* (sin α) (cos β)))}++;(cos (- α β)) = (+ (* (cos α) (cos β)) (* (sin α) (sin β)))+;(sin (- α β)) = (+ (* -1 (cos α) (sin β)) (* (sin α) (cos β)))+++(coefficients (+ (* (+ (cos α) (* i (sin α))) (+ (cos β) (* i (sin β))))+                 (* (+ (cos α) (* i (sin α))) (- (cos β) (* i (sin β)))))+              i)+;{(* 2 (cos α) (cos β)) (* 2 (sin α) (cos β))}++;(* (cos α) (cos β)) = (* (/ 1 2) (+ (cos (+ α β)) (cos (- α β))))+;(* (sin α) (cos β)) = (* (/ 1 2) (+ (sin (+ α β)) (sin (- α β))))+++(coefficients (- (* (+ (cos α) (* i (sin α))) (+ (cos β) (* i (sin β))))+                 (* (+ (cos α) (* i (sin α))) (- (cos β) (* i (sin β)))))+              i)+;{(* -2 (sin α) (sin β)) (* 2 (cos α) (sin β))}++;(* (sin α) (sin β)) = (* (/ -1 2) (- (cos (+ α β)) (cos (- α β))))+;(* (cos α) (sin β)) = (* (/  1 2) (- (sin (+ α β)) (sin (- α β))))+++(coefficients (** (+ (cos α) (* i (sin α))) 3)+              i)+;{(+ (cos α)^3 (* -3 (cos α) (sin α)^2)) (+ (* 3 (cos α)^2 (sin α)) (* -1 (sin α)^3))}++;(cos (* 3 α)) = (+ (cos α)^3 (* -3 (cos α) (sin α)^2))+;              = (+ (* 4 (cos α)^3) (* -3 (cos α)))+;(sin (* 3 α)) = (+ (* 3 (cos α)^2 (sin α)) (* -1 (sin α)^3))+;              = (+ (* -4 (sin α)^3 (* 3 (sin α))))
+ sample/math/geometry/vector-analysis.egi view
@@ -0,0 +1,57 @@+(define $N 3)++(define $g [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |])++(define $d+  (lambda [%X]+    !((flip ∂/∂) [| x y z |] X)))++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (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 $grad d)+(define $rot d)+(define $div δ)++(define $Δ+  (lambda [%A]+    (match (tensor-order A) integer+      {[,0 (δ (d A))]+       [,N (d (δ A))]+       [_ (+ (d (δ A)) (δ (d A)))]})))++(grad (+ (** x 2) (** y 2) (** z 2)))+;[| (* 2 x) (* 2 y) (* 2 z) |]++(rot [| (** y 2) (** x 2) 0 |])+;[| [| 0 (* 2 x) 0 |] [| (* 2 y) 0 0 |] [| 0 0 0 |] |]++(div [| (** y 2) (** x 2) 0 |])+;0++(rot [| (** x 2) (** y 2) (** z 2) |])+;[| [| (* 2 x) 0 0 |] [| 0 (* 2 y) 0 |] [| 0 0 (* 2 z) |] |]++(div [| (** x 2) (** y 2) (** z 2) |])+;(+ (* 2 z) (* 2 y) (* 2 x))++(rot [| (* x 2) (* y 2) (* z 2) |])+;[| [| 2 0 0 |] [| 0 2 0 |] [| 0 0 2 |] |]++(div [| (* x 2) (* y 2) (* z 2) |])+;6++(Δ (+ (** x 2) (** y 2) (** z 2)))+;6
+ sample/math/geometry/wedge-product.egi view
@@ -0,0 +1,23 @@+(define $N 3)+(define $params [| x y z |])+(define $g [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |])++(define $wedge+  (lambda [%X %Y]+    !(. X Y)))++(define $dx [| 1 0 0 |])+(define $dy [| 0 1 0 |])+(define $dz [| 0 0 1 |])++(wedge dx dy)+;[| [| 0 1 0 |] [| 0 0 0 |] [| 0 0 0 |] |]++(df-normalize (wedge dx dy))+;[| [| 0 (/ 1 2) 0 |] [| (/ -1 2) 0 0 |] [| 0 0 0 |] |]++(wedge dz dz)+;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 1 |] |]++(df-normalize (wedge dz dz))+;[| [| 0 0 0 |] [| 0 0 0 |] [| 0 0 0 |] |]
+ sample/math/geometry/yang-mills-equation-of-U1-gauge-theory.egi view
@@ -0,0 +1,77 @@+(define $N 4)++(define $g [| [| -1 0 0 0 |] [| 0 1 0 0 |] [| 0 0 1 0 |] [| 0 0 0 1 |] |])++(define $d+  (lambda [%X]+    !((flip ∂/∂) [| t x y z |] X)))++(define $hodge+  (lambda [%A]+    (let {[$k (df-order A)]}+      (with-symbols {i j}+        (* (sqrt (abs (M.det g_#_#)))+           (foldl . (. (subrefs A (map 1#j_%1 (between 1 k)))+                       (subrefs (ε' N k) (map 1#i_%1 (between 1 N))))+                  (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 (dfr-order A) integer+      {[,0 (δ (d A))]+       [,4 (d (δ A))]+       [_ (+ (d (δ A)) (δ (d A)))]})))++(define $normalize2+  (lambda [%A]+    (with-symbols {t1 t2}+      (- A_t1_t2 A_t2_t1))))++; *(dt^dx) = -dy^dz+(hodge (wedge [| 1 0 0 0 |] [| 0 1 0 0 |]))+;[| [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 -1 |] [| 0 0 0 0 |] |]++; *(dy^dz) = dt^dx+(hodge (wedge [| 0 0 1 0 |] [| 0 0 0 1 |]))+;[| [| 0 1 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] [| 0 0 0 0 |] |]++(df-normalize (d [| (φ t x y z) (Ax t x y z) (Ay t x y z) (Az t x y z) |]))+;[|[| 0 (+ (Ax|1 t x y z) (* -1 (φ|2 t x y z))) (+ (Ay|1 t x y z) (* -1 (φ|3 t x y z))) (+ (Az|1 t x y z) (* -1 (φ|4 t x y z))) |]+;  [| (+ (φ|2 t x y z) (* -1 (Ax|1 t x y z))) 0 (+ (Ay|2 t x y z) (* -1 (Ax|3 t x y z))) (+ (Az|2 t x y z) (* -1 (Ax|4 t x y z))) |]+;  [| (+ (φ|3 t x y z) (* -1 (Ay|1 t x y z))) (+ (Ax|3 t x y z) (* -1 (Ay|2 t x y z))) 0 (+ (Az|3 t x y z) (* -1 (Ay|4 t x y z))) |]+;  [| (+ (φ|4 t x y z) (* -1 (Az|1 t x y z))) (+ (Ax|4 t x y z) (* -1 (Az|2 t x y z))) (+ (Ay|4 t x y z) (* -1 (Az|3 t x y z))) 0 |]|]++(define $F+  [|[| 0 (Ex t x y z) (Ey t x y z) (Ez t x y z) |]+    [| (* -1 (Ex t x y z)) 0 (Bz t x y z) (* -1 (By t x y z)) |]+    [| (* -1 (Ey t x y z)) (* -1 (Bz t x y z)) 0 (Bx t x y z) |]+    [| (* -1 (Ez t x y z)) (By t x y z) (* -1 (Bx t x y z)) 0 |]+    |])++(hodge (d F))+;[|(+ (* -2 (Bz|4 t x y z)) (* -2 (By|3 t x y z)) (* -2 (Bx|2 t x y z)))+;  (+ (* -2 (Ey|4 t x y z)) (* 2 (Ez|3 t x y z)) (* -2 (Bx|1 t x y z)))+;  (+ (* 2 (Ex|4 t x y z)) (* -2 (Ez|2 t x y z)) (* -2 (By|1 t x y z)))+;  (+ (* -2 (Ex|3 t x y z)) (* 2 (Ey|2 t x y z)) (* -2 (Bz|1 t x y z)))|]++;(∇ B) = 0+;(rot x E) = ∂t B+;(rot y E) = ∂t B+;(rot z E) = ∂t B++(δ F)+;[|(+ (* -2 (Ez|4 t x y z)) (* -2 (Ey|3 t x y z)) (* -2 (Ex|2 t x y z)))+;  (+ (* 2 (By|4 t x y z)) (* -2 (Bz|3 t x y z)) (* -2 (Ex|1 t x y z)))+;  (+ (* -2 (Bx|4 t x y z)) (* 2 (Bz|2 t x y z)) (* -2 (Ey|1 t x y z)))+;  (+ (* 2 (Bx|3 t x y z)) (* -2 (By|2 t x y z)) (* -2 (Ez|1 t x y z)))|]++;(∇ E) = 0+;(rot x B) = ∂t E+;(rot y B) = ∂t E+;(rot z B) = ∂t E
+ sample/math/number/10bonacci.egi view
@@ -0,0 +1,37 @@+(define $m 10)++(define $A+  (generate-tensor+    (match-lambda [integer integer]+      {[[,1 _] 1]+       [[$x ,(- x 1)] 1]+       [[_ _] 0]})+    {m m}))++A+;[| [| 1 1 1 1 1 1 1 1 1 1 |] [| 1 0 0 0 0 0 0 0 0 0 |] [| 0 1 0 0 0 0 0 0 0 0 |] [| 0 0 1 0 0 0 0 0 0 0 |] [| 0 0 0 1 0 0 0 0 0 0 |] [| 0 0 0 0 1 0 0 0 0 0 |] [| 0 0 0 0 0 1 0 0 0 0 |] [| 0 0 0 0 0 0 1 0 0 0 |] [| 0 0 0 0 0 0 0 1 0 0 |] [| 0 0 0 0 0 0 0 0 1 0 |] |]++(define $B+  (generate-tensor+    (match-lambda integer+      {[,1 1]+       [_ 0]})+    {m}))++B+;[| 1 0 0 0 0 0 0 0 0 0 |]++(M.* A B)+;[| 1 1 0 0 0 0 0 0 0 0 |]++(define $M.*-mod+  (lambda [%m1 %m2]+    (modulo (b..' m1~#~j m2_j) (** 10 9))))++(M.*-mod A A)+;[| [| 2 2 2 2 2 2 2 2 2 1 |] [| 1 1 1 1 1 1 1 1 1 1 |] [| 1 0 0 0 0 0 0 0 0 0 |] [| 0 1 0 0 0 0 0 0 0 0 |] [| 0 0 1 0 0 0 0 0 0 0 |] [| 0 0 0 1 0 0 0 0 0 0 |] [| 0 0 0 0 1 0 0 0 0 0 |] [| 0 0 0 0 0 1 0 0 0 0 |] [| 0 0 0 0 0 0 1 0 0 0 |] [| 0 0 0 0 0 0 0 1 0 0 |] |]++(M.* (repeated-squaring M.*-mod A 10) B)+;[| 512 256 128 64 32 16 8 4 2 1 |]~#+(M.* (repeated-squaring M.*-mod A (** 10 18)) B)+;[| 781174235709863749 377867955633934335 842430993012717568 732703024915201024 898916287400615936 291801846997259776 348909715528105216 288982486365729408 408131585481965832 584591530883971372 |]
+ sample/math/number/11th-root-of-unity.egi view
@@ -0,0 +1,54 @@+;(gen-cyclic-group (map 1#(modulo (* %1 2) 11) (between 1 10)))+;++(define $z (rtu 11))+(define $k (rtu 5))++(define $a11 (+ z^1 z^10))+(define $a12 (+ z^2 z^9))+(define $a13 (+ z^3 z^8))+(define $a14 (+ z^4 z^7))+(define $a15 (+ z^5 z^6))++(define $b10 (+ a11 a12 a13 a14 a15))++(define $b10' -1);-1++(define $b11 (+ a11 (* k a12) (* k^2 a13) (* k^3 a14)  (* k^4 a15)))+(define $b12 (+ a15 (* k a11) (* k^2 a12) (* k^3 a13)  (* k^4 a14)));(* k b11)+(define $b13 (+ a14 (* k a15) (* k^2 a11) (* k^3 a12)  (* k^4 a13)));(* k^2 b11)+(define $b14 (+ a13 (* k a14) (* k^2 a15) (* k^3 a11)  (* k^4 a12)));(* k^3 b11)+(define $b15 (+ a12 (* k a13) (* k^2 a14) (* k^3 a15)  (* k^4 a11)));(* k^4 b11)++b11+(* b11 b12)++(rt 5 (* -1 b11 b12 b13 b14 b15));+(define $b11' (rt 3 (+ 7 (* 21 w^2))))++(define $b14 (+ a11 (* w a13) (* w^2 a12)))+(define $b15 (+ a12 (* w a11) (* w^2 a13)));(* w b14)+(define $b16 (+ a13 (* w a12) (* w^2 a11)));(* w^2 b14)++;(rt 3 (* b14 b15 b16));(rt 3 (+ 7 (* 21 w)))+(define $b14' (rt 3 (+ 7 (* 21 w))))++(define $a11' (/ (+ b10' b11' b14') 3));;/ (+ -1 (rt 3 (+ 7 (* 21 w^2))) (rt 3 (+ 7 (* 21 w)))) 3)++(define $z1' (fst (q-f' 1 (* -1 a11') 1)))++z1'+;(/ (+ -1 (rt 3 (+ 7 (* 21 w^2))) (rt 3 (+ 7 (* 21 w))) (sqrt (+ -35 (* -2 (rt 3 (+ 7 (* 21 w^2)))) (* -2 (rt 3 (+ 7 (* 21 w)))) (rt 3 (+ 7 (* 21 w^2)))^2 (* 2 (rt 3 (+ 7 (* 21 w^2))) (rt 3 (+ 7 (* 21 w)))) (rt 3 (+ 7 (* 21 w)))^2))) 6)++(/ (+ -1+      (rt 3 (+ 7 (* 21 w^2)))+      (rt 3 (+ 7 (* 21 w)))+      (sqrt (+ -35+               (* -2 (rt 3 (+ 7 (* 21 w^2))))+               (* -2 (rt 3 (+ 7 (* 21 w))))+               (rt 3 (+ 7 (* 21 w^2)))^2+               (* 2 (rt 3 (+ 7 (* 21 w^2))) (rt 3 (+ 7 (* 21 w))))+               (rt 3 (+ 7 (* 21 w)))+               ^2))+      )+   6)
+ sample/math/number/17th-root-of-unity.egi view
@@ -0,0 +1,76 @@+;(gen-cyclic-group (map 1#(modulo (* %1 11) 17) (between 1 16)))+;{{11 5 16 10 4 15 9 3 14 8 2 13 7 1 12 6} {2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15} {5 10 15 3 8 13 1 6 11 16 4 9 14 2 7 12} {4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13} {10 3 13 6 16 9 2 12 5 15 8 1 11 4 14 7} {8 16 7 15 6 14 5 13 4 12 3 11 2 10 1 9} {3 6 9 12 15 1 4 7 10 13 16 2 5 8 11 14} {16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1} {6 12 1 7 13 2 8 14 3 9 15 4 10 16 5 11} {15 13 11 9 7 5 3 1 16 14 12 10 8 6 4 2} {12 7 2 14 9 4 16 11 6 1 13 8 3 15 10 5} {13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4} {7 14 4 11 1 8 15 5 12 2 9 16 6 13 3 10} {9 1 10 2 11 3 12 4 13 5 14 6 15 7 16 8} {14 11 8 5 2 16 13 10 7 4 1 15 12 9 6 3} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}}++(define $z (rtu 17))++;(gen-cyclic-group {16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1})+;{{16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}}+(define $a1 (+ z^1 z^16))+(define $a2 (+ z^2 z^15))+(define $a3 (+ z^3 z^14))+(define $a4 (+ z^4 z^13))+(define $a5 (+ z^5 z^12))+(define $a6 (+ z^6 z^11))+(define $a7 (+ z^7 z^10))+(define $a8 (+ z^8 z^9))++;(gen-cyclic-group {4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13})+;{{4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13} {16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1} {13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}}+(define $b11 (+ a1 a4))+(define $b12 (- a1 a4));(** b12 2);(+ 4 b21 (* -2 b31))++(define $b21 (+ a2 a8))+(define $b22 (- a2 a8));(** b22 2);(+ 4 b21 (* -2 b41))++(define $b31 (+ a3 a5))+(define $b32 (- a3 a5));(** b32 2);(+ 4 b41 (* -2 b21))++(define $b41 (+ a6 a7))+(define $b42 (- a6 a7));(** b42 2);(+ 4 b31 (* -2 b21))++;(gen-cyclic-group {2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15})+;{{2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15} {4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13} {8 16 7 15 6 14 5 13 4 12 3 11 2 10 1 9} {16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1} {15 13 11 9 7 5 3 1 16 14 12 10 8 6 4 2} {13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4} {9 1 10 2 11 3 12 4 13 5 14 6 15 7 16 8} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}}+(define $c11 (+ b11 b21))+(define $c12 (- b11 b21));(+ 8 (* -1 c11'))++(define $c21 (+ b31 b41))+(define $c22 (- b31 b41));(+ 8 (* -1 c21'))++(define $d10 (+ c11 c21));-1+(define $d11 (- c11 c21))+(define $d12 (- c21 c11))++(define $d10' -1)++;(define $d11' (sqrt (* -1 d11 d12)));(sqrt 17)+(define $d11' (sqrt 17))++(define $c11' (/ (+ d10' d11') 2));(/ (+ -1 (sqrt 17)) 2)+(define $c21' (/ (- d10' d11') 2));(/ (+ -1 (* -1 (sqrt 17))) 2)++(define $c12' (sqrt (+ 8 (* -1 c11'))));(/ (sqrt (+ 34 (* -2 (sqrt 17)))) 2)+(define $c22' (sqrt (+ 8 (* -1 c21'))));(/ (sqrt (+ 34 (* 2 (sqrt 17)))) 2)++(define $b11' (/ (+ c11' c12') 2));(/ (+ -1 (sqrt 17) (sqrt (+ 34 (* -2 (sqrt 17))))) 4)+(define $b21' (/ (- c11' c12') 2));(/ (+ -1 (sqrt 17) (* -1 (sqrt (+ 34 (* -2 (sqrt 17)))))) 4)+(define $b31' (/ (+ c21' c22') 2));(/ (+ -1 (* -1 (sqrt 17)) (sqrt (+ 34 (* 2 (sqrt 17))))) 4)+(define $b41' (/ (- c21' c22') 2));(/ (+ -1 (* -1 (sqrt 17)) (* -1 (sqrt (+ 34 (* 2 (sqrt 17)))))) 4)++(define $b12' (sqrt (+ 4 b21' (* -2 b31'))))+(define $b22' (sqrt (+ 4 b21' (* -2 b41'))))+(define $b32' (sqrt (+ 4 b41' (* -2 b21'))))+(define $b42' (sqrt (+ 4 b31' (* -2 b21'))))++(define $a1' (/ (+ b11' b12') 2))++a1';(+ z z^16) = (* 2 (cos (/ (* 2 pi) 17)))+;(/ (+ -1 (sqrt 17) (sqrt (+ 34 (* -2 (sqrt 17)))) (* 2 (sqrt (+ 17 (* 3 (sqrt 17)) (* -1 (sqrt (+ 34 (* -2 (sqrt 17))))) (* -2 (sqrt (+ 34 (* 2 (sqrt 17))))))))) 8)++(/ (+ -1+      (sqrt 17)+      (sqrt (+ 34 (* -2 (sqrt 17))))+      (* 2 (sqrt (+ 17+                    (* 3 (sqrt 17))+                    (* -1 (sqrt (+ 34 (* -2 (sqrt 17)))))+                    (* -2 (sqrt (+ 34 (* 2 (sqrt 17)))))))))+   8)
+ sample/math/number/5th-root-of-unity.egi view
@@ -0,0 +1,44 @@+;(gen-cyclic-group (map 1#(modulo (* %1 2) 5) (between 1 4)))+;{{2 4 1 3} {4 3 2 1} {3 1 4 2} {1 2 3 4}}++(define $z (rtu 5))++(define $a11 (+ z^1 z^4))+(define $a12 (+ z^2 z^3))++(define $b10 (+ a11 a12))+(define $b11 (- a11 a12))+(define $b12 (- a12 a11))++(define $b10' -1);-1+(define $b11' (sqrt (** b11 2)));(sqrt 5)++(define $a11' (/ (+ b10' b11') 2));(/ (+ -1 (sqrt 5)) 2)+(define $a12' (/ (- b10' b11') 2));(/ (+ -1 (* -1 (sqrt 5))) 2)++(define $a21 (- z^1 z^4))+(define $a22 (- z^2 z^3))++(define $b20 (+ a21 a22))+(define $b21 (- a21 a22))+(define $b22 (- a22 a21))++;(define $b20' (sqrt (* -1 b20 b20)));(sqrt (+ (* -3 (rtu 5)^2) 4 (* -3 (rtu 5)^3) (rtu 5)^4 (rtu 5)))+(define $b20' (sqrt (+ -3 (* 4 a12'))))+;(define $b21' (sqrt (* -1 b21 b22)));(sqrt (+ (* -1 (rtu 5)^3) (* 3 (rtu 5)^4) (* -1 (rtu 5)^2) -4 (* 3 (rtu 5))))+(define $b21' (sqrt (+ -3 (* 4 a11'))))++(define $a21' (/ (+ b20' b21') 2))+(define $a22' (/ (- b20' b21') 2))++(define $z1' (/ (+ a11' a21') 2))++z1';(/ (+ -1 (sqrt 5) (sqrt (+ -5 (* -2 (sqrt 5)))) (sqrt (+ -5 (* 2 (sqrt 5))))) 4)++(** (+ (sqrt (+ -5 (* -2 (sqrt 5)))) (sqrt (+ -5 (* 2 (sqrt 5))))) 2)+;(+ -10 (* 2 (sqrt (+ -5 (* -2 (sqrt 5)))) (sqrt (+ -5 (* 2 (sqrt 5))))))++(* (+ -5 (* -2 (sqrt 5))) (+ -5 (* 2 (sqrt 5))));5++; z1' is equal to+(/ (+ -1 (sqrt 5) (sqrt (+ -10 (* -2 (sqrt 5))))) 4)
+ sample/math/number/7th-root-of-unity-2.egi view
@@ -0,0 +1,68 @@+;(gen-cyclic-group (map 1#(modulo (* %1 3) 7) (between 1 6)))+;{{3 6 2 5 1 4} {2 4 6 1 3 5} {6 5 4 3 2 1} {4 1 5 2 6 3} {5 3 1 6 4 2} {1 2 3 4 5 6}}++(define $z (rtu 7))++(define $a11 (+ z   z^2 z^4))+(define $a12 (+ z^6 z^5 z^3))++(define $b10 (+ a11 a12));-1++(define $b10' b10)++(define $b11 (- a11 a12))+(define $b12 (- a12 a11))++(define $b11' (sqrt (** b11 2)))++(define $a11' (/ (+ b10' b11') 2));(/ (+ -1 (* i (sqrt 7))) 2)+(define $a12' (/ (- b10' b11') 2));(/ (+ -1 (* -1 i (sqrt 7))) 2)+++(define $a21 (+ z   (* w z^2) (* w^2 z^4)))+(define $a22 (+ z^6 (* w z^5) (* w^2 z^3)))++(define $b20 (+ a21 a22))+(define $b21 (- a21 a22))+(define $b22 (- a22 a21))++(define $b20' (rt 3 (** b20 3)))+;(define $b21' (rt 3 (** b21 3)))+;(** b21 3)+;(+ (* 8 (rtu 7)) (* 8 (rtu 7)^2) (* -5 (rtu 7)^3) (* 5 (rtu 7)^4) (* -8 (rtu 7)^5) (* -8 (rtu 7)^6) (* 3 (rtu 7) w) (* 3 (rtu 7)^2 w) (* -3 (rtu 7)^5 w) (* -3 (rtu 7)^6 w) (* 3 (rtu 7)^3 w^2) (* -3 (rtu 7)^4 w^2))+(define $b21' (rt 3 (+ (* 5 a11') (* -5 a12') (* w^2 -3 a11') (* w^2 3 a12'))));Calculate manually++(define $a21' (/ (+ b20' b21') 2))+(define $a22' (/ (- b20' b21') 2))+++(define $a31 (+ z   (* w^2 z^2) (* w z^4)))+(define $a32 (+ z^6 (* w^2 z^5) (* w z^3)))++(define $b30 (+ a31 a32))+(define $b31 (- a31 a32))+(define $b32 (- a32 a31))++(define $b30' (rt 3 (** b30 3)))+;(define $b31' (rt 3 (** b31 3)))+;(** b31 3)+;(+ (* 5 (rtu 7)) (* 8 (rtu 7)^2) (* -5 (rtu 7)^3) (* 5 (rtu 7)^4) (* -8 (rtu 7)^5) (* -5 (rtu 7)^6) (* -3 (rtu 7) w) (* 3 (rtu 7)^3 w) (* -3 (rtu 7)^4 w) (* 3 (rtu 7)^6 w) (* 3 (rtu 7)^2 w^2) (* -3 (rtu 7)^5 w^2))+(define $b31' (rt 3 (+ (* 5 a11') (* -5 a12') (* w -3 a11') (* w 3 a12'))));Calculate manually++(define $a31' (/ (+ b30' b31') 2))+(define $a32' (/ (- b30' b31') 2))++(define $z1' (/ (+ a11' a21' a31') 3))+(define $z6' (/ (+ a12' a22' a32') 3))++z1'+;(/ (+ -1 (* i (sqrt 7)) (rt 3 (+ 14 (* 21 w))) (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w^2))) (rt 3 (+ -7 (* -21 w))) (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w)))) 6)++(/ (+ -1+      (rt 3 (+ 14 (* 21 w)))+      (rt 3 (+ -7 (* -21 w)))+      (* i (sqrt 7))+      (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w)))+      (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w^2)))+      )+   6)
+ sample/math/number/7th-root-of-unity.egi view
@@ -0,0 +1,53 @@+;(gen-cyclic-group (map 1#(modulo (* %1 3) 7) (between 1 6)))+;{{3 6 2 5 1 4} {2 4 6 1 3 5} {6 5 4 3 2 1} {4 1 5 2 6 3} {5 3 1 6 4 2} {1 2 3 4 5 6}}++(define $z (rtu 7))++(define $a11 (+ z^1 z^6))+(define $a12 (+ z^2 z^5))+(define $a13 (+ z^3 z^4))++(define $b10 (+ a11 a12 a13))++(define $b10' b10)++b10';-1++(define $b11 (+ a11 (* w a12) (* w^2 a13)))+(define $b12 (+ a13 (* w a11) (* w^2 a12)));(* w b11)+(define $b13 (+ a12 (* w a13) (* w^2 a11)));(* w^2 b11)++(define $b11' (rt 3 (* b11 b12 b13)))++b11';(rt 3 (+ 14 (* 21 w)))++(define $b14 (+ a11 (* w a13) (* w^2 a12)))+(define $b15 (+ a12 (* w a11) (* w^2 a13)));(* w b14)+(define $b16 (+ a13 (* w a12) (* w^2 a11)));(* w^2 b14)++(define $b14' (rt 3 (* b14 b15 b16)))++b14';(rt 3 (+ -7 (* -21 w)))++(define $a11' (/ (+ b10' b11' b14') 3))++a11';(/ (+ -1 (rt 3 (+ 14 (* 21 w))) (rt 3 (+ -7 (* -21 w)))) 3)+++(define $z1' (fst (q-f' 1 (* -1 a11') 1)))++z1';(/ (+ -1 (rt 3 (+ 14 (* 21 w))) (rt 3 (+ -7 (* -21 w))) (sqrt (+ -35 (* -2 (rt 3 (+ 14 (* 21 w)))) (* -2 (rt 3 (+ -7 (* -21 w)))) (rt 3 (+ 14 (* 21 w)))^2 (* 2 (rt 3 (+ 14 (* 21 w))) (rt 3 (+ -7 (* -21 w)))) (rt 3 (+ -7 (* -21 w)))^2))) 6)++(/ (+ -1+      (rt 3 (+ 14 (* 21 w)))+      (rt 3 (+ -7 (* -21 w)))+      (sqrt (+ -35+               (* -2 (rt 3 (+ 14 (* 21 w))))+               (* -2 (rt 3 (+ -7 (* -21 w))))+               (rt 3 (+ 14 (* 21 w)))^2+               (rt 3 (+ -7 (* -21 w)))^2+               (* 2+                  (rt 3 (+ 14 (* 21 w)))+                  (rt 3 (+ -7 (* -21 w))))+               )))+   6)
+ sample/math/number/9th-root-of-unity.egi view
@@ -0,0 +1,48 @@+;(map 1#(modulo (** 2 %1) 9) (between 1 6));{2 4 8 7 5 1}++(define $z (rtu 9))++(define $a11 (+ z^1 z^8))+(define $a12 (+ z^2 z^7))+(define $a13 (+ z^4 z^5))++(define $b10 (+ a11 a12 a13))++(define $b10' 0)++(define $b11 (+ a11 (* w a12) (* w^2 a13)))+(define $b12 (+ a13 (* w a11) (* w^2 a12)));(* w b11)+(define $b13 (+ a12 (* w a13) (* w^2 a11)));(* w^2 b11)++;(define $b11' (rt 3 (** b11 3)))+(define $b11' (* 3 (rt 3 w)));Calculate manually+;(** b11 3)+;=>(+ (* 18 w) (* 9 (rtu 9)^6) (* 9 (rtu 9)^6 w^2) (* 9 (rtu 9)^3) (* 9 (rtu 9)^3 w^2))+;=>(* 27 w)++(define $b14 (+ a11 (* w a13) (* w^2 a12)))+(define $b15 (+ a12 (* w a11) (* w^2 a13)));(* w b14)+(define $b16 (+ a13 (* w a12) (* w^2 a11)));(* w^2 b14)++;(define $b14' (rt 3 (** b14 3)))+(define $b14' (* 3 (rt 3 w^2)));Caluculate manually+;(** b14 3)+;=>(+ (* 18 w^2) (* 9 (rtu 9)^6) (* 9 (rtu 9)^6 w) (* 9 (rtu 9)^3) (* 9 (rtu 9)^3 w))+;=>(* 27 w^2)++(define $a11' (/ (+ b10' b11' b14') 3))+a11'+;(+ (rt 3 w) (rt 3 w^2))++(define $z1' (fst (q-f' 1 (* -1 a11') 1)))+z1'+;(/ (+ (rt 3 w) (rt 3 w^2) (sqrt (+ (rt 3 w)^2 (* 2 (rt 3 w) (rt 3 w^2)) (rt 3 w^2)^2 -4))) 2)++(/ (+ (rt 3 w)+      (rt 3 w^2)+      (sqrt (+ -4+               (rt 3 w)^2+               (rt 3 w^2)^2+               (* 2 (rt 3 w) (rt 3 w^2))+               )))+   2)
+ sample/math/number/eisenstein-primes.egi view
@@ -0,0 +1,38 @@+(map 2#[(+ %1 (* w %2)) (* (+ %1 (* w %2)) (+ %1 (* w^2 %2)))] (match-all (take 10 nats) (set integer) [<cons $x <cons $y _>> [x y]]))++{[(+ 1 w) 1]+ [(+ 1 (* 2 w)) 3] [(+ 2 w) 3]+ [(+ 1 (* 3 w)) 7] [(+ 2 (* 2 w)) 4] [(+ 3 w) 7]+ [(+ 1 (* 4 w)) 13] [(+ 2 (* 3 w)) 7] [(+ 3 (* 2 w)) 7] [(+ 4 w) 13]+ [(+ 1 (* 5 w)) 21] [(+ 2 (* 4 w)) 12] [(+ 3 (* 3 w)) 9] [(+ 4 (* 2 w)) 12] [(+ 5 w) 21] + [(+ 1 (* 6 w)) 31] [(+ 2 (* 5 w)) 19] [(+ 3 (* 4 w)) 13] [(+ 4 (* 3 w)) 13] [(+ 5 (* 2 w)) 19] [(+ 6 w) 31]+ [(+ 1 (* 7 w)) 43] [(+ 2 (* 6 w)) 28] [(+ 3 (* 5 w)) 19] [(+ 4 (* 4 w)) 16] [(+ 5 (* 3 w)) 19] [(+ 6 (* 2 w)) 28] [(+ 7 w) 43]+ [(+ 1 (* 8 w)) 57] [(+ 2 (* 7 w)) 39] [(+ 3 (* 6 w)) 27] [(+ 4 (* 5 w)) 21] [(+ 5 (* 4 w)) 21] [(+ 6 (* 3 w)) 27] [(+ 7 (* 2 w)) 39] [(+ 8 w) 57] + [(+ 1 (* 9 w)) 73] [(+ 2 (* 8 w)) 52] [(+ 3 (* 7 w)) 37] [(+ 4 (* 6 w)) 28] [(+ 5 (* 5 w)) 25] [(+ 6 (* 4 w)) 28] [(+ 7 (* 3 w)) 37] [(+ 8 (* 2 w)) 52] [(+ 9 w) 73] + [(+ 1 (* 10 w)) 91] [(+ 2 (* 9 w)) 67] [(+ 3 (* 8 w)) 49] [(+ 4 (* 7 w)) 37] [(+ 5 (* 6 w)) 31] [(+ 6 (* 5 w)) 31] [(+ 7 (* 4 w)) 37] [(+ 8 (* 3 w)) 49] [(+ 9 (* 2 w)) 67] [(+ 10 w) 91]+ [(+ 2 (* 10 w)) 84] [(+ 3 (* 9 w)) 63] [(+ 4 (* 8 w)) 48] [(+ 5 (* 7 w)) 39] [(+ 6 (* 6 w)) 36] [(+ 7 (* 5 w)) 39] [(+ 8 (* 4 w)) 48] [(+ 9 (* 3 w)) 63] [(+ 10 (* 2 w)) 84]+ [(+ 3 (* 10 w)) 79] [(+ 4 (* 9 w)) 61] [(+ 5 (* 8 w)) 49] [(+ 6 (* 7 w)) 43] [(+ 7 (* 6 w)) 43] [(+ 8 (* 5 w)) 49] [(+ 9 (* 4 w)) 61] [(+ 10 (* 3 w)) 79]+ [(+ 4 (* 10 w)) 76] [(+ 5 (* 9 w)) 61] [(+ 6 (* 8 w)) 52] [(+ 7 (* 7 w)) 49] [(+ 8 (* 6 w)) 52] [(+ 9 (* 5 w)) 61] [(+ 10 (* 4 w)) 76]+ [(+ 5 (* 10 w)) 75] [(+ 6 (* 9 w)) 63] [(+ 7 (* 8 w)) 57] [(+ 8 (* 7 w)) 57] [(+ 9 (* 6 w)) 63] [(+ 10 (* 5 w)) 75]+ [(+ 6 (* 10 w)) 76] [(+ 7 (* 9 w)) 67] [(+ 8 (* 8 w)) 64] [(+ 9 (* 7 w)) 67] [(+ 10 (* 6 w)) 76]+ [(+ 7 (* 10 w)) 79] [(+ 8 (* 9 w)) 73] [(+ 9 (* 8 w)) 73] [(+ 10 (* 7 w)) 79]+ [(+ 8 (* 10 w)) 84] [(+ 9 (* 9 w)) 81] [(+ 10 (* 8 w)) 84] + [(+ 9 (* 10 w)) 91] [(+ 10 (* 9 w)) 91]+ [(+ 10 (* 10 w)) 100]+ }++(filter 2#(prime? %2) (map 2#[(+ %1 (* w %2)) (* (+ %1 (* w %2)) (+ %1 (* w^2 %2)))] (match-all (take 10 nats) (set integer) [<cons $x <cons $y _>> [x y]])))++{[(+ 1 w) 1]+ [(+ 1 (* 2 w)) 3] [(+ 2 w) 3]+ [(+ 1 (* 3 w)) 7] [(+ 3 w) 7]+ [(+ 1 (* 4 w)) 13] [(+ 2 (* 3 w)) 7] [(+ 3 (* 2 w)) 7] [(+ 4 w) 13]+ [(+ 1 (* 6 w)) 31] [(+ 2 (* 5 w)) 19] [(+ 3 (* 4 w)) 13] [(+ 4 (* 3 w)) 13] [(+ 5 (* 2 w)) 19] [(+ 6 w) 31]+ [(+ 1 (* 7 w)) 43] [(+ 3 (* 5 w)) 19] [(+ 5 (* 3 w)) 19] [(+ 7 w) 43]+ [(+ 1 (* 9 w)) 73] [(+ 3 (* 7 w)) 37] [(+ 7 (* 3 w)) 37] [(+ 9 w) 73]+ [(+ 2 (* 9 w)) 67] [(+ 4 (* 7 w)) 37] [(+ 5 (* 6 w)) 31] [(+ 6 (* 5 w)) 31] [(+ 7 (* 4 w)) 37] [(+ 9 (* 2 w)) 67]+ [(+ 3 (* 10 w)) 79] [(+ 4 (* 9 w)) 61] [(+ 6 (* 7 w)) 43] [(+ 7 (* 6 w)) 43] [(+ 9 (* 4 w)) 61] [(+ 10 (* 3 w)) 79]+ [(+ 5 (* 9 w)) 61] [(+ 9 (* 5 w)) 61]+ [(+ 7 (* 9 w)) 67] [(+ 9 (* 7 w)) 67]+ [(+ 7 (* 10 w)) 79] [(+ 8 (* 9 w)) 73] [(+ 9 (* 8 w)) 73] [(+ 10 (* 7 w)) 79]+ }
+ sample/math/number/euler-totient-function.egi view
@@ -0,0 +1,108 @@+(define $φ+  (lambda [$n]+    (* n+       (product (map (lambda [$p] (- 1 (/ 1 p)))+                     (unique (p-f n)))))))++(take 100 (map2 2#[%1 %2 (p-f %2)] nats (map φ nats)))++{[1 1 {}]+ [2 1 {}]+ [3 2 {2}]+ [4 2 {2}]+ [5 4 {2 2}]+ [6 2 {2}]+ [7 6 {2 3}]+ [8 4 {2 2}]+ [9 6 {2 3}]+ [10 4 {2 2}]+ [11 10 {2 5}]+ [12 4 {2 2}]+ [13 12 {2 2 3}]+ [14 6 {2 3}]+ [15 8 {2 2 2}]+ [16 8 {2 2 2}]+ [17 16 {2 2 2 2}]+ [18 6 {2 3}]+ [19 18 {2 3 3}]+ [20 8 {2 2 2}]+ [21 12 {2 2 3}]+ [22 10 {2 5}]+ [23 22 {2 11}]+ [24 8 {2 2 2}]+ [25 20 {2 2 5}]+ [26 12 {2 2 3}]+ [27 18 {2 3 3}]+ [28 12 {2 2 3}]+ [29 28 {2 2 7}]+ [30 8 {2 2 2}]+ [31 30 {2 3 5}]+ [32 16 {2 2 2 2}]+ [33 20 {2 2 5}]+ [34 16 {2 2 2 2}]+ [35 24 {2 2 2 3}]+ [36 12 {2 2 3}]+ [37 36 {2 2 3 3}]+ [38 18 {2 3 3}]+ [39 24 {2 2 2 3}]+ [40 16 {2 2 2 2}]+ [41 40 {2 2 2 5}]+ [42 12 {2 2 3}]+ [43 42 {2 3 7}]+ [44 20 {2 2 5}]+ [45 24 {2 2 2 3}]+ [46 22 {2 11}]+ [47 46 {2 23}]+ [48 16 {2 2 2 2}]+ [49 42 {2 3 7}]+ [50 20 {2 2 5}]+ [51 32 {2 2 2 2 2}]+ [52 24 {2 2 2 3}]+ [53 52 {2 2 13}]+ [54 18 {2 3 3}]+ [55 40 {2 2 2 5}]+ [56 24 {2 2 2 3}]+ [57 36 {2 2 3 3}]+ [58 28 {2 2 7}]+ [59 58 {2 29}]+ [60 16 {2 2 2 2}]+ [61 60 {2 2 3 5}]+ [62 30 {2 3 5}]+ [63 36 {2 2 3 3}]+ [64 32 {2 2 2 2 2}]+ [65 48 {2 2 2 2 3}]+ [66 20 {2 2 5}]+ [67 66 {2 3 11}]+ [68 32 {2 2 2 2 2}]+ [69 44 {2 2 11}]+ [70 24 {2 2 2 3}]+ [71 70 {2 5 7}]+ [72 24 {2 2 2 3}]+ [73 72 {2 2 2 3 3}]+ [74 36 {2 2 3 3}]+ [75 40 {2 2 2 5}]+ [76 36 {2 2 3 3}]+ [77 60 {2 2 3 5}]+ [78 24 {2 2 2 3}]+ [79 78 {2 3 13}]+ [80 32 {2 2 2 2 2}]+ [81 54 {2 3 3 3}]+ [82 40 {2 2 2 5}]+ [83 82 {2 41}]+ [84 24 {2 2 2 3}]+ [85 64 {2 2 2 2 2 2}]+ [86 42 {2 3 7}]+ [87 56 {2 2 2 7}]+ [88 40 {2 2 2 5}]+ [89 88 {2 2 2 11}]+ [90 24 {2 2 2 3}]+ [91 72 {2 2 2 3 3}]+ [92 44 {2 2 11}]+ [93 60 {2 2 3 5}]+ [94 46 {2 23}]+ [95 72 {2 2 2 3 3}]+ [96 32 {2 2 2 2 2}]+ [97 96 {2 2 2 2 2 3}]+ [98 42 {2 3 7}]+ [99 60 {2 2 3 5}]+ [100 40 {2 2 2 5}]}
+ sample/math/number/fib.egi view
@@ -0,0 +1,1 @@+(define $F (lambda [$n] (* (/ 1 (sqrt 5)) (- (** (/ (+ 1 (sqrt 5)) 2) n) (** (/ (- 1 (sqrt 5)) 2) n)))))
+ sample/math/number/gaussian-primes.egi view
@@ -0,0 +1,36 @@+(map 2#[(+ %1 (* i %2)) (* (+ %1 (* i %2)) (+ %1 (* -1 i %2)))] (match-all (take 10 nats) (set integer) [<cons $x <cons $y _>> [x y]]))++{[(+ 1 i) 2] + [(+ 1 (* 2 i)) 5] [(+ 2 i) 5]+ [(+ 1 (* 3 i)) 10] [(+ 2 (* 2 i)) 8] [(+ 3 i) 10]+ [(+ 1 (* 4 i)) 17] [(+ 2 (* 3 i)) 13] [(+ 3 (* 2 i)) 13] [(+ 4 i) 17]+ [(+ 1 (* 5 i)) 26] [(+ 2 (* 4 i)) 20] [(+ 3 (* 3 i)) 18] [(+ 4 (* 2 i)) 20] [(+ 5 i) 26]+ [(+ 1 (* 6 i)) 37] [(+ 2 (* 5 i)) 29] [(+ 3 (* 4 i)) 25] [(+ 4 (* 3 i)) 25] [(+ 5 (* 2 i)) 29] [(+ 6 i) 37] + [(+ 1 (* 7 i)) 50] [(+ 2 (* 6 i)) 40] [(+ 3 (* 5 i)) 34] [(+ 4 (* 4 i)) 32] [(+ 5 (* 3 i)) 34] [(+ 6 (* 2 i)) 40] [(+ 7 i) 50]+ [(+ 1 (* 8 i)) 65] [(+ 2 (* 7 i)) 53] [(+ 3 (* 6 i)) 45] [(+ 4 (* 5 i)) 41] [(+ 5 (* 4 i)) 41] [(+ 6 (* 3 i)) 45] [(+ 7 (* 2 i)) 53] [(+ 8 i) 65]+ [(+ 1 (* 9 i)) 82] [(+ 2 (* 8 i)) 68] [(+ 3 (* 7 i)) 58] [(+ 4 (* 6 i)) 52] [(+ 5 (* 5 i)) 50] [(+ 6 (* 4 i)) 52] [(+ 7 (* 3 i)) 58] [(+ 8 (* 2 i)) 68] [(+ 9 i) 82]+ [(+ 1 (* 10 i)) 101] [(+ 2 (* 9 i)) 85] [(+ 3 (* 8 i)) 73] [(+ 4 (* 7 i)) 65] [(+ 5 (* 6 i)) 61] [(+ 6 (* 5 i)) 61] [(+ 7 (* 4 i)) 65] [(+ 8 (* 3 i)) 73] [(+ 9 (* 2 i)) 85] [(+ 10 i) 101]+ [(+ 2 (* 10 i)) 104] [(+ 3 (* 9 i)) 90] [(+ 4 (* 8 i)) 80] [(+ 5 (* 7 i)) 74] [(+ 6 (* 6 i)) 72] [(+ 7 (* 5 i)) 74] [(+ 8 (* 4 i)) 80] [(+ 9 (* 3 i)) 90] [(+ 10 (* 2 i)) 104]+ [(+ 3 (* 10 i)) 109] [(+ 4 (* 9 i)) 97] [(+ 5 (* 8 i)) 89] [(+ 6 (* 7 i)) 85] [(+ 7 (* 6 i)) 85] [(+ 8 (* 5 i)) 89] [(+ 9 (* 4 i)) 97] [(+ 10 (* 3 i)) 109]+ [(+ 4 (* 10 i)) 116] [(+ 5 (* 9 i)) 106] [(+ 6 (* 8 i)) 100] [(+ 7 (* 7 i)) 98] [(+ 8 (* 6 i)) 100] [(+ 9 (* 5 i)) 106] [(+ 10 (* 4 i)) 116]+ [(+ 5 (* 10 i)) 125] [(+ 6 (* 9 i)) 117] [(+ 7 (* 8 i)) 113] [(+ 8 (* 7 i)) 113] [(+ 9 (* 6 i)) 117] [(+ 10 (* 5 i)) 125]+ [(+ 6 (* 10 i)) 136] [(+ 7 (* 9 i)) 130] [(+ 8 (* 8 i)) 128] [(+ 9 (* 7 i)) 130] [(+ 10 (* 6 i)) 136]+ [(+ 7 (* 10 i)) 149] [(+ 8 (* 9 i)) 145] [(+ 9 (* 8 i)) 145] [(+ 10 (* 7 i)) 149]+ [(+ 8 (* 10 i)) 164] [(+ 9 (* 9 i)) 162] [(+ 10 (* 8 i)) 164]+ [(+ 9 (* 10 i)) 181] [(+ 10 (* 9 i)) 181]+ [(+ 10 (* 10 i)) 200]+ }++(filter 2#(prime? %2) (map 2#[(+ %1 (* i %2)) (* (+ %1 (* i %2)) (+ %1 (* -1 i %2)))] (match-all (take 10 nats) (set integer) [<cons $x <cons $y _>> [x y]])))++{[(+ 1 i) 2]+ [(+ 1 (* 2 i)) 5] [(+ 2 i) 5]+ [(+ 1 (* 4 i)) 17] [(+ 2 (* 3 i)) 13] [(+ 3 (* 2 i)) 13] [(+ 4 i) 17]+ [(+ 1 (* 6 i)) 37] [(+ 2 (* 5 i)) 29] [(+ 5 (* 2 i)) 29] [(+ 6 i) 37]+ [(+ 2 (* 7 i)) 53] [(+ 4 (* 5 i)) 41] [(+ 5 (* 4 i)) 41] [(+ 7 (* 2 i)) 53]+ [(+ 1 (* 10 i)) 101] [(+ 3 (* 8 i)) 73] [(+ 5 (* 6 i)) 61] [(+ 6 (* 5 i)) 61] [(+ 8 (* 3 i)) 73] [(+ 10 i) 101]+ [(+ 3 (* 10 i)) 109] [(+ 4 (* 9 i)) 97] [(+ 5 (* 8 i)) 89] [(+ 8 (* 5 i)) 89] [(+ 9 (* 4 i)) 97] [(+ 10 (* 3 i)) 109]+ [(+ 7 (* 8 i)) 113] [(+ 8 (* 7 i)) 113]+ [(+ 7 (* 10 i)) 149] [(+ 10 (* 7 i)) 149]+ [(+ 9 (* 10 i)) 181] [(+ 10 (* 9 i)) 181]+ }
+ sample/math/number/napier.egi view
@@ -0,0 +1,21 @@+;;;;;+;;;;; Calucualate Napier's constant+;;;;;++(define $calculate-napier+  (lambda [$n]+    (sum (take n (map (lambda [$i] (/ 1 (fact i))) nats0)))))++(test (calculate-napier 1))+(test (calculate-napier 2))+(test (calculate-napier 3))+(test (calculate-napier 4))+(test (calculate-napier 5))+(test (calculate-napier 6))+(test (calculate-napier 7))+(test (calculate-napier 8))+(test (calculate-napier 9))+(test (calculate-napier 10))+(test (rtof (calculate-napier 10)))+(test (rtof (calculate-napier 100)))+(test (rtof (calculate-napier 200)))
+ sample/math/number/pi.egi view
@@ -0,0 +1,32 @@+;;;;;+;;;;; Calucualate Pi+;;;;;++;(define $calculate-pi+;  (lambda [$n]+;    (foldr (lambda [$x $y] (+ x (/ 1 y))) 1 (take n {3 7 15 1 292 @(repeat1 1)}))))++;(define $odds (map (compose (* $ 2) (- $ 1)) nats))++;(define $calculate-pi+;  (lambda [$n]+;    (+ 3 (foldr (lambda [$x $y] (/ x (+ 6 y))) 1 (take n (map (power $ 2) odds))))))++(define $calculate-pi+  (lambda [$n]+    (/ 4 (foldr (lambda [$x $y] (+ (- (* 2 x) 1) (/ (power x 2) y))) 1 (take n nats)))))++(test (calculate-pi 1))+(test (calculate-pi 2))+(test (calculate-pi 3))+(test (calculate-pi 4))+(test (calculate-pi 5))+(test (calculate-pi 6))+(test (calculate-pi 7))+(test (calculate-pi 8))+(test (calculate-pi 9))+(test (calculate-pi 10))+(test (rtof (calculate-pi 100)))+(test (rtof (calculate-pi 1000)))+(test (rtof (calculate-pi 2000)))+(test pi)
+ sample/math/number/sum-of-cubes.egi view
@@ -0,0 +1,23 @@+;;;;;+;;;;;+;;;;; Sum of Cubes+;;;;;+;;;;;++; Infintite list of sum of cubes.+; -- [m n (+ m^3 n^3)]+(define $sum-of-cubes+  (let {[$cube (lambda [$x] (* x (* x x)))]}+    (match-all nats (list integer)+      [<join _ (& <cons $m _> <join _ <cons $n _>>)> [m n (+ (cube m) (cube n))]])))++; sample output+(test (take 10 sum-of-cubes))++; list numbers that is the sum of two non-zero cube numbers+(test (take 2 (match-all sum-of-cubes (list [integer integer integer])+                [<join _ <cons [$x1 $y1 $c]+                  <join _ <cons [$x2 $y2 ,c]+                   _>>>>+                 [[x1 y1 c] [x2 y2 c]]]+                )))
+ sample/math/number/sum-of-squares.egi view
@@ -0,0 +1,36 @@+;;;;;+;;;;;+;;;;; Sum of Squares+;;;;;+;;;;;++; Infintite list of sum of squres.+; -- [m n (+ m^2 n^2)]+(define $sum-of-squares+  (let {[$square (lambda [$x] (* x x))]}+    (match-all nats (list integer)+      [<join _ (& <cons $m _> <join _ <cons $n _>>)> [m n (+ (square m) (square n))]])))++; sample output+(test (take 30 sum-of-squares))++; list numbers that is the sum of two non-zero square numbers in two distinct way+(test (let {[$n 2]}+        (take 5 (match-all sum-of-squares (list [integer integer integer])+                  [<join _ <cons [$x_1 $y_1 $c]+                    (loop $i [2 n]+                      <join _ <cons [$x_i $y_i ,c] ...>>+                      _)>>+                   (map (lambda [$i] [x_i y_i c]) (between 1 n))]))))++; prime-factorize sum of squares+; -- [m n {p1 p2 ...}]+(define $sum-of-squares-pf (map (match-lambda [integer integer integer] {[[$m $n $c] [m n (p-f c)]]}) sum-of-squares))++; sample output+(test (take 30 sum-of-squares-pf))++; list prime numbers that is the sum of two non-zero square numbers+(test (take 30 (match-all sum-of-squares-pf (list [integer integer (multiset integer)])+                 [<join _ <cons [$m $n <cons $p <nil>>] _>> [m n p]])))+
+ sample/math/number/tribonacci.egi view
@@ -0,0 +1,39 @@+(define $m 3)++(define $A+  (generate-tensor+    (match-lambda [integer integer]+      {[[,1 _] 1]+       [[$x ,(- x 1)] 1]+       [[_ _] 0]})+    {m m}))+A+;[| [| 1 1 1 |] [| 1 0 0 |] [| 0 1 0 |] |]++(define $B+  (generate-tensor+    (match-lambda integer+      {[,1 1]+       [_ 0]})+    {m}))++B+;[| 1 0 0 |]++(M.* A B)+;[| 1 1 0 |]++(M.* (M.power A 2) B)+;[| 2 1 1 |]++(M.* (M.power A 3) B)+;[| 4 2 1 |]++(M.* (M.power A 4) B)+;[| 7 4 2 |]++(M.* (M.power A 5) B)+;[| 13 7 4 |]++(M.* (M.power A 100) B)+;[| 180396380815100901214157639 98079530178586034536500564 53324762928098149064722658 |]
+ sample/math/number/zeta.egi view
@@ -0,0 +1,9 @@+(define $zeta+  (lambda [$n]+    (rtof (foldl + 0 (take n (map (lambda [$n] (* (/ 1 n) (/ 1 n))) nats))))))++(test (zeta 100))+(test (zeta 1000))+(test (zeta 10000))++(test (/ (* pi pi) 6))
+ sample/math/others/mobius-transformation.egi view
@@ -0,0 +1,24 @@+(define $f+  (lambda [$z]+    (/ (+ (* a z) b) (+ (* c z) d))))++(define $f1+  (lambda [$z]+    (+ z (/ d c))))++(define $f2+  (lambda [$z]+    (/ 1 z)))++(define $f3+  (lambda [$z]+    (* z+       (/ (* -1 (- (* a d) (* b c)))+          c^2))))++(define $f4+  (lambda [$z]+    (+ (/ a c) z)))++(f4 (f3 (f2 (f1 z))))+;(/ (+ (* a z) b) (+ (* c z) d))