Advertisement
zuevv

mathfunctions.py

Nov 2nd, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import math
  2.  
  3. def sigm(x):
  4.     return 1 / (1 + math.e ** -x)
  5.  
  6.  
  7. def mult_piecewise(list1, list2):
  8.     assert len(list1) == len(list2)
  9.     return list(map(lambda x, y: x * y, list1, list2))
  10.  
  11.  
  12. def mult(list1, list2):
  13.     return sum(mult_piecewise(list1, list2))
  14.  
  15.  
  16. def add(list1, list2):
  17.     assert(len(list1)) == len(list2)
  18.     return list(map(lambda x, y: x + y, list1, list2))
  19.  
  20.  
  21. def subtract(list1, list2):
  22.     assert (len(list1)) == len(list2)
  23.     return list(map(lambda x, y: x - y, list1, list2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement