Skip to content

Commit

Permalink
docs(harmonic-oscillator): adjust tutorials to include ations or equa…
Browse files Browse the repository at this point in the history
…tion of motion

#49
  • Loading branch information
emptymalei committed Apr 15, 2024
1 parent 0352c4e commit 716157f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions docs/tutorials/harmonic_oscillator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@

# %% [markdown]
# ## Simple Harmonic Oscillator
#
# For an simple harmonic oscillator, the action of a simple harmonic oscillator is
#
# $$S_L[x] = \int_{t_0}^{t_1} \mathbb{d}t \left\{\frac{1}{2} m \dot x^2 - \frac{1}{2} m \omega^2 x^2 \right\}\,,$$
#
# where the least action principle leads to the following equation of motion,
#
# $$
# \ddot x + \omega^2 x = 0\,.
# $$
#
# A simple harmonic oscillator is a periodic motion.

# %%
sho_omega = 0.5
Expand All @@ -57,6 +69,14 @@

# %% [markdown]
# ## Damped Harmonic Oscillator
#
# A damped harmonic oscillator is a simple harmonic oscillator with damping force that is proportional to its velocity,
#
# $$
# \ddot x + \omega^2 x = - 2\xi\omega \dot x\,.
# $$
#
# In this section, we demonstrate three scenarios of a damped harmonic oscillator.

# %%
dho_systems = {
Expand Down
2 changes: 1 addition & 1 deletion hamilflow/models/harmonic_oscillator.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _x(self, t: ArrayLike) -> ArrayLike:


class DampedHarmonicOscillator(HarmonicOscillatorBase):
r"""Generate time series data for a [simple harmonic oscillator](https://en.wikipedia.org/wiki/Harmonic_oscillator).
r"""Generate time series data for a [damped harmonic oscillator](https://en.wikipedia.org/wiki/Harmonic_oscillator).
The equation for a general un-driven harmonic oscillator is[^wiki_ho][^libretext_ho]
Expand Down

0 comments on commit 716157f

Please sign in to comment.