v[i+0.5]
does not work...v[n]
v[n-1]
v[n] = v[n-1] - dt*w**2*u[n]
!bc pycod
def solver(I, w, dt, T):
# set up variables...
u[0] = I
v[0] = 0 - 0.5*dt*w**2*u[0]
for n in range(1, Nt+1):
u[n] = u[n-1] + dt*v[n-1]
v[n] = v[n-1] - dt*w**2*u[n]
return u, t, v, t_v