Public
Edited
May 15, 2023
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
midpoint = (rate1 * time1 - rate2 * time2 + Math.log(rate1) - Math.log(-rate2)) / (rate1 - rate2)
Insert cell
Insert cell
double_logistic_derivative = (t, asymptote, time1, time2, rate1, rate2, level1, level2) => {
return -asymptote * (-Math.exp(-rate1 * (t - time1)) * rate1 - Math.exp(-rate2 * (t - time2)) * rate2) / Math.pow(1 + Math.exp(-rate1 * (t - time1)) + Math.exp(-rate2 * (t - time2)), 2);
}
Insert cell
double_logistic_derivative2 = (t, asymptote, time1, time2, rate1, rate2, level1, level2) => {
const denom = 1 + Math.exp(-rate1 * (t - time1)) + Math.exp(-rate2 * (t - time2));
return asymptote * (
2 * Math.pow((-Math.exp(-rate1 * (t - time1)) * rate1 - Math.exp(-rate2 * (t - time2)) * rate2), 2) / Math.pow(denom, 3)
- (Math.exp(-rate1 * (t - time1)) * Math.pow(rate1, 2) + Math.exp(-rate2 * (t - time2)) * Math.pow(rate2, 2)) / Math.pow(denom, 2)
);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof asymptote2 = Inputs.range([0, 1], {label: "Asymptote 2"})
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(data2, {x: "t", y: "y"})
]
})
Insert cell
ts = [...Array(n)].map((x, i) => xlim[0] + (xlim[1] - xlim[0]) * i / (n - 1))
Insert cell
ys = ts.map((t) => double_logistic(t, asymptote, time1, time2, rate1, rate2, level1, level2))
Insert cell
dys = ts.map((t) => double_logistic_derivative(t, asymptote, time1, time2, rate1, rate2, level1, level2))
Insert cell
dys2 = ts.map((t) => double_logistic_derivative2(t, asymptote, time1, time2, rate1, rate2, level1, level2))
Insert cell
data = ts.map((t, i) => ({ t: t, y: ys[i], dy: dys[i], dy2: dys2[i] }))
Insert cell
ys2 = ts.map((t) => double_logistic2(t, asymptote, asymptote2, time1, time2, time3, time4, rate1, rate2, rate3, rate4, level1, level2))
Insert cell
data2 = ts.map((t, i) => ({ t: t, y: ys2[i] }))
Insert cell
xlim = [-10, 10]
Insert cell
n = 1000
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more