-
Notifications
You must be signed in to change notification settings - Fork 3
/
von_mises.html
63 lines (59 loc) · 1.49 KB
/
von_mises.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://d3js.org/d3.v6.js"></script>
<script src="math-js-wasm/von_mises.js"></script>
<script src="stan-distribution-zoo.js"></script>
<script>
var x;
var y;
var svg;
var xAxis;
var yAxis;
var data = [];
var params = {
mu: 0.4,
kappa: 0.4,
};
var continuous = true;
function update_data() {
data = []
for (let y = 0; y < 2*Math.PI; y = y + 0.001) {
let res = Module.von_mises_lpdf(y, params.mu, params.kappa)
if ($("#exp-check")[0].checked) {
res = Math.exp(res)
}
data.push({ ser1: y, ser2: res})
}
}
var Module = {
onRuntimeInitialized: function () {
setup_page(
{
function_name: "von_mises_lpdf (y | mu, kappa)",
sliders: [
{
name: "mu", text: "mu",
value: params.mu, min: -20, max: 20, step: 0.01
},
{
name: "kappa", text: "kappa",
value: params.kappa, min: 0.01, max: 20, step: 0.01
}
],
exponentiate: true,
continuous: true,
x_axis_text: "y"
}
)
}
}
</script>
</head>
<body>
<div id="figure"></div>
</body>
</html>