In [ ]:
from IPython.core.display import HTML

with open('../../common/creativecommons.html', 'r') as f:
    html = f.read()
    
with open('../../common/custom.css', 'r') as f:
    styles = f.read()
    
HTML(styles)

text = 'Check this post at'
uri = 'http://nbviewer.ipython.org/urls/raw.github.com/ocefpaf/python4oceanographers/master/content/downloads/notebooks'
name = get_notebook_name()
link = """<p>%s <a href="%s/%s"><em>nbviewer</em>.</a></p>""" % (text, uri, name)
html += str(link)

In [ ]:
import numpy as np
import matplotlib.pyplot as plt
  • Que tipo de onde seria essa? Lembre-se sempre de checar h/L!

In [ ]:
twopi = 2.0 * np.pi
x = 0.0
No = 10
L = 200
K = 2 * np.pi / L
H = 10.
g = 9.8

w = np.sqrt(g * K ** 2 * H)  # FIXME!
T = 2 * np.pi / w
t = twopi * np.linspace(0, T, 100)

In [ ]:
HoL = H/L
HoL

Using 10% of difference in $\delta k$ and $\delta \omega$.

  • Play with dk and dw and report the differeces you see.

In [ ]:
dk = 0.1 * K
dw = 0.1 * w

Using the equations from our notes:

$\eta_1 = \eta_o \cos[(K + \delta k)x - (\omega + \delta\omega)t]$

$\eta_2 = \eta_o \cos[(K - \delta k)x - (\omega - \delta\omega)t]$


In [ ]:
eta_1 = No * np.cos((K + dk) * x - (w + dw) * t)
eta_2 = No * np.cos((K - dk) * x - (w - dw) * t)

In [ ]:
fig, (ax0, ax1) = plt.subplots(nrows=2, ncols=1, figsize=(8, 4), sharex=True)
ax0.plot(t, eta_1, 'g', label=r'\eta_1')
ax0.plot(t, eta_2, 'b', label=r'\eta_2')
ax1.plot(t, eta_1 + eta_2, 'k', label=r'\eta_1 + \eta_2')
ax0.grid()
ax1.grid()

In [ ]:
HTML(html)