Public
Edited
Jan 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof button = Inputs.button("Randomize")
Insert cell
Insert cell
Insert cell
Insert cell
/*Plot.plot({
height: 400,
marks: [
Plot.line(intensity_data, {x: "t", y: "intensity"})
]
})*/
Insert cell
data = simulate(Tmax, a, delta, beta)
Insert cell
Insert cell
Insert cell
Insert cell
//intensity_data = intensity(data, ts, a, delta, beta)
Insert cell
intensity = function(data, ts, a, delta, beta) {
let index = 0;
const intensity = [];
for(let i = 0; i < ts.length; i++) {
const t = ts[i];
intensity[i] = {
t: t,
intensity: a + data.filter((x) => x.t < t).map((x) => x.g * Math.exp(-delta * (t - x.t))).reduce((a, b) => a + b, 0)
};
}
return intensity
}
Insert cell
rands = {
button;
const res = [];
for(let i = 0; i < 10000; i++) {
res.push({
u1: Math.random(),
u2: Math.random(),
u3: Math.random()
});
}
return res
}
Insert cell
rexp = (beta, u) => -1 / beta * Math.log(1 - u)
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