# Harmonic Waves, Standing Waves and Group Velocity

In this notebook (which I wrote as a side-experiment to the Coursera class Fundamentals of waves and vibrations), I investigate one-dimensional wave propagation and in particular the dispersion phenomenon.

# Non-dispersive 1D waves¶

Let's start with non-dispersive 1D waves. A simple object that allows us to do some nice computations is the harmonic wave. Quite simply put, an harmonic wave has a spatial pattern, which is due to its spatial phase and in particular its wavenumber k and a temporal pattern, due to its pulsation omega.

We start by defining the spatial pattern, a sort of phase map (as I described it in this previous blog article).

In [1]:
```import numpy as np

x = np.linspace(-5, 5, num=200)
k = 2 * np.pi / 1
phase = np.exp(1j * k * x)
```

If we add the time oscillation to the phase map, we get a propagating wave, which we can animate using `holoviews`:

In [2]:
```import holoviews as hv
hv.extension('matplotlib', logo=False)

hv.opts.defaults(hv.opts.Curve(fig_inches=6, aspect=1.5))
hv.opts.defaults(hv.opts.Overlay(fig_inches=6, aspect=1.5))

omega = k * 1.
T = 2 * np.pi / omega
N = 15
```
In [3]:
```%%output holomap='scrubber'
hmap1 = hv.HoloMap({i: hv.Curve((x, np.real(phase * np.exp(-1j * omega * i / N * T))),
label='plane wave') for i in range(N)})
hmap1
```
Out[3]:

With this simple relationship, we see a wave that propagates from left to right.

# Two plane waves¶

A first interesting pattern that we can obtain using this harmonic wave toolkit is what happens when two plane waves propagate in the same medium, each with the same speed, but going in opposite directions.

The wave going in the opposite direction is defined by the following phase map:

In [4]:
```phase_opposite = np.exp(-1j * k * x)
```

Which we can animate:

In [5]:
```%%output holomap='scrubber'
hmap2 = hv.HoloMap({i: hv.Curve((x, np.real(phase_opposite * np.exp(-1j * omega * i / N * T))),
label='plane wave -x') for i in range(N)})
hmap2
```
Out[5]: