Published
Edited
Oct 27, 2020
3 forks
Insert cell
Insert cell
Insert cell
{
const suspect = [1,1,1,1,1,1]
let n = d3.sum(suspect)
const p = [1/n,1/n,1/n,1/n,1/n,1/n]
const index = math.randomInt(0,5)
suspect[index] = 0
n = d3.sum(suspect)
for(let j = 0;j<=5;j = j + 1){
p[j] = suspect[j]/n
}
return [suspect,p]
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more