a few more options for main
This commit is contained in:
parent
c94f1b2169
commit
5068304b7c
3 changed files with 29 additions and 4 deletions
|
@ -51,6 +51,7 @@
|
||||||
(let [steps (gaussian-column m col)
|
(let [steps (gaussian-column m col)
|
||||||
new (apply-all-at-once m steps)]
|
new (apply-all-at-once m steps)]
|
||||||
(concat steps (gaussian-elim new (inc col)))))))
|
(concat steps (gaussian-elim new (inc col)))))))
|
||||||
|
; TODO: if you can just divide to make a row good, do
|
||||||
|
|
||||||
(defn back-sub-column
|
(defn back-sub-column
|
||||||
[m col]
|
[m col]
|
||||||
|
|
|
@ -6,16 +6,34 @@
|
||||||
(:require [matrix.render :refer :all])
|
(:require [matrix.render :refer :all])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(defn -main
|
(defn steps-final-equations-interactive
|
||||||
"I don't do a whole lot ... yet."
|
[]
|
||||||
[& args]
|
|
||||||
(let [[steps final] (auto-steps-and-final (read))]
|
(let [[steps final] (auto-steps-and-final (read))]
|
||||||
(println "Steps:")
|
(println "Steps:")
|
||||||
;; (for [step steps]
|
;; (for [step steps]
|
||||||
;; (println (pretty-row-op step)))
|
;; (println (pretty-row-op step)))
|
||||||
(println (str/join "\n" (map with-inc-row-indices steps)))
|
(println (str/join "\n" (map with-inc-row-indices steps)))
|
||||||
(println "Final:")
|
(println "Final:")
|
||||||
(pprint-matrix final)))
|
(pprint-matrix final :with-bar)
|
||||||
|
(println (equations final))))
|
||||||
|
|
||||||
|
(defn steps-with-matrices
|
||||||
|
[]
|
||||||
|
(let [got (read)
|
||||||
|
[steps final] (auto-steps-and-final got)]
|
||||||
|
(->> steps
|
||||||
|
(apply-steps got)
|
||||||
|
(cons got)
|
||||||
|
(map #(pretty-matrix % true))
|
||||||
|
(#(interleave % (map pretty-row-op steps)))
|
||||||
|
(#(concat % [(pretty-matrix final true)]))
|
||||||
|
(str/join "\n")
|
||||||
|
println)))
|
||||||
|
|
||||||
|
(defn -main
|
||||||
|
"I don't do a whole lot ... yet."
|
||||||
|
[& args]
|
||||||
|
(steps-final-equations-interactive))
|
||||||
|
|
||||||
; TODO: actual parsing of row operations
|
; TODO: actual parsing of row operations
|
||||||
; TODO: parse equations (easy, but requires context (e.g. x = 1 could be any number of variables))
|
; TODO: parse equations (easy, but requires context (e.g. x = 1 could be any number of variables))
|
||||||
|
|
|
@ -132,6 +132,12 @@
|
||||||
(if (not-empty z) " ")
|
(if (not-empty z) " ")
|
||||||
"= " eq))))
|
"= " eq))))
|
||||||
|
|
||||||
|
(defn equations
|
||||||
|
"Write an equation for each row of an augmented matrix"
|
||||||
|
[m]
|
||||||
|
(str/join "\n"
|
||||||
|
(map equation-from-row m)))
|
||||||
|
|
||||||
(defn shrink-digit
|
(defn shrink-digit
|
||||||
"Takes a digit and returns the subscript version"
|
"Takes a digit and returns the subscript version"
|
||||||
[d]
|
[d]
|
||||||
|
|
Loading…
Reference in a new issue