Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 783 Bytes

File metadata and controls

46 lines (37 loc) · 783 Bytes
jupyter
jupytext kernelspec
formats text_representation
ipynb,md
extension format_name format_version jupytext_version
.md
markdown
1.1
1.2.2
display_name language name
Python 3
python
python3
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.dpi'] = 100

Frequency of a harmonic oscillator

Here, we will plot the frequency of a harmonic oscillator as a function of the spring constant.

Equations

From our equations, we know that:

$$ \omega = \sqrt{\frac{k}{m}} $$

Let's plot it!

k = np.linspace(0,10,100)
m = 1
omega = np.sqrt(k/m)
plt.plot(k,omega)
plt.xlabel("Spring constant (N/m)")
plt.ylabel("Angular frequency $\omega$ (rad/s)")