Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # N(0, 1), N – количество элементов
- def NStandart(N):
- xk = np.array([])
- # R(0, 1)
- a1 = RStandart(N)
- time.sleep(3) # pause
- a2 = RStandart(N)
- for i in range(N):
- xk = np.append(xk, np.sqrt(-2 * np.log(a1[i])) * np.cos(2 * np.pi * a2[i]))
- return xk
- # Параметры задачи
- h = 0.05
- t0 = 0
- t1 = 10
- # разностная схема
- yij = np.zeros((4,int((t1-t0)/h)))
- xN = NStandart(int((t1 - t0)/h))
- for j in range(1,int((t1 - t0)/h)):
- yij[0][j] = yij[0][j-1] + h * yij[1][j-1] + 2 * np.sqrt(2) * np.pi * h * xN[j-1]
- yij[1][j] = -h * yij[0][j-1] + (1 - 2.5 * h) * yij[1][j - 1] + (np.sqrt(6 * np.pi) - 5 * np.sqrt(np.pi)) * np.sqrt(2 * np.pi) * h * xN[j - 1]
- # Строим график
- t = np.arange(t0, t1, h)
- plt.plot(t, yij[1])
- plt.grid(True)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement