Skip to content

Commit

Permalink
gamblers fallacy
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlawrenceaspden committed Dec 4, 2015
1 parent cf80e94 commit 6d17e76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions gamblers/gamblers.clj
Expand Up @@ -99,3 +99,29 @@ coins ; (:H :H :T :T :T :H :T :T :T :H :H :T :H :H :H :T :H :T :T :H :T :T :H :T
[(:red :red :green) 71]
[(:red :green) 135]
[(:green) 300])


;; Can look at this as a Markov Chain and ask about the waiting times

(use 'clojure.core.matrix)

(def A [[1 0 0 0 1 0 0 0]
[1 0 0 0 1 0 0 0]
[0 1 0 0 0 1 0 0]
[0 1 0 0 0 1 0 0]
[0 0 1 0 0 0 1 0]
[0 0 1 0 0 0 1 0]
[0 0 0 1 0 0 0 1]
[0 0 0 1 0 0 0 1]])

(clojure.core.matrix/mmul A A)

(clojure.core.matrix/mmul A A A)

(use 'clojure.core.matrix.linear)

(set-current-implementation :clatrix)

(clojure.core.matrix.linear/svd A)

(pprint (clojure.core.matrix.linear/eigen A))
3 changes: 3 additions & 0 deletions gamblers/project.clj
Expand Up @@ -5,6 +5,9 @@
:dependencies [[org.clojure/clojure "LATEST"]
[org.clojure/tools.trace "LATEST"]
[org.clojure/tools.nrepl "LATEST"]
[net.mikera/core.matrix "0.47.0"]
[net.mikera/vectorz-clj "0.37.0"]
[clatrix "0.5.0"]
[simple-plotter "LATEST"]]
:plugins [[cider/cider-nrepl "0.10.0"]]
:global-vars {*print-length* 100})
Expand Down

0 comments on commit 6d17e76

Please sign in to comment.