Advertisement
mirosh111000

5

Sep 17th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. import numpy as np
  2. import sympy as sp
  3.  
  4. def diff(function, n=1):
  5.     for i in range(n):
  6.         function = sp.diff(function, x)
  7.     return function
  8.  
  9. x = sp.symbols('x')
  10.  
  11. f1 = sp.tan(x) + 5 * x**3
  12. f2 = sp.exp(-x) + sp.cos(2 * sp.pi - x**2)
  13.  
  14. diff_f1 = diff(f1, 2)
  15. diff_f2 = diff(f2, 10)
  16.  
  17. print(f'а) Відповідь: {diff_f1}')
  18. print(f'б) Відповідь: {diff_f2}')
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement