In [3]:
from ipywidgets import interact
import matplotlib.pyplot as plt
import numpy as np
In [4]:
a1 = 100
a2 = 110.
c1 = 1.1
c2 = 1.0
N = 100
M = 401
k = 0.01
u = np.empty((N,M))
x = np.linspace(0,1,M)
for j in range(N):
    t = j*k
    u[j] = np.sin( a1*(x-c1*t) ) + np.sin( a2*(x-c2*t) )

def draw(j):
    plt.plot(x,u[j])
    plt.xlim(0,1)
    
interact(draw,j=(0,N-1));
In [ ]: