Merge branch 'master' of http://git.d-popov.com/popov/scripts
This commit is contained in:
2
ai-ollama.md
Normal file
2
ai-ollama.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
run llama code 7b in ollama"
|
||||||
|
ollama run codellama:7b-code
|
@ -1,5 +1,7 @@
|
|||||||
# install
|
# install
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install gnupg
|
||||||
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
|
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||||
|
39
python/population_plot.py
Normal file
39
python/population_plot.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# Initial population at year 0
|
||||||
|
initial_population = 1_000_000
|
||||||
|
death_rate = 0.10
|
||||||
|
|
||||||
|
# Start and stop years for the graph
|
||||||
|
start_year = 4000
|
||||||
|
stop_year = 10000
|
||||||
|
interval = 500 # Interval for plotting data points
|
||||||
|
|
||||||
|
# Initialize population calculations
|
||||||
|
current_population = initial_population
|
||||||
|
population_values = [initial_population] # Include initial population as the first data point
|
||||||
|
years = np.arange(0, stop_year + 1, 100) # Calculate every 100 years
|
||||||
|
|
||||||
|
# Apply the death rate for each 100-year period
|
||||||
|
for year in years[1:]:
|
||||||
|
current_population -= death_rate * current_population
|
||||||
|
population_values.append(current_population)
|
||||||
|
|
||||||
|
# Filter the years and population values for the graph
|
||||||
|
graph_years = np.arange(start_year, stop_year + 1, interval)
|
||||||
|
graph_population_values = [population for year, population in zip(years, population_values) if year >= start_year and year in graph_years]
|
||||||
|
|
||||||
|
# Create the graph with labels for each data point
|
||||||
|
plt.figure(figsize=(8, 6))
|
||||||
|
plt.plot(graph_years, graph_population_values, marker='o', linestyle='-', color='b')
|
||||||
|
plt.xlabel('Years')
|
||||||
|
plt.ylabel('Population')
|
||||||
|
plt.title(f'Population Projection from Year {start_year} to {stop_year}')
|
||||||
|
|
||||||
|
# Adding labels to the data points
|
||||||
|
for i, txt in enumerate(graph_population_values):
|
||||||
|
plt.annotate(f"{int(txt):,}", (graph_years[i], graph_population_values[i]), textcoords="offset points", xytext=(0,10), ha='center')
|
||||||
|
|
||||||
|
plt.grid(True)
|
||||||
|
plt.show()
|
Reference in New Issue
Block a user