Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from scipy.integrate import odeint
- import matplotlib.pyplot as plt
- def system_of_equations(yz, x):
- y, z = yz
- dydx = y**2 + z - 3
- dzdx = np.cos(y) + x
- return [dydx, dzdx]
- initial_conditions = [4, 2]
- x_values = np.linspace(0, 0.255, 100)
- solution = odeint(system_of_equations, initial_conditions, x_values)
- y_values, z_values = solution[:, 0], solution[:, 1]
- plt.plot(x_values, y_values, label='y(x)')
- plt.xlabel('x')
- plt.ylabel('y')
- plt.legend()
- plt.grid()
- plt.title('Графік функції y(x)')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement