Complex Harmonic Oscillator¶
In this tutorial, we show a few interesting examples of the complex simple harmonic oscillator.
In [1]:
Copied!
import math
import numpy as np
from plotly import express as px
from hamilflow.models.harmonic_oscillator import ComplexSimpleHarmonicOscillator
import math
import numpy as np
from plotly import express as px
from hamilflow.models.harmonic_oscillator import ComplexSimpleHarmonicOscillator
Basic setups¶
In [2]:
Copied!
t = np.linspace(0, 3, 257)
system_specs = {"omega": 2 * math.pi}
t = np.linspace(0, 3, 257)
system_specs = {"omega": 2 * math.pi}
Positive-frequency, circular-polarised mode¶
Also known as the left-rotating mode.
In [3]:
Copied!
csho = ComplexSimpleHarmonicOscillator(system_specs, initial_condition={"x0": (1, 0)})
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)
csho = ComplexSimpleHarmonicOscillator(system_specs, initial_condition={"x0": (1, 0)})
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)
Negative-frequency, circular-polarised mode¶
Also known as the right-rotating mode.
In [4]:
Copied!
csho = ComplexSimpleHarmonicOscillator(system_specs, initial_condition={"x0": (0, 1)})
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)
csho = ComplexSimpleHarmonicOscillator(system_specs, initial_condition={"x0": (0, 1)})
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)
Positive-frequency, elliptic-polarised mode¶
In [5]:
Copied!
csho = ComplexSimpleHarmonicOscillator(
system_specs,
initial_condition={"x0": (math.cos(math.pi / 12), math.sin(math.pi / 12))},
)
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)
csho = ComplexSimpleHarmonicOscillator(
system_specs,
initial_condition={"x0": (math.cos(math.pi / 12), math.sin(math.pi / 12))},
)
df = csho(t)
arr_z = df["z"].to_numpy(copy=False)
px.line_3d(
x=arr_z.real,
y=arr_z.imag,
z=t,
labels={"x": "real", "y": "imag", "z": "time"},
)