summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <leonardomtenenbaum@gmail.com>2017-01-20 19:29:17 -0500
committerpommicket <leonardomtenenbaum@gmail.com>2017-01-20 19:29:17 -0500
commitcfe8e4ecc3840a1b242542f0418b5b0b2d03b0a4 (patch)
tree192165e4a7d2162e16849af51d5f0799cc4d2a7b
parentc8b45c3ddcb1b5e62c2ad36585d2d5cedc631279 (diff)
Added explanation to SECA
-rw-r--r--js/stochasticca.js2
-rw-r--r--stochasticca.html23
2 files changed, 24 insertions, 1 deletions
diff --git a/js/stochasticca.js b/js/stochasticca.js
index 5226c35..3e9ad22 100644
--- a/js/stochasticca.js
+++ b/js/stochasticca.js
@@ -28,7 +28,7 @@ function drawCA()
$("#error").text("Error - Invalid parameters: " + $("#params").val() + ".");
return;
}
- createCanvas(width, time);
+ createCanvas(width, time).parent("#canvas");
var C = Math.floor(params.length / 2);
var values = [[]];
for (var i = 0; i < width; i++)
diff --git a/stochasticca.html b/stochasticca.html
index 6f7bba9..f42ed01 100644
--- a/stochasticca.html
+++ b/stochasticca.html
@@ -7,17 +7,40 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<meta charset="utf-8">
+ <script type="text/x-mathjax-config">
+ MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
+ </script>
+ <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<title>Stochastic Cellular Automata</title>
</head>
<body>
<div id="navbar"></div>
<script src="navbar.js"></script>
<h2>Stochastic Cellular Automata</h2>
+ <p>
+ The parameters should consist of an odd number of numbers separated by commas.
+ </p>
Parameters: <input type="text" value="-3, 3, -3" id="params"><br>
Width: <input type="number" value="400" id="width"><br>
Time: <input type="number" value="400" id="time"><br>
<button id="display">Display</button><br>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.2/p5.js"></script>
<script src="js/stochasticca.js"></script>
+ <div id="canvas"></div>
+ <p>
+ The probability of any cell being black is determined by the cells above it using this formula (where $\theta$ is a vector containing the parameters,
+ $t$ is the time passed (or row), and $i$ is the column):
+ $$L = \frac{||\theta||-1}{2}$$
+ $$p(0, i) = 1$$
+ $$\text{(when t > 0) } p(t, i) = \theta \cdot
+ \begin{bmatrix}
+ c(t-1, i-L)\\
+ c(t-1, i-L+1)\\
+ \vdots \\
+ c(t-1, i+L)
+ \end{bmatrix}$$
+ $$c(t, i) = \text{a number with a $p(t, i)$ probability of being 1}$$
+
+ </p>
</body>
</html>