Published
Edited
May 19, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function d_a2(n,k) {
const num = -1*(2*k-1)*(2*(k-1)*k-2*Math.pow(n,2)+1)
return num/Math.pow(n,4);
}
Insert cell
function a_d2(n,k) {
const num = (2*k-2*n-1)*(2*Math.pow(k,2)-4*n*k-2*k+2*n+1)
return num/Math.pow(n,4);
}
Insert cell
function lower_bound_prob(f, faces, lower_bound) {
return [...Array(faces).keys()].filter(x=> x >= lower_bound-1).map(x => f(faces, x+1)).reduce((a, b) => a + b, 0)
}
Insert cell
function upper_bound_prob(f, faces, upper_bound) {
return [...Array(faces).keys()].filter(x=> x <= upper_bound-1).map(x => f(faces, x+1)).reduce((a, b) => a + b, 0)
}
Insert cell
function expected_value(f, faces) {
return [...Array(faces).keys()].map(x => f(faces, x+1)*(x+1)).reduce((a, b) => a + b, 0)
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {slider, text} from "@jashkenas/inputs"
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