Published
Edited
Apr 21, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
endSizeByFractionInfertile = {
const N = initialPopSize

const data = []
for (let fractionInfertile = 0; fractionInfertile <= 1; fractionInfertile += 0.01) {
const endSizeWithoutInfertile = N * expectedNumChilds ** numGenerations
const popSizeFactor = (1 - fractionInfertile) ** numGenerations
const exponent = (expectedNumChilds + infertileCompensation * fractionInfertile) ** numGenerations
const endSizeWithInfertile = N * popSizeFactor * exponent
data.push({
fractionInfertile,
size: endSizeWithoutInfertile,
type: "without infertility"
})
data.push({
fractionInfertile,
size: endSizeWithInfertile,
type: "with infertility"
})
}
return data
}
Insert cell
data3 = {
const N = initialPopSize
const data = ["without infertility", "with infertility"].map(label => ({
gen: 0,
size: numGenerations,
type: label
}))

for (let i = 1; i < numGenerations; ++i) {
const endSizeWithoutInfertile = N * expectedNumChilds ** i
const popSizeFactor = (1 - fractionInfertile) ** i
const exponent = (expectedNumChilds + infertileCompensation * fractionInfertile) ** i
const endSizeWithInfertile = N * popSizeFactor * exponent
data.push({
gen: i,
size: endSizeWithoutInfertile,
type: "without infertility"
})
data.push({
gen: i,
size: endSizeWithInfertile,
type: "with infertility"
})
}
return data
}
Insert cell
Insert cell
Insert cell
Insert cell
//viewof fitnessVariance = Range([1, 10], {step: 1, value: 10, label: "Fitness variance"})
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
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