Advertisement
edward4324

lab5 funcs

May 11th, 2022
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def fd(func, x_to_diff, x_to_lambdify):
  2.     fdx = func.diff(x_to_diff)
  3.     return lambdify(x_to_lambdify, fdx, 'numpy')
  4.  
  5.  
  6. def gradient(func, x1, x2, point):
  7.     fdx1 = fd(func, x1, (x1, x2))
  8.     fdx2 = fd(func, x2, (x1, x2))
  9.     return [fdx1(point[0], point[1]), fdx2(point[0], point[1])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement