Rename to src

This commit is contained in:
2022-02-18 16:26:51 -05:00
parent b4fbc7c7e2
commit 28355777e1
9 changed files with 0 additions and 0 deletions

22
src/tools.py Normal file
View File

@ -0,0 +1,22 @@
# sign function
def sgn(x):
if x>=0:
return 1
return -1
# check whether a number is an integer (with tolerance)
def isint_nonzero(x):
if abs(x)<1e-11:
return False
return abs(round(x)-x)<1e-11
# check that a number is in an interval
def in_interval(x,a,b):
return x>=a and x<=b
# remove x from list a
def remove_fromlist(a,x):
if x in a:
a[a.index(x)]=a[len(a)-1]
a=a[:len(a)-1]
return a