Compare commits

..

3 Commits

File diff suppressed because one or more lines are too long

@ -0,0 +1,19 @@
# Exploring Math
Math is fun, but we generally learn applying it's operations with pencil and paper. This repository is a learning repo focused on learning math with the Python tools you will typically encounter out in the wild world.
## Installation
```bash
sudo apt install python3-tk
```
```bash
uv venv -p 3.12
uv pip install -r requirements.in
```
## Saving Notebooks
Notebooks json can be inline or in a source list format. Source list is easier to read on PRs, so included is a `convert_notebook.py` utility.

@ -28,7 +28,7 @@ def generate_F_r():
m2 = 1.5
for dist in r:
force = G * (m1 / m2) / (dist ** 2)
force = G * (m1 * m2) / (dist ** 2)
F.append(force)
draw_graph(r, F)

@ -1,17 +1,16 @@
"""
Simple pylab example
Simple matplotlib example
Use pylab when you are in an interactive shell. This example really should be copied into a RPEL.
"""
from pylab import plot, show
import numpy as np
import matplotlib.pyplot as plt
x_numbers = [1, 2, 3]
y_numbers = [2, 4, 6]
my_graph = plot(x_numbers, y_numbers, marker='o')
# my_graph = plot(x_numbers, y_numbers, 'o')
x_numbers = np.array([1, 2, 3])
y_numbers = np.array([2, 4, 6])
fig, ax = plt.subplots()
ax.plot(x_numbers, y_numbers, marker="o")
if __name__ == "__main__":
show()
plt.show()

@ -1,20 +1,32 @@
from pylab import legend, plot, show, title, xlabel, ylabel, axis
nyc_temp_2000 = [31.3, 37.3, 47.2, 51.0, 63.5, 71.3, 72.3, 72.7, 66.0, 57.0, 45.3, 31.1]
nyc_temp_2006 = [40.9, 35.7, 43.1, 55.7, 63.1, 71.0, 77.9, 75.8, 66.6, 56.2, 51.9, 43.6]
nyc_temp_2012 = [37.3, 40.9, 50.9, 54.8, 65.1, 71.0, 78.8, 76.7, 68.8, 58.0, 43.9, 41.5]
months = range(1, 13)
plot(months, nyc_temp_2000, months, nyc_temp_2006, months, nyc_temp_2012)
title('Average monthly temperature in NYC')
xlabel("Month")
ylabel("Temperature")
legend([2000, 2006, 2012])
axis(ymin=0)
show()
import numpy as np
import matplotlib.pyplot as plt
nyc_temp_2000 = np.array([
31.3, 37.3, 47.2, 51.0, 63.5, 71.3,
72.3, 72.7, 66.0, 57.0, 45.3, 31.1
])
nyc_temp_2006 = np.array([
40.9, 35.7, 43.1, 55.7, 63.1, 71.0,
77.9, 75.8, 66.6, 56.2, 51.9, 43.6
])
nyc_temp_2012 = np.array([
37.3, 40.9, 50.9, 54.8, 65.1, 71.0,
78.8, 76.7, 68.8, 58.0, 43.9, 41.5
])
months = np.arange(1, 13)
fig, ax = plt.subplots()
ax.plot(months, nyc_temp_2000, marker="o", label="2000")
ax.plot(months, nyc_temp_2006, marker="o", label="2006")
ax.plot(months, nyc_temp_2012, marker="o", label="2012")
ax.set_title("Average monthly temperature in NYC")
ax.set_xlabel("Month")
ax.set_ylabel("Temperature")
ax.set_ylim(bottom=0) # equivalent to axis(ymin=0)
ax.legend()
plt.show()

@ -1,13 +1,28 @@
from pylab import legend, plot, show
import numpy as np
import matplotlib.pyplot as plt
nyc_temp_2000 = [31.3, 37.3, 47.2, 51.0, 63.5, 71.3, 72.3, 72.7, 66.0, 57.0, 45.3, 31.1]
nyc_temp_2006 = [40.9, 35.7, 43.1, 55.7, 63.1, 71.0, 77.9, 75.8, 66.6, 56.2, 51.9, 43.6]
nyc_temp_2012 = [37.3, 40.9, 50.9, 54.8, 65.1, 71.0, 78.8, 76.7, 68.8, 58.0, 43.9, 41.5]
nyc_temp_2000 = [
31.3, 37.3, 47.2, 51.0, 63.5, 71.3,
72.3, 72.7, 66.0, 57.0, 45.3, 31.1
]
nyc_temp_2006 = [
40.9, 35.7, 43.1, 55.7, 63.1, 71.0,
77.9, 75.8, 66.6, 56.2, 51.9, 43.6
]
nyc_temp_2012 = [
37.3, 40.9, 50.9, 54.8, 65.1, 71.0,
78.8, 76.7, 68.8, 58.0, 43.9, 41.5
]
months = range(1, 13)
plot(months, nyc_temp_2000, months, nyc_temp_2006, months, nyc_temp_2012)
plt.plot(months, nyc_temp_2000)
plt.plot(months, nyc_temp_2006)
plt.plot(months, nyc_temp_2012)
legend([2000, 2006, 2012])
plt.legend([2000, 2006, 2012])
plt.xlabel("Month")
plt.ylabel("Temperature")
plt.title("NYC Monthly Temperatures")
show()
plt.show()

@ -1,12 +1,20 @@
from pylab import plot, show
import numpy as np
import matplotlib.pyplot as plt
from decimal import Decimal
nyc_temp = [50.9, 60.3, 54.4, 52.4, 51.5, 52.8, 56.8, 55.0, 55.3, 54.0, 56.7, 56.4, 57.3]
nyc_temp = [
50.9, 60.3, 54.4, 52.4, 51.5, 52.8,
56.8, 55.0, 55.3, 54.0, 56.7, 56.4, 57.3
]
dec_nyc_temp = list(map(lambda x: Decimal(str(x)), nyc_temp))
# Preserve Decimal behavior
dec_nyc_temp = [Decimal(str(x)) for x in nyc_temp]
years = range(2000, 2013)
years = list(range(2000, 2013))
plot(years, dec_nyc_temp, marker='o')
plt.plot(years, dec_nyc_temp, marker="o")
plt.xlabel("Year")
plt.ylabel("Temperature")
plt.title("NYC Temperature by Year")
show()
plt.show()

@ -1,7 +1,14 @@
from pylab import plot, show
import numpy as np
import matplotlib.pyplot as plt
nyc_temp = [53.9, 56.3, 56.4, 53.4, 54.5, 55.8, 56.8, 55.0, 55.3, 54.0, 56.7, 56.4, 57.3]
nyc_temp = np.array([
53.9, 56.3, 56.4, 53.4, 54.5, 55.8,
56.8, 55.0, 55.3, 54.0, 56.7, 56.4, 57.3
])
plot(nyc_temp, marker="o")
plt.plot(nyc_temp, marker="o")
plt.xlabel("Day")
plt.ylabel("Temperature (°F)")
plt.title("NYC Temperatures")
show()
plt.show()

@ -0,0 +1,3 @@
matplotlib
notebook
numpy

@ -1 +1,302 @@
matplotlib
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in -o requirements.txt
anyio==4.12.1
# via
# httpx
# jupyter-server
argon2-cffi==25.1.0
# via jupyter-server
argon2-cffi-bindings==25.1.0
# via argon2-cffi
arrow==1.4.0
# via isoduration
asttokens==3.0.1
# via stack-data
async-lru==2.1.0
# via jupyterlab
attrs==25.4.0
# via
# jsonschema
# referencing
babel==2.18.0
# via jupyterlab-server
beautifulsoup4==4.14.3
# via nbconvert
bleach==6.3.0
# via nbconvert
certifi==2026.1.4
# via
# httpcore
# httpx
# requests
cffi==2.0.0
# via argon2-cffi-bindings
charset-normalizer==3.4.4
# via requests
comm==0.2.3
# via ipykernel
contourpy==1.3.3
# via matplotlib
cycler==0.12.1
# via matplotlib
debugpy==1.8.20
# via ipykernel
decorator==5.2.1
# via ipython
defusedxml==0.7.1
# via nbconvert
executing==2.2.1
# via stack-data
fastjsonschema==2.21.2
# via nbformat
fonttools==4.61.1
# via matplotlib
fqdn==1.5.1
# via jsonschema
h11==0.16.0
# via httpcore
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via jupyterlab
idna==3.11
# via
# anyio
# httpx
# jsonschema
# requests
ipykernel==7.1.0
# via jupyterlab
ipython==9.9.0
# via ipykernel
ipython-pygments-lexers==1.1.1
# via ipython
isoduration==20.11.0
# via jsonschema
jedi==0.19.2
# via ipython
jinja2==3.1.6
# via
# jupyter-server
# jupyterlab
# jupyterlab-server
# nbconvert
json5==0.13.0
# via jupyterlab-server
jsonpointer==3.0.0
# via jsonschema
jsonschema==4.26.0
# via
# jupyter-events
# jupyterlab-server
# nbformat
jsonschema-specifications==2025.9.1
# via jsonschema
jupyter-client==8.8.0
# via
# ipykernel
# jupyter-server
# nbclient
jupyter-core==5.9.1
# via
# ipykernel
# jupyter-client
# jupyter-server
# jupyterlab
# nbclient
# nbconvert
# nbformat
jupyter-events==0.12.0
# via jupyter-server
jupyter-lsp==2.3.0
# via jupyterlab
jupyter-server==2.17.0
# via
# jupyter-lsp
# jupyterlab
# jupyterlab-server
# notebook
# notebook-shim
jupyter-server-terminals==0.5.4
# via jupyter-server
jupyterlab==4.5.3
# via notebook
jupyterlab-pygments==0.3.0
# via nbconvert
jupyterlab-server==2.28.0
# via
# jupyterlab
# notebook
kiwisolver==1.4.9
# via matplotlib
lark==1.3.1
# via rfc3987-syntax
markupsafe==3.0.3
# via
# jinja2
# nbconvert
matplotlib==3.10.8
# via -r requirements.in
matplotlib-inline==0.2.1
# via
# ipykernel
# ipython
mistune==3.2.0
# via nbconvert
nbclient==0.10.4
# via nbconvert
nbconvert==7.17.0
# via jupyter-server
nbformat==5.10.4
# via
# jupyter-server
# nbclient
# nbconvert
nest-asyncio==1.6.0
# via ipykernel
notebook==7.5.3
# via -r requirements.in
notebook-shim==0.2.4
# via
# jupyterlab
# notebook
numpy==2.4.2
# via
# -r requirements.in
# contourpy
# matplotlib
packaging==26.0
# via
# ipykernel
# jupyter-events
# jupyter-server
# jupyterlab
# jupyterlab-server
# matplotlib
# nbconvert
pandocfilters==1.5.1
# via nbconvert
parso==0.8.5
# via jedi
pexpect==4.9.0
# via ipython
pillow==12.1.0
# via matplotlib
platformdirs==4.5.1
# via jupyter-core
prometheus-client==0.24.1
# via jupyter-server
prompt-toolkit==3.0.52
# via ipython
psutil==7.2.2
# via ipykernel
ptyprocess==0.7.0
# via
# pexpect
# terminado
pure-eval==0.2.3
# via stack-data
pycparser==3.0
# via cffi
pygments==2.19.2
# via
# ipython
# ipython-pygments-lexers
# nbconvert
pyparsing==3.3.2
# via matplotlib
python-dateutil==2.9.0.post0
# via
# arrow
# jupyter-client
# matplotlib
python-json-logger==4.0.0
# via jupyter-events
pyyaml==6.0.3
# via jupyter-events
pyzmq==27.1.0
# via
# ipykernel
# jupyter-client
# jupyter-server
referencing==0.37.0
# via
# jsonschema
# jsonschema-specifications
# jupyter-events
requests==2.32.5
# via jupyterlab-server
rfc3339-validator==0.1.4
# via
# jsonschema
# jupyter-events
rfc3986-validator==0.1.1
# via
# jsonschema
# jupyter-events
rfc3987-syntax==1.1.0
# via jsonschema
rpds-py==0.30.0
# via
# jsonschema
# referencing
send2trash==2.1.0
# via jupyter-server
setuptools==80.10.2
# via jupyterlab
six==1.17.0
# via
# python-dateutil
# rfc3339-validator
soupsieve==2.8.3
# via beautifulsoup4
stack-data==0.6.3
# via ipython
terminado==0.18.1
# via
# jupyter-server
# jupyter-server-terminals
tinycss2==1.4.0
# via bleach
tornado==6.5.4
# via
# ipykernel
# jupyter-client
# jupyter-server
# jupyterlab
# notebook
# terminado
traitlets==5.14.3
# via
# ipykernel
# ipython
# jupyter-client
# jupyter-core
# jupyter-events
# jupyter-server
# jupyterlab
# matplotlib-inline
# nbclient
# nbconvert
# nbformat
typing-extensions==4.15.0
# via
# anyio
# beautifulsoup4
# referencing
tzdata==2025.3
# via arrow
uri-template==1.3.0
# via jsonschema
urllib3==2.6.3
# via requests
wcwidth==0.5.3
# via prompt-toolkit
webcolors==25.10.0
# via jsonschema
webencodings==0.5.1
# via
# bleach
# tinycss2
websocket-client==1.9.0
# via jupyter-server

Loading…
Cancel
Save