import numpy as np import matplotlib.pyplot as plt x = np.linspace(0,5,100) y = x*0 y[0] = -6 h = x[1]-x[0] for j in range(len(x)-1): y[j+1] = y[j] + 0.6*h*y[j]-h plt.plot(x,y)
x = np.linspace(0,5,100) h = x[1]-x[0] y0 = np.arange(-6,6,0.5) for i in y0: y = x*0 y[0] = i for j in range(len(x)-1): y[j+1] = h*np.sin(y[j])+y[j]-2*h plt.plot(x,y)