Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
(def bottom [ [0 1 0], [11 0 0], [0 1 1], [4 0 0], [0 0 1] ])
|
||||
|
||||
(defn plus [v1 v2] (vec (map + v1 v2)))
|
||||
(defn minus [v1 v2] (vec (map - v1 v2)))
|
||||
(defn scale [n v] (vec (map #(* n %) v )))
|
||||
|
||||
(defn above [row] (map #(apply plus %) (partition 2 1 row)))
|
||||
|
||||
(def rows (reverse (take 5 (iterate above bottom))))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(def c00 (get-in rows [0 0]))
|
||||
(def c20 (get-in rows [2 0]))
|
||||
|
||||
(def eqn0 (minus c00 [151 0 0]))
|
||||
(def eqn1 (minus c20 [ 40 0 0]))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
(defn solve [m]
|
||||
(assert (<= 1 m 2))
|
||||
(let [n (- 3 m)
|
||||
v0 (scale (eqn1 n) eqn0)
|
||||
v1 (scale (eqn0 n) eqn1)
|
||||
vd (minus v0 v1)]
|
||||
(assert (zero? (vd n)))
|
||||
(/ (- (vd 0)) (vd m))))
|
||||
|
||||
(let [x (solve 1), z (solve 2), y (+ x z)]
|
||||
(println "x =" x ", y =" y ", z =" z))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(defn dot [v1 v2] (reduce + (map * v1 v2)))
|
||||
|
||||
(defn show-pyramid [x z]
|
||||
(doseq [row rows]
|
||||
(println (map #(dot [1 x z] %) row)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue