diff --git a/Makefile b/Makefile index 9414a0b..e5dca74 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ IGNORE_ERRORS = E501,F401,F403,F405 PKG = mathgenerator format: - python -m autopep8 --ignore=$(IGNORE_ERRORS) -i $(PKG)/* + python -m autopep8 --ignore=$(IGNORE_ERRORS) -ir $(PKG)/* lint: python -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) diff --git a/mathgenerator/funcs/angleBtwVectorsFunc.py b/mathgenerator/funcs/angleBtwVectorsFunc.py index b02b496..927ca38 100644 --- a/mathgenerator/funcs/angleBtwVectorsFunc.py +++ b/mathgenerator/funcs/angleBtwVectorsFunc.py @@ -3,18 +3,18 @@ from .__init__ import * def angleBtwVectorsFunc(maxEltAmt=20): s = 0 - v1 = [random.uniform(0, 1000) for i in range(random.randint(2,maxEltAmt))] + v1 = [random.uniform(0, 1000) for i in range(random.randint(2, maxEltAmt))] v2 = [random.uniform(0, 1000) for i in v1] for i in v1: for j in v2: s += i * j - mags = math.sqrt(sum([i**2 for i in v1])) * math.sqrt(sum([i**2 for i in v2])) + mags = math.sqrt(sum([i**2 for i in v1])) * math.sqrt(sum([i**2 for i in v2])) problem = f"angle between the vectors {v1} and {v2} is:" solution = '' try: solution = str(math.acos(s / mags)) - except: + except MathDomainError: print('angleBtwVectorsFunc has some issues with math module, line 16') solution = 'NaN' # would return the answer in radians diff --git a/mathgenerator/funcs/euclidianNormFunc.py b/mathgenerator/funcs/euclidianNormFunc.py index 6a414a9..28c85c5 100644 --- a/mathgenerator/funcs/euclidianNormFunc.py +++ b/mathgenerator/funcs/euclidianNormFunc.py @@ -2,7 +2,7 @@ from .__init__ import * def euclidianNormFunc(maxEltAmt=20): - vec = [random.uniform(0, 1000) for i in range(random.randint(2,maxEltAmt))] + vec = [random.uniform(0, 1000) for i in range(random.randint(2, maxEltAmt))] problem = f"Euclidian norm or L2 norm of the vector{vec} is:" solution = math.sqrt(sum([i**2 for i in vec])) return problem, solution