Starting with one woman, who gives birth to twin daughters every year from the age of 25 to 50, and then dies, followed by exactly the same thing happening to all of her offspring, and all of their offspring, and so on, ad infinitum, how does one calculate the size of the female population in any given year (expressed, for simplicity, in years after the birth of the first woman)?
And in any given year, what proportion of the female population will be what age? I’m assuming that these proportions will remain constant, though I may be wrong.
Complicated maths question
Re: Complicated maths question
How one calculates the size of the female population in any given year is just through 'calculation', itself.Maia wrote: ↑Thu Jan 12, 2023 9:00 pm Starting with one woman, who gives birth to twin daughters every year from the age of 25 to 50, and then dies, followed by exactly the same thing happening to all of her offspring, and all of their offspring, and so on, ad infinitum, how does one calculate the size of the female population in any given year (expressed, for simplicity, in years after the birth of the first woman)?
And in any given year, what proportion of the female population will be what age? I’m assuming that these proportions will remain constant, though I may be wrong.
But maybe you might be seeking some 'formula', which one could use, that might provide a quick and easy way to work out the female population size, and their ages, in any given year.
Re: Complicated maths question
Yes, some sort of formula, if there is one.Age wrote: ↑Thu Jan 12, 2023 11:49 pmHow one calculates the size of the female population in any given year is just through 'calculation', itself.Maia wrote: ↑Thu Jan 12, 2023 9:00 pm Starting with one woman, who gives birth to twin daughters every year from the age of 25 to 50, and then dies, followed by exactly the same thing happening to all of her offspring, and all of their offspring, and so on, ad infinitum, how does one calculate the size of the female population in any given year (expressed, for simplicity, in years after the birth of the first woman)?
And in any given year, what proportion of the female population will be what age? I’m assuming that these proportions will remain constant, though I may be wrong.
But maybe you might be seeking some 'formula', which one could use, that might provide a quick and easy way to work out the female population size, and their ages, in any given year.
-
Impenitent
- Posts: 5775
- Joined: Wed Feb 10, 2010 2:04 pm
Re: Complicated maths question
how many men? no new men on the horizon...
-Imp
-Imp
- attofishpi
- Posts: 13319
- Joined: Tue Aug 16, 2011 8:10 am
- Location: Orion Spur
- Contact:
Re: Complicated maths question
Here is a Python function that calculates the size of the female population in a given year:Maia wrote: ↑Thu Jan 12, 2023 9:00 pm Starting with one woman, who gives birth to twin daughters every year from the age of 25 to 50, and then dies, followed by exactly the same thing happening to all of her offspring, and all of their offspring, and so on, ad infinitum, how does one calculate the size of the female population in any given year (expressed, for simplicity, in years after the birth of the first woman)?
And in any given year, what proportion of the female population will be what age? I’m assuming that these proportions will remain constant, though I may be wrong.
def population_size(year):
if year < 0:
return 0
elif year == 0:
return 1
else:
return 2**(year-1) + population_size(year-1)
---
You can call the function and pass in the year you want to calculate the population size for. For example, to calculate the population size in year 10:
print(population_size(10))
---
This function uses recursion to calculate the population size. It starts with the base case of 0 population if the year is less than 0, and a population of 1 if the year is 0. For all other years, it calculates the population size as 2^(year-1) + the population size of the previous year. This is because in the first year, one woman gives birth to 2 daughters, in the second year those 2 daughters give birth to 2*2=4 daughters and so on.
Please note that the solution is not considering the age limit of the woman and assuming that the population size is double every year.
Re: Complicated maths question
Thanks. If you can write the above in normal English instructions, that would be a great help.attofishpi wrote: ↑Fri Jan 13, 2023 2:59 amHere is a Python function that calculates the size of the female population in a given year:Maia wrote: ↑Thu Jan 12, 2023 9:00 pm Starting with one woman, who gives birth to twin daughters every year from the age of 25 to 50, and then dies, followed by exactly the same thing happening to all of her offspring, and all of their offspring, and so on, ad infinitum, how does one calculate the size of the female population in any given year (expressed, for simplicity, in years after the birth of the first woman)?
And in any given year, what proportion of the female population will be what age? I’m assuming that these proportions will remain constant, though I may be wrong.
def population_size(year):
if year < 0:
return 0
elif year == 0:
return 1
else:
return 2**(year-1) + population_size(year-1)
---
You can call the function and pass in the year you want to calculate the population size for. For example, to calculate the population size in year 10:
print(population_size(10))
---
This function uses recursion to calculate the population size. It starts with the base case of 0 population if the year is less than 0, and a population of 1 if the year is 0. For all other years, it calculates the population size as 2^(year-1) + the population size of the previous year. This is because in the first year, one woman gives birth to 2 daughters, in the second year those 2 daughters give birth to 2*2=4 daughters and so on.
Please note that the solution is not considering the age limit of the woman and assuming that the population size is double every year.
It seems incomplete though, and if the population simply doubled every year it would be an easy matter to calculate. This is not the case, however, since for the first 25 years, it remains static at one. Also, it needs to incorporate the age limit.