From a60525edbc47bde83a15fc593383f6dee3798a44 Mon Sep 17 00:00:00 2001 From: devansh-07 Date: Mon, 19 Oct 2020 11:02:25 +0530 Subject: [PATCH 01/11] Added 2's complement --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/binary2sComplement.py | 26 +++++++++++++++++++++++ mathgenerator/mathgen.py | 1 + 3 files changed, 28 insertions(+) create mode 100644 mathgenerator/funcs/binary2sComplement.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..b43d727 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .binary2sComplement import * \ No newline at end of file diff --git a/mathgenerator/funcs/binary2sComplement.py b/mathgenerator/funcs/binary2sComplement.py new file mode 100644 index 0000000..f51b797 --- /dev/null +++ b/mathgenerator/funcs/binary2sComplement.py @@ -0,0 +1,26 @@ +from .__init__ import * + +def binary2sComplementFunc(maxDigits=10): + digits = random.randint(1, maxDigits) + question = ''.join([str(random.randint(0, 1)) for i in range(digits)]).lstrip('0') + + answer = [] + for i in question: + answer.append(str(int(not bool(int(i))))) + + carry = True + j = len(answer) - 1 + while j >= 0: + if answer[j] == '0': + answer[j] = '1' + carry = False + break + answer[j] = '0' + j -= 1 + + if j == 0 and carry == True: + answer.insert(0, '1') + + problem = "2's complement of " + question + " =" + solution = ''.join(answer).lstrip('0') + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..860c89b 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 = ", "101010", binary2sComplementFunc) \ No newline at end of file From 7e50827a75ef5b7f97ec9d17497ce61957712992 Mon Sep 17 00:00:00 2001 From: devansh-07 Date: Mon, 19 Oct 2020 11:06:36 +0530 Subject: [PATCH 02/11] Added 2's complement function --- mathgenerator/mathgen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 860c89b..302fa34 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,7 +1,7 @@ import random import math import fractions -from .funcs import * +from funcs import * genList = [] @@ -156,4 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) -binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 = ", "101010", binary2sComplementFunc) \ No newline at end of file +binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 =", "101010", binary2sComplementFunc) From d56f20cf0a2c518460a0fd0f121b114b90ff7b70 Mon Sep 17 00:00:00 2001 From: Jayesh Vasudeva <42416623+0tist@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:15:47 +0530 Subject: [PATCH 03/11] Update mathgen.py --- mathgenerator/mathgen.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..e015c81 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,5 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 68, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNorm) +angleBtwVectors=Generator("Angle between 2 vectors", 69, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", AngleBtwVectors) From 07cae1b56b7da4882d478cdd951909736928c00f Mon Sep 17 00:00:00 2001 From: Jayesh Vasudeva <42416623+0tist@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:17:40 +0530 Subject: [PATCH 04/11] Add files via upload --- mathgenerator/funcs/AngleBtwVectors.py | 16 ++++++++++++++++ mathgenerator/funcs/eucldianNorm.py | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/AngleBtwVectors.py create mode 100644 mathgenerator/funcs/eucldianNorm.py diff --git a/mathgenerator/funcs/AngleBtwVectors.py b/mathgenerator/funcs/AngleBtwVectors.py new file mode 100644 index 0000000..09e0a11 --- /dev/null +++ b/mathgenerator/funcs/AngleBtwVectors.py @@ -0,0 +1,16 @@ +import eucldianNorm +import math +from .__init__ import * + + +def AngleBtwVectors(v1: list, v2: list): + sum = 0 + for i in v1: + for j in v2: + sum += i * j + + mags = euclidianNorm(v1) * euclidianNorm(v2) + problem = f"angle between the vectors {v1} and {v2} is:" + solution = math.acos(sum / mags) + # would return the answer in radians + return problem, solution diff --git a/mathgenerator/funcs/eucldianNorm.py b/mathgenerator/funcs/eucldianNorm.py new file mode 100644 index 0000000..b672add --- /dev/null +++ b/mathgenerator/funcs/eucldianNorm.py @@ -0,0 +1,7 @@ +from .__init__ import * + + +def euclidianNorm(v1: list): + problem = f"Euclidian norm or L2 norm of the vector{v1} is:" + solution = sqrt(sum([i**2 for i in v1])) + return problem, solution From cb2f3e7abe7514e4697d75a9ff0bd5bd2b2453e3 Mon Sep 17 00:00:00 2001 From: himanshu1603 Date: Mon, 19 Oct 2020 12:16:18 +0530 Subject: [PATCH 05/11] added absolute difference --- mathgenerator/funcs/absoluteDifferenceFunc.py | 10 ++++++++++ mathgenerator/mathgen.py | 1 + 2 files changed, 11 insertions(+) create mode 100644 mathgenerator/funcs/absoluteDifferenceFunc.py diff --git a/mathgenerator/funcs/absoluteDifferenceFunc.py b/mathgenerator/funcs/absoluteDifferenceFunc.py new file mode 100644 index 0000000..d578d19 --- /dev/null +++ b/mathgenerator/funcs/absoluteDifferenceFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + +def absoluteDifferenceFunc (maxA = 100, maxB = 100): + a = random.randint(-1*maxA, maxA) + b = random.randint(-1*maxB, maxB) + absDiff = abs(a-b) + + problem = "Absolute difference between numbers " + str(a) + " and " + str(b) + " = " + solution = absDiff + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..ad94464 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +absoluteDifference=Generator("Absolute difference between two numbers", 68, "Absolute difference betweeen two numbers a and b =", "|a-b|", absoluteDifferenceFunc) From 13c19f480fc685f5f168a6e517a89b863714d83c Mon Sep 17 00:00:00 2001 From: Stefano Furin Date: Mon, 19 Oct 2020 09:13:35 +0200 Subject: [PATCH 06/11] fix generators numbering --- README.md | 10 ++++++++-- mathgenerator/mathgen.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6777b5c..1afacb8 100644 --- a/README.md +++ b/README.md @@ -91,5 +91,11 @@ problem, solution = mathgen.genById(0) | 57 | Trigonometric Values | What is cos(60)? | 1/2 | basicTrigonometry | | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | -| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | \ No newline at end of file +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 12m is | 1809.5573684677208 m^2 | surfaceAreaSphereGen | +| 61 | Volume of Sphere | Volume of sphere with radius 14 m = | 11494.040321933857 m^3 | volumeSphere | +| 62 | nth Fibonacci number | What is the 17th Fibonacci number? | 1597 | nthFibonacciNumberGen | +| 64 | Binary to Hexidecimal | 00 | 0x0 | binaryToHex | +| 65 | Multiplication of 2 complex numbers | (13-8j) * (-7-5j) = | (-131-9j) | complexNumMultiply | +| 66 | Geometric Progression | For the given GP [12, 48, 192, 768, 3072, 12288] ,Find the value of a,common ratio,9th term value, sum upto 11th term | The value of a is 12, common ratio is 4 , 9th term is 786432 , sum upto 11th term is 16777212.0 | geometricprogression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 42 and 40 = | (42*40)^(1/2) = 40.98780306383839 | geometricMean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 53 , 62 , 72 , 35 = | 4/((1/53) + (1/62) + (1/72) + (1/35)) = 51.64137311701554 | harmonicMean | \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..a10660d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -146,13 +146,13 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator( - "Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) -volumeSphere = Generator("Volume of Sphere", 60, + "Surface Area of Sphere", 60, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) +volumeSphere = Generator("Volume of Sphere", 61, "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) -nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) -profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) -binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", binaryToHexFunc) -complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) -geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) -geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) -harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +nthFibonacciNumberGen = Generator("nth Fibonacci number", 62, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) +profitLossPercent = Generator("Profit or Loss Percent", 63, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) +binaryToHex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=", "b", binaryToHexFunc) +complexNumMultiply = Generator("Multiplication of 2 complex numbers", 65, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) +geometricprogression=Generator("Geometric Progression", 66, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) +geometricMean=Generator("Geometric Mean of N Numbers",67,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +harmonicMean=Generator("Harmonic Mean of N Numbers",68,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) From ab960534f9de120c21282eb657aa47a97052e291 Mon Sep 17 00:00:00 2001 From: midhun varman Date: Mon, 19 Oct 2020 13:04:44 +0530 Subject: [PATCH 07/11] added vector dot product --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/vectorDotFunc.py | 13 +++++++++++++ mathgenerator/mathgen.py | 1 + 3 files changed, 15 insertions(+) create mode 100644 mathgenerator/funcs/vectorDotFunc.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..99ab6b4 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .vectorDotFunc import * diff --git a/mathgenerator/funcs/vectorDotFunc.py b/mathgenerator/funcs/vectorDotFunc.py new file mode 100644 index 0000000..a15cd75 --- /dev/null +++ b/mathgenerator/funcs/vectorDotFunc.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def vectorDotFunc(minVal=-20, maxVal=20): + a = [random.randint(minVal, maxVal) for i in range(3)] + b = [random.randint(minVal, maxVal) for i in range(3)] + c = [a[0] * b[0], + a[1] * b[1] , + a[2] * b[2] ] + + problem = str(a) + " . " + str(b) + " = " + solution = str(c) + return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..35c657f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +vectorDot = Generator("Dot Product of 2 Vectors",68, "a . b = ", "c", vectorDotFunc) From e77af6cdef48c660d3a82b80b22d983416da69e7 Mon Sep 17 00:00:00 2001 From: midhun varman Date: Mon, 19 Oct 2020 15:01:19 +0530 Subject: [PATCH 08/11] added dot product --- mathgenerator/funcs/vectorDotFunc.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mathgenerator/funcs/vectorDotFunc.py b/mathgenerator/funcs/vectorDotFunc.py index a15cd75..0364c65 100644 --- a/mathgenerator/funcs/vectorDotFunc.py +++ b/mathgenerator/funcs/vectorDotFunc.py @@ -4,9 +4,7 @@ from .__init__ import * def vectorDotFunc(minVal=-20, maxVal=20): a = [random.randint(minVal, maxVal) for i in range(3)] b = [random.randint(minVal, maxVal) for i in range(3)] - c = [a[0] * b[0], - a[1] * b[1] , - a[2] * b[2] ] + c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] problem = str(a) + " . " + str(b) + " = " solution = str(c) From fe0c86b33e09ee962c373e3ba01b9c0e1bd77a94 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Mon, 19 Oct 2020 09:28:09 -0400 Subject: [PATCH 09/11] Fix euclidianNorm and angleBtwVectors issues --- mathgenerator/funcs/__init__.py | 2 ++ .../funcs/{AngleBtwVectors.py => angleBtwVectorsFunc.py} | 6 +++--- .../funcs/{eucldianNorm.py => euclidianNormFunc.py} | 2 +- mathgenerator/mathgen.py | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) rename mathgenerator/funcs/{AngleBtwVectors.py => angleBtwVectorsFunc.py} (65%) rename mathgenerator/funcs/{eucldianNorm.py => euclidianNormFunc.py} (83%) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..25fb266 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,5 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .euclidianNormFunc import * +from .angleBtwVectorsFunc import * diff --git a/mathgenerator/funcs/AngleBtwVectors.py b/mathgenerator/funcs/angleBtwVectorsFunc.py similarity index 65% rename from mathgenerator/funcs/AngleBtwVectors.py rename to mathgenerator/funcs/angleBtwVectorsFunc.py index 09e0a11..bd2d0b5 100644 --- a/mathgenerator/funcs/AngleBtwVectors.py +++ b/mathgenerator/funcs/angleBtwVectorsFunc.py @@ -1,15 +1,15 @@ -import eucldianNorm +from .euclidianNormFunc import euclidianNormFunc import math from .__init__ import * -def AngleBtwVectors(v1: list, v2: list): +def angleBtwVectorsFunc(v1: list, v2: list): sum = 0 for i in v1: for j in v2: sum += i * j - mags = euclidianNorm(v1) * euclidianNorm(v2) + mags = euclidianNormFunc(v1) * euclidianNormFunc(v2) problem = f"angle between the vectors {v1} and {v2} is:" solution = math.acos(sum / mags) # would return the answer in radians diff --git a/mathgenerator/funcs/eucldianNorm.py b/mathgenerator/funcs/euclidianNormFunc.py similarity index 83% rename from mathgenerator/funcs/eucldianNorm.py rename to mathgenerator/funcs/euclidianNormFunc.py index b672add..f66329e 100644 --- a/mathgenerator/funcs/eucldianNorm.py +++ b/mathgenerator/funcs/euclidianNormFunc.py @@ -1,7 +1,7 @@ from .__init__ import * -def euclidianNorm(v1: list): +def euclidianNormFunc(v1: list): problem = f"Euclidian norm or L2 norm of the vector{v1} is:" solution = sqrt(sum([i**2 for i in v1])) return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4062a96..fa8fd91 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,5 +156,5 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 65, "(x + geometricprogression=Generator("Geometric Progression", 66, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",67,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",68,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) -eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 69, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNorm) -angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", AngleBtwVectors) +eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 69, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNormFunc) +angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", angleBtwVectorsFunc) From 3208d6d485f38b230d721160d3cbc27ecc426a30 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Mon, 19 Oct 2020 09:30:38 -0400 Subject: [PATCH 10/11] Added to __init__.py --- mathgenerator/funcs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 25fb266..bb75b5c 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -73,3 +73,4 @@ from .geometricMeanFunc import * from .harmonicMeanFunc import * from .euclidianNormFunc import * from .angleBtwVectorsFunc import * +from .absoluteDifferenceFunc import * From 16ebfb777c6b81aec9bed9bee05e9cb3761af28c Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Mon, 19 Oct 2020 09:40:13 -0400 Subject: [PATCH 11/11] Update mathgen.py --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0b84297..cdad10d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,7 +1,7 @@ import random import math import fractions -from funcs import * +from .funcs import * genList = []