Advertisement
mirosh111000

6

Sep 17th, 2023
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import pandas as pd
  4. from scipy.integrate import odeint
  5.  
  6. def f(y, t):
  7.     y1, y2 = y
  8.     return [np.sin(y2)**2 - y1 + 3 * t, y2**(2/3) + 1 / y1 - t]
  9.  
  10. x = np.linspace(0, 16, 1000)
  11. y0 = np.array([2, 5])
  12. w = odeint(f, y0, x)
  13. y1 = w[:, 0]
  14. y2 = w[:, 1]
  15. plt.plot(x, y1, x, y2)
  16. plt.grid()
  17. plt.show()
  18.  
  19. df = pd.DataFrame({'X': x, 'y1': y1, 'y2': y2})
  20. print(df.iloc[624:695])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement