population plot 10%
This commit is contained in:
22
python/population_plot.py
Normal file
22
python/population_plot.py
Normal file
@ -0,0 +1,22 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
# Initial population
|
||||
population = 1_000_000
|
||||
death_rate = 0.10
|
||||
years = np.arange(0, 1001, 100) # 0 to 1000 years in 100-year intervals
|
||||
|
||||
# Calculate population after each 100-year interval
|
||||
population_values = [population]
|
||||
for year in years[1:]:
|
||||
population -= death_rate * population
|
||||
population_values.append(population)
|
||||
|
||||
# Create the graph
|
||||
plt.figure(figsize=(8, 6))
|
||||
plt.plot(years, population_values, marker='o', linestyle='-', color='b')
|
||||
plt.xlabel('Years')
|
||||
plt.ylabel('Population')
|
||||
plt.title('Population Projection')
|
||||
plt.grid(True)
|
||||
plt.show()
|
Reference in New Issue
Block a user