python 2nd order ode

Solutions on MaxInterview for python 2nd order ode by the best coders in the world

showing results for - "python 2nd order ode"
Bruno
09 Jan 2017
1def dU_dx(U, x):
2    # Here U is a vector such that y=U[0] and z=U[1]. This function should return [y', z']
3    return [U[1], -2*U[1] - 2*U[0] + np.cos(2*x)]
4U0 = [0, 0]
5xs = np.linspace(0, 10, 200)
6Us = odeint(dU_dx, U0, xs)
7ys = Us[:,0]
8
similar questions
queries leading to this page
python 2nd order ode