From 804ef68f6c65d711b8204f3206bae16e2afa0d88 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:02:50 -0400 Subject: [PATCH 01/26] Added Quotient of Powers with Same Base number --- .../funcs/quotientofpowersamebase.py | 21 +++++++++++++++++++ mathgenerator/mathgen.py | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/quotientofpowersamebase.py diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py new file mode 100644 index 0000000..8fbceba --- /dev/null +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -0,0 +1,21 @@ +from .__init__ import * +from ..__init__ import Generator + + +def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): + base = random.randint(1, maxBase) + power1 = random.randint(1, maxPower) + power2 = random.randint(1, maxPower) + step = power1 - power2 + + problem = "The Quotient of {base}^{power1} and {base}^{power2} = " \ + "{base}^({power1}-{power2}) = {base}^{step}".format(base=base, + power1=power1, + power2=power2, + step=step) + solution = str(base**step) + return problem, solution + + +quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index f679b0c..f53bb51 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -268,3 +268,5 @@ decimalToHexadeci = Generator("Decimal to Hexadecimal", 79, "Binary of a=", percentage = Generator("Percentage of a number", 80, "What is a% of b?", "percentage", percentageFunc) celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) +quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) From 1844fb344720710c05fee848c3fcafc0ce9c0a54 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:10:32 -0400 Subject: [PATCH 02/26] Added Quotient of Powers with Same Power number --- .../funcs/quotientofpowersamepower.py | 21 +++++++++++++++++++ mathgenerator/mathgen.py | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/quotientofpowersamepower.py diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py new file mode 100644 index 0000000..25fd8cd --- /dev/null +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -0,0 +1,21 @@ +from .__init__ import * +from ..__init__ import Generator + + +def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): + base1 = random.randint(1, maxBase) + base2 = random.randint(1, maxBase) + power = random.randint(1, maxPower) + step = base1/base2 + + problem = "The Quotient of {base1}^{power} and {base2}^{power} = " \ + "({base1}/{base2})^{power} = {step}^{power}".format(base1=base1, + base2=base2, + power=power, + step=step) + solution = str(step**power) + return problem, solution + + +quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index f53bb51..849e4f2 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -270,3 +270,5 @@ percentage = Generator("Percentage of a number", 80, "What is a% of b?", celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) +quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) From 1daa09d0d152ff2f0c3d772243b6c0ce1e5c9792 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:34:27 -0400 Subject: [PATCH 03/26] Changed generator names to camelCase --- mathgenerator/funcs/quotientofpowersamebase.py | 2 +- mathgenerator/funcs/quotientofpowersamepower.py | 2 +- mathgenerator/mathgen.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py index 8fbceba..0e0fdf6 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -17,5 +17,5 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): return problem, solution -quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, +quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py index 25fd8cd..b7dd980 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -17,5 +17,5 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): return problem, solution -quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, +quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 849e4f2..3fb482c 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -267,8 +267,8 @@ decimalToHexadeci = Generator("Decimal to Hexadecimal", 79, "Binary of a=", "b", deciToHexaFunc) percentage = Generator("Percentage of a number", 80, "What is a% of b?", "percentage", percentageFunc) -celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) -quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, +celsiusToFahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) +quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) -quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, +quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) From 38b0e428ab62994bc76ddaa6c4cf3456f048d82f Mon Sep 17 00:00:00 2001 From: Metropass Date: Tue, 20 Oct 2020 13:21:16 -0400 Subject: [PATCH 04/26] updated repo --- mathgenerator/funcs/perimeter_of_polygons.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 mathgenerator/funcs/perimeter_of_polygons.py diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py new file mode 100644 index 0000000..f401491 --- /dev/null +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -0,0 +1,14 @@ +from .__init__ import * +from ..__init__ import Generator + + +def perimeterOfPolygonFunc(maxSides=12, maxLength=120)->"cm": + size_of_sides = random.randint(3,maxSides) + sides = [] + for x in range(size_of_sides): + sides.append(random.randint(1,maxLength)) + problem = "The perimeter of a " + str(size_of_sides) + " sided polygon with lengths of " + str(sides) + "cm is: " + solution = 0 + for y in range(len(sides)): + solution += sides[y] + return problem, solution From ff36197bbbd994ab1550ccfe221ca0d607dcfb59 Mon Sep 17 00:00:00 2001 From: Metropass Date: Tue, 20 Oct 2020 13:28:18 -0400 Subject: [PATCH 05/26] Fixed init.py --- mathgenerator/funcs/perimeter_of_polygons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index f401491..443dd0c 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def perimeterOfPolygonFunc(maxSides=12, maxLength=120)->"cm": +def perimeter_of_polygons(maxSides=12, maxLength=120)->"cm": size_of_sides = random.randint(3,maxSides) sides = [] for x in range(size_of_sides): From 47abb3926128d5e110e62ba7f54b55bcf3df03ab Mon Sep 17 00:00:00 2001 From: Metropass Date: Tue, 20 Oct 2020 13:30:37 -0400 Subject: [PATCH 06/26] Fixed init.py, again --- mathgenerator/funcs/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index bf59c56..bbe9a87 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -94,4 +94,5 @@ from .degree_to_rad import * from .radian_to_deg import * from .differentiation import * from .definite_integral import * -from .isprime import * \ No newline at end of file +from .isprime import * +from .perimeter_of_polygons import * From fda8aa5969e0ebb3fd88f94abb23e24fe234a208 Mon Sep 17 00:00:00 2001 From: Metropass Date: Tue, 20 Oct 2020 13:31:46 -0400 Subject: [PATCH 07/26] Fixed conflicts --- mathgenerator/funcs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index bbe9a87..4ab8ace 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -94,5 +94,5 @@ from .degree_to_rad import * from .radian_to_deg import * from .differentiation import * from .definite_integral import * -from .isprime import * +from .is_prime import * from .perimeter_of_polygons import * From 5c5caf3c872294414733d0501acd8f5b668efd60 Mon Sep 17 00:00:00 2001 From: Metropass Date: Tue, 20 Oct 2020 13:38:39 -0400 Subject: [PATCH 08/26] Fixed Lint --- mathgenerator/funcs/perimeter_of_polygons.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index 443dd0c..e74dcf4 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -3,10 +3,10 @@ from ..__init__ import Generator def perimeter_of_polygons(maxSides=12, maxLength=120)->"cm": - size_of_sides = random.randint(3,maxSides) + size_of_sides = random.randint(3, maxSides) sides = [] for x in range(size_of_sides): - sides.append(random.randint(1,maxLength)) + sides.append(random.randint(1, maxLength)) problem = "The perimeter of a " + str(size_of_sides) + " sided polygon with lengths of " + str(sides) + "cm is: " solution = 0 for y in range(len(sides)): From 0c17fc74b03e43ba8959ed12765f4f7ebc9e8906 Mon Sep 17 00:00:00 2001 From: Mo <58116522+Metropass@users.noreply.github.com> Date: Tue, 20 Oct 2020 14:01:29 -0400 Subject: [PATCH 09/26] Fixed Linter for the Function Definition --- mathgenerator/funcs/perimeter_of_polygons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index e74dcf4..7aa9458 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def perimeter_of_polygons(maxSides=12, maxLength=120)->"cm": +def perimeterOfPolygons(maxSides=12, maxLength=120): size_of_sides = random.randint(3, maxSides) sides = [] for x in range(size_of_sides): From 77a4f8c3e27d5690523269ac180b1c9992b4b030 Mon Sep 17 00:00:00 2001 From: strikeraryu Date: Wed, 21 Oct 2020 00:09:13 +0530 Subject: [PATCH 10/26] Added complex quadratic generator --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/complex_quadratic.py | 73 ++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 mathgenerator/funcs/complex_quadratic.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 56a2fd5..ca08fe5 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -95,3 +95,4 @@ from .radian_to_deg import * from .differentiation import * from .definite_integral import * from .is_prime import * +from .complex_quadratic import * diff --git a/mathgenerator/funcs/complex_quadratic.py b/mathgenerator/funcs/complex_quadratic.py new file mode 100644 index 0000000..9042c92 --- /dev/null +++ b/mathgenerator/funcs/complex_quadratic.py @@ -0,0 +1,73 @@ +from .__init__ import * + + +def complexQuadraticFunc(prob_type=0, max_range=10): + if prob_type < 0 or prob_type > 1: + print("prob_type not supported") + print("prob_type = 0 for real roots problems ") + print("prob_tpye = 1 for imaginary roots problems") + return None + if prob_type == 0: + d = -1 + while d < 0: + a = random.randrange(1, max_range) + b = random.randrange(1, max_range) + c = random.randrange(1, max_range) + + d = (b**2 - 4*a*c) + else: + d = 0 + while d >= 0: + a = random.randrange(1, max_range) + b = random.randrange(1, max_range) + c = random.randrange(1, max_range) + + d = (b**2 - 4*a*c) + + eq = '' + + if a == 1: + eq += 'x^2 + ' + else: + eq += str(a) + 'x^2 + ' + + if b == 1: + eq += 'x + ' + else: + eq += str(b) + 'x + ' + + eq += str(c) + ' = 0' + + problem = f'Find the roots of given Quadratic Equation ' + eq + + if d < 0: + roots = '' + sqrt_d = (-d)**0.5 + + if sqrt_d - int(sqrt_d) == 0: + sqrt_d = int(sqrt_d) + solution = f'(({-b} + {sqrt_d}i)/2*{a}, ({-b} - {sqrt_d}i)/2*{a})' + else: + solution = f'(({-b} + sqrt({-d})i)/2*{a}, ({-b} - sqrt({-d})i)/2*{a})' + + return problem, solution + + else: + s_root1 = round((-b + (d)**0.5)/(2*a), 3) + s_root2 = round((-b - (d)**0.5)/(2*a), 3) + + sqrt_d = (d)**0.5 + + if sqrt_d - int(sqrt_d) == 0: + sqrt_d = int(sqrt_d) + g_sol = f'(({-b} + {sqrt_d})/2*{a}, ({-b} - {sqrt_d})/2*{a})' + else: + g_sol = f'(({-b} + sqrt({d}))/2*{a}, ({-b} - sqrt({d}))/2*{a})' + + solution = f'simplified solution : ({s_root1, s_root2}), generalized solution : ' + g_sol + + return problem, solution + + +complex_quadratic = Generator("complex Quadratic Equation", 91, "Find the roots of given Quadratic Equation ", + "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc) From d4c810a6be23c373482ffeaee30ed22ea5d68125 Mon Sep 17 00:00:00 2001 From: deepampriyadarshi Date: Wed, 21 Oct 2020 16:14:29 +0530 Subject: [PATCH 11/26] Fixed bug #293 --- mathgenerator/funcs/angle_btw_vectors.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mathgenerator/funcs/angle_btw_vectors.py b/mathgenerator/funcs/angle_btw_vectors.py index f3b8a65..a65da35 100644 --- a/mathgenerator/funcs/angle_btw_vectors.py +++ b/mathgenerator/funcs/angle_btw_vectors.py @@ -4,17 +4,16 @@ import math def angleBtwVectorsFunc(maxEltAmt=20): s = 0 - 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 + v1 = [round(random.uniform(0, 1000), 2) for i in range(random.randint(2, maxEltAmt))] + v2 = [round(random.uniform(0, 1000), 2) for i in v1] + for i in range(len(v1)): + s += v1[i] * v2[i] 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)) + solution = str(round(math.acos(s / mags), 2)) + " radians" except ValueError: print('angleBtwVectorsFunc has some issues with math module, line 16') solution = 'NaN' From 86750f5867ba4c1a9fa9aeb62edc05ecc4604328 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 10:44:18 -0400 Subject: [PATCH 12/26] Fixed lint issues --- mathgenerator/funcs/quotientofpowersamebase.py | 2 +- mathgenerator/funcs/quotientofpowersamepower.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py index 0e0fdf6..546b205 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -18,4 +18,4 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py index b7dd980..2fabaa0 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -6,16 +6,16 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): base1 = random.randint(1, maxBase) base2 = random.randint(1, maxBase) power = random.randint(1, maxPower) - step = base1/base2 + step = base1 / base2 problem = "The Quotient of {base1}^{power} and {base2}^{power} = " \ "({base1}/{base2})^{power} = {step}^{power}".format(base1=base1, base2=base2, power=power, step=step) - solution = str(step**power) + solution = str(step ** power) return problem, solution quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) From a863e7a98f8fba66847d88c155485e3586ff5108 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:40:43 -0400 Subject: [PATCH 13/26] Added Power of Powers --- mathgenerator/funcs/power_of_powers.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 mathgenerator/funcs/power_of_powers.py diff --git a/mathgenerator/funcs/power_of_powers.py b/mathgenerator/funcs/power_of_powers.py new file mode 100644 index 0000000..ffe038e --- /dev/null +++ b/mathgenerator/funcs/power_of_powers.py @@ -0,0 +1,21 @@ +from .__init__ import * +from ..__init__ import Generator + + +def powerOfPowersFunc(maxBase=50, maxPower=10): + base = random.randint(1, maxBase) + power1 = random.randint(1, maxPower) + power2 = random.randint(1, maxPower) + step = power1 * power2 + + problem = "The {base}^{power1}^{power2} = " \ + "{base}^({power1}*{power2}) = {base}^{step}".format(base=base, + power1=power1, + power2=power2, + step=step) + solution = str(base**step) + return problem, solution + + +power_of_powers = Generator("Power of Powers", 82, + "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) From 0c10fb8bc35fcf5b65cdd52a78a605babe75b39b Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:43:22 -0400 Subject: [PATCH 14/26] Changed file names to match the project standards --- ...entofpowersamebase.py => quotient_of_power_same_base.py} | 6 +++--- ...tofpowersamepower.py => quotient_of_power_same_power.py} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename mathgenerator/funcs/{quotientofpowersamebase.py => quotient_of_power_same_base.py} (80%) rename mathgenerator/funcs/{quotientofpowersamepower.py => quotient_of_power_same_power.py} (72%) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotient_of_power_same_base.py similarity index 80% rename from mathgenerator/funcs/quotientofpowersamebase.py rename to mathgenerator/funcs/quotient_of_power_same_base.py index 546b205..01c6dd0 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): +def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): base = random.randint(1, maxBase) power1 = random.randint(1, maxPower) power2 = random.randint(1, maxPower) @@ -17,5 +17,5 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): return problem, solution -quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) +quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc()) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotient_of_power_same_power.py similarity index 72% rename from mathgenerator/funcs/quotientofpowersamepower.py rename to mathgenerator/funcs/quotient_of_power_same_power.py index 2fabaa0..d1383da 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotient_of_power_same_power.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): +def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): base1 = random.randint(1, maxBase) base2 = random.randint(1, maxBase) power = random.randint(1, maxPower) @@ -17,5 +17,5 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): return problem, solution -quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) +quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc()) From 94d677656b5ca6510820ae8317c25478758727a6 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:53:33 -0400 Subject: [PATCH 15/26] Lint issue... --- mathgenerator/funcs/quotient_of_power_same_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/quotient_of_power_same_base.py b/mathgenerator/funcs/quotient_of_power_same_base.py index 01c6dd0..4b74a7f 100644 --- a/mathgenerator/funcs/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -13,9 +13,9 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base**step) + solution = str(base ** step) return problem, solution quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc()) + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc()) From 161c87265f9138d7fc76029e88a1b36e7b30c12f Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:53:58 -0400 Subject: [PATCH 16/26] Lint issue... --- mathgenerator/funcs/power_of_powers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/power_of_powers.py b/mathgenerator/funcs/power_of_powers.py index ffe038e..0f4d90b 100644 --- a/mathgenerator/funcs/power_of_powers.py +++ b/mathgenerator/funcs/power_of_powers.py @@ -13,9 +13,9 @@ def powerOfPowersFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base**step) + solution = str(base ** step) return problem, solution power_of_powers = Generator("Power of Powers", 82, - "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) + "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) From b1d24537400a62335225ce4125236a7e27631f9b Mon Sep 17 00:00:00 2001 From: Yuval Goldberg Date: Thu, 22 Oct 2020 01:37:37 +0300 Subject: [PATCH 17/26] Add PYTHON variable to Makefile --- .github/workflows/tests.yaml | 38 +++++++++++++++++------------------- Makefile | 10 +++++++--- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d66144a..49d0e4c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,31 +4,29 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - pip install -r dev-requirements.txt + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make deps - - name: Linter - run: make lint + - name: Linter + run: make lint - - name: Test - run: make test + - name: Test + run: make test diff --git a/Makefile b/Makefile index e5dca74..eb91e5e 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,15 @@ IGNORE_ERRORS = E501,F401,F403,F405 PKG = mathgenerator +PYTHON ?= python3 + +deps: + $(PYTHON) -m pip install --user -r dev-requirements.txt format: - python -m autopep8 --ignore=$(IGNORE_ERRORS) -ir $(PKG)/* + $(PYTHON) -m autopep8 --ignore=$(IGNORE_ERRORS) -ir $(PKG)/* lint: - python -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) + $(PYTHON) -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) test: - python -m pytest --verbose -s tests + $(PYTHON) -m pytest --verbose -s tests From c35608a51ef6a4ccfdcc6011e650b004c94ef068 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 21:26:37 -0400 Subject: [PATCH 18/26] perimeter of polygons fix --- README.md | 189 ++++++++++--------- mathgenerator/funcs/__init__.py | 2 +- mathgenerator/funcs/perimeter_of_polygons.py | 8 +- test.py | 2 +- 4 files changed, 103 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index bae0d1f..894488f 100644 --- a/README.md +++ b/README.md @@ -31,99 +31,100 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 48+19= | 67 | addition | -| 1 | Subtraction | 31-0= | 31 | subtraction | -| 2 | Multiplication | 44*1= | 44 | multiplication | -| 3 | Division | 19/73= | 0.2602739726027397 | division | -| 4 | Binary Complement 1s | 001110110= | 110001001 | binary_complement_1s | -| 5 | Modulo Division | 99%80= | 19 | modulo_division | -| 6 | Square Root | sqrt(144)= | 12 | square_root | -| 7 | Power Rule Differentiation | 7x^8 + 9x^3 | 56x^7 + 27x^2 | power_rule_differentiation | -| 8 | Square | 15^2= | 225 | square | -| 9 | LCM (Least Common Multiple) | LCM of 18 and 10 = | 90 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 9 and 8 = | 1 | gcd | -| 11 | Basic Algebra | 9x + 10 = 10 | 0 | basic_algebra | -| 12 | Logarithm | log2(32) | 5 | log | -| 13 | Easy Division | 475/19 = | 25 | int_division | -| 14 | Decimal to Binary | Binary of 97= | 1100001 | decimal_to_binary | -| 15 | Binary to Decimal | 0110 | 6 | binary_to_decimal | -| 16 | Fraction Division | (3/6)/(7/1) | 1/14 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 12 * [[2, 6], [3, 3]] = | [[24,72],[36,36]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 12 2 2 = | (2.0782945349651837e-15+33.94112549695428j) | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 40, 5 and 39 exist? | Yes | valid_triangle | -| 20 | Midpoint of the two point | (-14,11),(-2,9)= | (-8.0,10.0) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-5x-14 | (x+2)(x-7) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 27 and 88 = | 65 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | -7x - 7y = -14, -7x - 8y = -18 | x = -2, y = 4 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (5, 9) and (5, 8) | sqrt(1) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 13 and 17 = | 21.40 | pythagorean_theorem | -| 26 | Linear Equations | 2x + -1y = -19, -14x + -9y = 149 | x = -10, y = -1 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 8 | [2, 2, 2] | prime_factors | -| 28 | Fraction Multiplication | (3/1)*(2/10) | 3/5 | fraction_multiplication | +| 0 | Addition | 48+45= | 93 | addition | +| 1 | Subtraction | 71-33= | 38 | subtraction | +| 2 | Multiplication | 87*0= | 0 | multiplication | +| 3 | Division | 14/26= | 0.5384615384615384 | division | +| 4 | Binary Complement 1s | 010= | 101 | binary_complement_1s | +| 5 | Modulo Division | 87%32= | 23 | modulo_division | +| 6 | Square Root | sqrt(25)= | 5 | square_root | +| 7 | Power Rule Differentiation | 3x^8 + 10x^10 + 10x^10 + 9x^4 | 24x^7 + 100x^9 + 100x^9 + 36x^3 | power_rule_differentiation | +| 8 | Square | 7^2= | 49 | square | +| 9 | LCM (Least Common Multiple) | LCM of 19 and 1 = | 19 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 7 and 14 = | 7 | gcd | +| 11 | Basic Algebra | 1x + 6 = 6 | 0 | basic_algebra | +| 12 | Logarithm | log3(6561) | 8 | log | +| 13 | Easy Division | 18/18 = | 1 | int_division | +| 14 | Decimal to Binary | Binary of 51= | 110011 | decimal_to_binary | +| 15 | Binary to Decimal | 110 | 6 | binary_to_decimal | +| 16 | Fraction Division | (6/2)/(3/4) | 4 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 6 * [[9, 7], [7, 0]] = | [[54,42],[42,0]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 1 11 12 = | 0.0 | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 12, 13 and 20 exist? | Yes | valid_triangle | +| 20 | Midpoint of the two point | (-14,-9),(-5,0)= | (-9.5,-4.5) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2-7x-30 | (x-10)(x+3) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 46 and 1 = | 133 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | -3x + 9y = 45, -9x + 6y = 9 | x = 3, y = 6 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (-12, 9) and (-17, -14) | sqrt(554) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 6 and 14 = | 15.23 | pythagorean_theorem | +| 26 | Linear Equations | 13x + 14y = 113, 15x + 13y = 102 | x = -1, y = 9 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 18 | [2, 3, 3] | prime_factors | +| 28 | Fraction Multiplication | (3/7)*(9/10) | 27/70 | fraction_multiplication | | 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 20 sides | 162.0 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 16 objects picked 5 at a time | 4368 | combinations | -| 31 | Factorial | 0! = | 1 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 4m is | 96 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 19m, 10m, 16m is | 1308 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 32m and radius = 5m is | 1162 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 20m is | 8000 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 11m, 17m, 1m is | 187 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 16m and radius = 17m is | 14526 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 36m and radius = 1m is | 116 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 17m and radius = 17m is | 5144 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 80 and 59 = | [1] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 10/6x + 6 and y = 5x + 7 | (-3/10, 11/2) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 15 objects picked 1 at a time = | 15 | permutation | -| 43 | Cross Product of 2 Vectors | [16, -8, 0] X [11, -6, -13] = | [104, 208, -8] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 4/6 and 7/9? | < | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 1857 dollars, 8% rate of interest and for a time period of 7 years is = | 1039.92 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
5-303
-6-6-98
-4-2-8-2
and
-10-10-210
-6-9-5-9
27-8-8
-26100
|
-38-53577
629919466
40-106242
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 616 upto 2 decimal places is: | 8.51 | cube_root | -| 48 | Power Rule Integration | 4x^1 | (4/1)x^2 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 72 , 42, 103 = | 143 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 88x^2+181x+68=0 | [-0.49, -1.56] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 2 and 1 = | 1 | hcf | -| 52 | Probability of a certain sum appearing on faces of dice | If 3 dice are rolled at the same time, the probability of getting a sum of 16 = | 6/216 | dice_sum_probability | -| 53 | Exponentiation | 17^10 = | 2015993900449 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [289, 211, 294, 290, 264, 258, 229, 265, 272, 228, 257, 262, 210, 259, 246, 224, 266, 283, 273, 222, 250, 241, 225, 237] with 99% confidence is | (265.1917573633045, 239.39157597002884) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 81^(1/7) _ 54^(1/9) | > | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 20 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181] | fibonacci_series | -| 57 | Trigonometric Values | What is cos(90)? | 0 | basic_trigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 9 sides = | 1260 | sum_of_polygon_angles | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[43, 23, 43, 13, 16, 40, 36, 19, 17, 39, 45, 26, 12, 17, 12] | The Mean is 26.733333333333334 , Standard Deviation is 151.79555555555555, Variance is 12.3205338989654 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 10m is | 1256.6370614359173 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 93 m = | 3369282.722751367 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 52th Fibonacci number? | 32951280099 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Loss percent when CP = 798 and SP = 713 is: | 10.651629072681704 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 0000 | 0x0 | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (14-1j) * (-15+4j) = | (-206+71j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [8, 24, 72, 216, 648, 1944] ,Find the value of a,common ratio,11th term value, sum upto 8th term | The value of a is 8, common ratio is 3 , 11th term is 472392 , sum upto 8th term is 26240.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 65 , 75 , 65 , 23 = | (65*75*65*23)^(1/4) = 51.95818275737109 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 2 and 12 = | 2/((1/2) + (1/12)) = 3.4285714285714284 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[488.10260237588165, 438.9926997215375, 481.4248776631771, 480.58824363943177, 509.73053046857785, 268.09288505668803, 410.3732502610836, 318.6216647891933, 296.4238196042428, 808.0996438115192, 121.7211186065138, 615.1986904309553, 380.29841107431093, 195.23491823519456, 81.69943837555405, 155.69629311805645, 97.46954246782546, 634.0953876946306, 199.72352388042535, 568.2278203619796] is: | 1901.9741243296269 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [955.8351549798066, 177.1594811522551, 900.6055058476991, 712.0208070601419, 601.3956854892953, 628.8267644026017, 893.2727217464875, 492.4340309181726] and [668.7008663033757, 138.7169080640255, 515.5875138676224, 230.03917249114247, 51.099523634880015, 894.1460097286858, 313.47733623460283, 837.2412043583688] is: | NaN | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers -63 and 84 = | 147 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [7, -9, 12] . [6, 12, 14] = | 102 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 11101 = | 11 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[61, 90, 56], [2, 74, 38], [29, 91, 7]]) is: | Matrix([[735/47851, -2233/95702, 181/47851], [-272/47851, 1197/191404, 1103/95702], [491/47851, 2941/191404, -2167/95702]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 17 and angle, 98. Find the area of the sector. | Area of sector = 247.15608 | sector_area | -| 76 | Mean and Median | Given the series of numbers [13, 89, 68, 53, 61, 3, 17, 66, 63, 48]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 48.1 and Arithmetic median of this series is 57.0 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[49, 6], [62, 19]]) = | 559 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 7750 dollars, 9% rate of interest and for a time period of 7 year is = | 14167.3 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 972= | 0x3cc | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 38% of 82? | Required percentage = 31.16% | percentage | -| 81 | Celsius To Fahrenheit | Convert -49 degrees Celsius to degrees Fahrenheit = | -56.2 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 83 of the AP series: -41, -110, -179 ... | -5699 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 99 terms of the AP series: 20, -59, -138 ... | -381249.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 1424 in Octal is: | 0o2620 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 3563 in Roman Numerals is: | MMMDLXIII | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 286 in radians is = | 4.99 | degree_to_rad | +| 30 | Combinations of Objects | Number of combinations from 10 objects picked 9 at a time | 10 | combinations | +| 31 | Factorial | 3! = | 6 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 10m is | 600 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 14m, 2m, 14m is | 504 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 25m and radius = 7m is | 1407 m^2 | surface_area_cylinder | +| 35 | Volum of Cube | Volume of cube with side = 4m is | 64 m^3 | volume_cube | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 5m, 18m, 8m is | 720 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 34m and radius = 8m is | 6836 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 2m and radius = 20m is | 2519 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 44m and radius = 12m is | 6635 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 17 and 86 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -5/4x - 2 and y = -9x - 6 | (-16/31, -42/31) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 12 objects picked 4 at a time = | 11880 | permutation | +| 43 | Cross Product of 2 Vectors | [-13, -1, -10] X [0, 18, -12] = | [192, -156, -234] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 5/2 and 10/8? | > | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 5498 dollars, 5% rate of interest and for a time period of 3 years is = | 824.7 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
-63-5
-96-5
-10-109
4-4-4
and
0-4
-4-1
-26
|
-2-9
-140
22104
24-36
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 968 upto 2 decimal places is: | 9.89 | cube_root | +| 48 | Power Rule Integration | 7x^9 + 7x^5 + 10x^7 + 4x^4 | (7/9)x^10 + (7/5)x^6 + (10/7)x^8 + (4/4)x^5 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 173 , 31, 114 = | 42 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 68x^2+182x+87=0 | [-0.62, -2.05] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 7 and 14 = | 7 | hcf | +| 52 | Probability of a certain sum appearing on faces of dice | If 3 dice are rolled at the same time, the probability of getting a sum of 10 = | 27/216 | dice_sum_probability | +| 53 | Exponentiation | 11^4 = | 14641 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [235, 253, 263, 269, 298, 284, 208, 206, 259, 234, 246, 262, 268, 224, 280, 242, 287, 230, 239, 258, 225] with 90% confidence is | (259.8648254059283, 242.03993649883367) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 73^(1/1) _ 48^(1/3) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 8 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13] | fibonacci_series | +| 57 | Trigonometric Values | What is tan(0)? | 0 | basic_trigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 6 sides = | 720 | sum_of_polygon_angles | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[11, 16, 26, 47, 12, 32, 21, 44, 35, 49, 25, 19, 35, 38, 46] | The Mean is 30.4 , Standard Deviation is 156.10666666666668, Variance is 12.494265351218802 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 14m is | 2463.0086404143976 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 99 m = | 4064378.94691403 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 68th Fibonacci number? | 72723460248141 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 114 and SP = 746 is: | 554.3859649122808 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 001111 | 0xf | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (7+4j) * (16-11j) = | (156-13j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [4, 36, 324, 2916, 26244, 236196] ,Find the value of a,common ratio,11th term value, sum upto 9th term | The value of a is 4, common ratio is 9 , 11th term is 13947137604 , sum upto 9th term is 193710244.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 56 , 8 , 51 , 33 = | (56*8*51*33)^(1/4) = 29.467312750334496 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 97 and 28 = | 2/((1/97) + (1/28)) = 43.456 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[473.48308338171165, 718.7895179222332, 313.2067061144618, 613.6012136748973, 19.16574105047797] is: | 1102.640837776255 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [127.16446951950677, 696.3193812597515, 791.5623049234473, 264.1941927989295] and [932.5653922587298, 157.61937181749875, 728.0808842217069, 965.6177311470876] is: | NaN | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers 69 and -54 = | 123 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [11, -4, 17] . [11, -11, 14] = | 403 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 111111010 = | 110 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[31, 66, 59], [43, 17, 28], [51, 5, 95]]) is: | Matrix([[-295/33621, 1195/33621, -169/33621], [2657/168105, 64/168105, -1669/168105], [652/168105, -3211/168105, 2311/168105]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 12 and angle, 138. Find the area of the sector. | Area of sector = 173.41591 | sector_area | +| 76 | Mean and Median | Given the series of numbers [39, 22, 54, 49, 93, 66, 33, 71, 1, 75]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 50.3 and Arithmetic median of this series is 51.5 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[15, 29], [10, 80]]) = | 910 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 8382 dollars, 3% rate of interest and for a time period of 2 year is = | 8892.46 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 814= | 0x32e | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 84% of 67? | Required percentage = 56.28% | percentage | +| 81 | Celsius To Fahrenheit | Convert 62 degrees Celsius to degrees Fahrenheit = | 143.60000000000002 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 62 of the AP series: -34, -70, -106 ... | -2230 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 81 terms of the AP series: 8, 80, 152 ... | 233928.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 2544 in Octal is: | 0o4760 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 2921 in Roman Numerals is: | MMCMXXI | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 99 in radians is = | 1.73 | degree_to_rad | | 87 | Radians to Degrees | Angle 2 in degrees is = | 114.59 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(exp(x)+6*x^(-3))/dx | exp(x) - 18/x^4 | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 94x^2 + 86x + 97 is = | 171.3333 | definite_integral | -| 90 | isprime | 28 | False | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 9 is = | 37408 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 15.65exp(i-2.68) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={2, 3, 5} ,b={2, 3, 6, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {2, 3, 5, 6, 7},Intersection is {2, 3}, a-b is {5},b-a is {6, 7}, Symmetric difference is {5, 6, 7} | set_operation | -| 94 | Base Conversion | Convert E656 from base 16 to base 12. | 2A15A | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 43 and height, 85? | CSA of cylinder = 22965.04 | curved_surface_area_cylinder | +| 88 | Differentiation | differentiate w.r.t x : d(cos(x)+6*x^4)/dx | 24*x^3 - sin(x) | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 76x^2 + 60x + 37 is = | 92.3333 | definite_integral | +| 90 | isprime | 56 | False | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 8 is = | 35153 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 18.11exp(i1.46) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 10, 9} ,b={8, 1, 2}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 8, 9, 10},Intersection is {1}, a-b is {9, 10},b-a is {8, 2}, Symmetric difference is {8, 9, 2, 10} | set_operation | +| 94 | Base Conversion | Convert 26897 from base 10 to base 9. | 40805 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 38 and height, 88? | CSA of cylinder = 21010.97 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [113, 56, 99, 80, 103, 80, 70, 88, 82]cm is: | 771 | perimeter_of_polygons | diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 073112b..f3c60bc 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -95,9 +95,9 @@ from .radian_to_deg import * from .differentiation import * from .definite_integral import * from .is_prime import * -from .perimeter_of_polygons import * from .bcd_to_decimal import * from .complex_to_polar import * from .set_operation import * from .base_conversion import * from .curved_surface_area_cylinder import * +from .perimeter_of_polygons import * diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index 7aa9458..e15402d 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -1,5 +1,4 @@ from .__init__ import * -from ..__init__ import Generator def perimeterOfPolygons(maxSides=12, maxLength=120): @@ -7,8 +6,13 @@ def perimeterOfPolygons(maxSides=12, maxLength=120): sides = [] for x in range(size_of_sides): sides.append(random.randint(1, maxLength)) - problem = "The perimeter of a " + str(size_of_sides) + " sided polygon with lengths of " + str(sides) + "cm is: " + problem = "The perimeter of a " + str(size_of_sides) + \ + " sided polygon with lengths of " + str(sides) + "cm is: " solution = 0 for y in range(len(sides)): solution += sides[y] return problem, solution + + +perimeter_of_polygons = Generator( + "Perimeter of Polygons", 96, "The perimeter of a x sided polygon with lengths of y cm is: ", "z", perimeterOfPolygons) diff --git a/test.py b/test.py index 126c9d8..f6339f9 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(95)) +print(mathgen.genById(96)) From 3bb6c6f85e9b15fb2117b51dd41e4dc056fb199f Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 21:37:29 -0400 Subject: [PATCH 19/26] power of powers fix --- README.md | 194 ++++++++++++------------- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/power_of_powers.py | 3 +- test.py | 2 +- 4 files changed, 100 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 894488f..a8d3aa9 100644 --- a/README.md +++ b/README.md @@ -31,100 +31,100 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 48+45= | 93 | addition | -| 1 | Subtraction | 71-33= | 38 | subtraction | -| 2 | Multiplication | 87*0= | 0 | multiplication | -| 3 | Division | 14/26= | 0.5384615384615384 | division | -| 4 | Binary Complement 1s | 010= | 101 | binary_complement_1s | -| 5 | Modulo Division | 87%32= | 23 | modulo_division | -| 6 | Square Root | sqrt(25)= | 5 | square_root | -| 7 | Power Rule Differentiation | 3x^8 + 10x^10 + 10x^10 + 9x^4 | 24x^7 + 100x^9 + 100x^9 + 36x^3 | power_rule_differentiation | -| 8 | Square | 7^2= | 49 | square | -| 9 | LCM (Least Common Multiple) | LCM of 19 and 1 = | 19 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 7 and 14 = | 7 | gcd | -| 11 | Basic Algebra | 1x + 6 = 6 | 0 | basic_algebra | -| 12 | Logarithm | log3(6561) | 8 | log | -| 13 | Easy Division | 18/18 = | 1 | int_division | -| 14 | Decimal to Binary | Binary of 51= | 110011 | decimal_to_binary | -| 15 | Binary to Decimal | 110 | 6 | binary_to_decimal | -| 16 | Fraction Division | (6/2)/(3/4) | 4 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 6 * [[9, 7], [7, 0]] = | [[54,42],[42,0]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 1 11 12 = | 0.0 | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 12, 13 and 20 exist? | Yes | valid_triangle | -| 20 | Midpoint of the two point | (-14,-9),(-5,0)= | (-9.5,-4.5) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-7x-30 | (x-10)(x+3) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 46 and 1 = | 133 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | -3x + 9y = 45, -9x + 6y = 9 | x = 3, y = 6 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (-12, 9) and (-17, -14) | sqrt(554) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 6 and 14 = | 15.23 | pythagorean_theorem | -| 26 | Linear Equations | 13x + 14y = 113, 15x + 13y = 102 | x = -1, y = 9 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 18 | [2, 3, 3] | prime_factors | -| 28 | Fraction Multiplication | (3/7)*(9/10) | 27/70 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 20 sides | 162.0 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 10 objects picked 9 at a time | 10 | combinations | -| 31 | Factorial | 3! = | 6 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 10m is | 600 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 14m, 2m, 14m is | 504 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 25m and radius = 7m is | 1407 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 4m is | 64 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 5m, 18m, 8m is | 720 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 34m and radius = 8m is | 6836 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 2m and radius = 20m is | 2519 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 44m and radius = 12m is | 6635 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 17 and 86 = | [1] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -5/4x - 2 and y = -9x - 6 | (-16/31, -42/31) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 12 objects picked 4 at a time = | 11880 | permutation | -| 43 | Cross Product of 2 Vectors | [-13, -1, -10] X [0, 18, -12] = | [192, -156, -234] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 5/2 and 10/8? | > | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 5498 dollars, 5% rate of interest and for a time period of 3 years is = | 824.7 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
-63-5
-96-5
-10-109
4-4-4
and
0-4
-4-1
-26
|
-2-9
-140
22104
24-36
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 968 upto 2 decimal places is: | 9.89 | cube_root | -| 48 | Power Rule Integration | 7x^9 + 7x^5 + 10x^7 + 4x^4 | (7/9)x^10 + (7/5)x^6 + (10/7)x^8 + (4/4)x^5 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 173 , 31, 114 = | 42 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 68x^2+182x+87=0 | [-0.62, -2.05] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 7 and 14 = | 7 | hcf | -| 52 | Probability of a certain sum appearing on faces of dice | If 3 dice are rolled at the same time, the probability of getting a sum of 10 = | 27/216 | dice_sum_probability | -| 53 | Exponentiation | 11^4 = | 14641 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [235, 253, 263, 269, 298, 284, 208, 206, 259, 234, 246, 262, 268, 224, 280, 242, 287, 230, 239, 258, 225] with 90% confidence is | (259.8648254059283, 242.03993649883367) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 73^(1/1) _ 48^(1/3) | > | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 8 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13] | fibonacci_series | -| 57 | Trigonometric Values | What is tan(0)? | 0 | basic_trigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 6 sides = | 720 | sum_of_polygon_angles | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[11, 16, 26, 47, 12, 32, 21, 44, 35, 49, 25, 19, 35, 38, 46] | The Mean is 30.4 , Standard Deviation is 156.10666666666668, Variance is 12.494265351218802 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 14m is | 2463.0086404143976 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 99 m = | 4064378.94691403 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 68th Fibonacci number? | 72723460248141 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 114 and SP = 746 is: | 554.3859649122808 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 001111 | 0xf | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (7+4j) * (16-11j) = | (156-13j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [4, 36, 324, 2916, 26244, 236196] ,Find the value of a,common ratio,11th term value, sum upto 9th term | The value of a is 4, common ratio is 9 , 11th term is 13947137604 , sum upto 9th term is 193710244.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 56 , 8 , 51 , 33 = | (56*8*51*33)^(1/4) = 29.467312750334496 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 97 and 28 = | 2/((1/97) + (1/28)) = 43.456 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[473.48308338171165, 718.7895179222332, 313.2067061144618, 613.6012136748973, 19.16574105047797] is: | 1102.640837776255 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [127.16446951950677, 696.3193812597515, 791.5623049234473, 264.1941927989295] and [932.5653922587298, 157.61937181749875, 728.0808842217069, 965.6177311470876] is: | NaN | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers 69 and -54 = | 123 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [11, -4, 17] . [11, -11, 14] = | 403 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 111111010 = | 110 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[31, 66, 59], [43, 17, 28], [51, 5, 95]]) is: | Matrix([[-295/33621, 1195/33621, -169/33621], [2657/168105, 64/168105, -1669/168105], [652/168105, -3211/168105, 2311/168105]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 12 and angle, 138. Find the area of the sector. | Area of sector = 173.41591 | sector_area | -| 76 | Mean and Median | Given the series of numbers [39, 22, 54, 49, 93, 66, 33, 71, 1, 75]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 50.3 and Arithmetic median of this series is 51.5 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[15, 29], [10, 80]]) = | 910 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 8382 dollars, 3% rate of interest and for a time period of 2 year is = | 8892.46 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 814= | 0x32e | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 84% of 67? | Required percentage = 56.28% | percentage | -| 81 | Celsius To Fahrenheit | Convert 62 degrees Celsius to degrees Fahrenheit = | 143.60000000000002 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 62 of the AP series: -34, -70, -106 ... | -2230 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 81 terms of the AP series: 8, 80, 152 ... | 233928.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 2544 in Octal is: | 0o4760 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 2921 in Roman Numerals is: | MMCMXXI | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 99 in radians is = | 1.73 | degree_to_rad | -| 87 | Radians to Degrees | Angle 2 in degrees is = | 114.59 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(cos(x)+6*x^4)/dx | 24*x^3 - sin(x) | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 76x^2 + 60x + 37 is = | 92.3333 | definite_integral | -| 90 | isprime | 56 | False | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 8 is = | 35153 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 18.11exp(i1.46) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 10, 9} ,b={8, 1, 2}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 8, 9, 10},Intersection is {1}, a-b is {9, 10},b-a is {8, 2}, Symmetric difference is {8, 9, 2, 10} | set_operation | -| 94 | Base Conversion | Convert 26897 from base 10 to base 9. | 40805 | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 38 and height, 88? | CSA of cylinder = 21010.97 | curved_surface_area_cylinder | -| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [113, 56, 99, 80, 103, 80, 70, 88, 82]cm is: | 771 | perimeter_of_polygons | +| 0 | Addition | 13+0= | 13 | addition | +| 1 | Subtraction | 95-6= | 89 | subtraction | +| 2 | Multiplication | 66*0= | 0 | multiplication | +| 3 | Division | 15/42= | 0.35714285714285715 | division | +| 4 | Binary Complement 1s | 01= | 10 | binary_complement_1s | +| 5 | Modulo Division | 59%11= | 4 | modulo_division | +| 6 | Square Root | sqrt(81)= | 9 | square_root | +| 7 | Power Rule Differentiation | 8x^2 + 3x^3 + 1x^9 | 16x^1 + 9x^2 + 9x^8 | power_rule_differentiation | +| 8 | Square | 3^2= | 9 | square | +| 9 | LCM (Least Common Multiple) | LCM of 8 and 4 = | 8 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 12 and 12 = | 12 | gcd | +| 11 | Basic Algebra | 8x + 10 = 10 | 0 | basic_algebra | +| 12 | Logarithm | log2(128) | 7 | log | +| 13 | Easy Division | 230/10 = | 23 | int_division | +| 14 | Decimal to Binary | Binary of 93= | 1011101 | decimal_to_binary | +| 15 | Binary to Decimal | 10001 | 17 | binary_to_decimal | +| 16 | Fraction Division | (4/3)/(4/8) | 8/3 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[6, 2], [0, 8]] = | [[66,22],[0,88]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 10 17 7 = | 0.0 | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 13, 40 and 7 exist? | No | valid_triangle | +| 20 | Midpoint of the two point | (-16,-17),(7,11)= | (-4.5,-3.0) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2-3x-18 | (x-6)(x+3) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 49 and 13 = | 118 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | 3x + y = 18, 4x + 10y = 102 | x = 3, y = 9 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (-15, -13) and (-5, -10) | sqrt(109) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 14 and 13 = | 19.10 | pythagorean_theorem | +| 26 | Linear Equations | -9x + -17y = 417, -1x + -4y = 78 | x = -18, y = -15 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 196 | [2, 2, 7, 7] | prime_factors | +| 28 | Fraction Multiplication | (8/1)*(9/6) | 12 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 8 sides | 135.0 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 12 objects picked 2 at a time | 66 | combinations | +| 31 | Factorial | 4! = | 24 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 14m is | 1176 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 16m, 4m, 12m is | 608 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 8m and radius = 13m is | 1715 m^2 | surface_area_cylinder | +| 35 | Volum of Cube | Volume of cube with side = 14m is | 2744 m^3 | volume_cube | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 5m, 19m, 11m is | 1045 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 26m and radius = 12m is | 11762 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 13m and radius = 8m is | 584 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 45m and radius = 12m is | 6785 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 53 and 11 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -9/6x + 2 and y = 5/4x - 6 | (32/11, -26/11) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 12 objects picked 5 at a time = | 95040 | permutation | +| 43 | Cross Product of 2 Vectors | [-19, 13, 14] X [7, 17, -11] = | [-381, -111, -414] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 7/8 and 3/4? | > | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 4874 dollars, 10% rate of interest and for a time period of 1 years is = | 487.4 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
74-54
0-8-1-5
and
-10-6
-3-6
18
0-1
|
-87-110
2345
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 190 upto 2 decimal places is: | 5.75 | cube_root | +| 48 | Power Rule Integration | 3x^2 + 7x^7 + 1x^6 + 9x^1 | (3/2)x^3 + (7/7)x^8 + (1/6)x^7 + (9/1)x^2 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 126 , 81, 61 = | 92 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 6x^2+139x+34=0 | [-0.25, -22.92] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 19 and 12 = | 1 | hcf | +| 52 | Probability of a certain sum appearing on faces of dice | If 2 dice are rolled at the same time, the probability of getting a sum of 5 = | 4/36 | dice_sum_probability | +| 53 | Exponentiation | 15^7 = | 170859375 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [204, 279, 272, 203, 275, 286, 253, 237, 271, 222, 297, 265, 242, 239, 259, 241, 261, 254, 217, 219, 298, 273, 238, 209, 268] with 80% confidence is | (258.3266706388717, 244.23332936112834) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 95^(1/7) _ 67^(1/6) | < | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 18 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597] | fibonacci_series | +| 57 | Trigonometric Values | What is cos(45)? | 1/√2 | basic_trigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 7 sides = | 900 | sum_of_polygon_angles | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[41, 44, 15, 26, 15, 50, 27, 22, 11, 32, 14, 8, 23, 50, 9] | The Mean is 25.8 , Standard Deviation is 199.0933333333333, Variance is 14.110043704160994 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 18m is | 4071.5040790523717 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 88 m = | 2854543.2384361913 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 5th Fibonacci number? | 5 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 190 and SP = 653 is: | 243.68421052631578 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 000 | 0x0 | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (1+11j) * (14-20j) = | (234+134j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [2, 14, 98, 686, 4802, 33614] ,Find the value of a,common ratio,11th term value, sum upto 10th term | The value of a is 2, common ratio is 7 , 11th term is 564950498 , sum upto 10th term is 94158416.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 5 , 36 , 46 , 11 = | (5*36*46*11)^(1/4) = 17.372237396461717 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 2 , 69 , 40 , 85 = | 4/((1/2) + (1/69) + (1/40) + (1/85)) = 7.256137637734391 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[964.0224705098824, 282.67364534639074, 10.524202601537414, 361.644358207216, 691.8214421455904, 573.8396623606926, 972.293614400242, 140.0274501909099, 590.7302519633489, 797.8763197329738, 726.1188608418418, 597.5706485157848, 241.28898511522024, 694.0267219296932, 32.85273313007875, 187.58082258543695, 452.179970384704, 964.184342568536, 589.6017896365979, 936.6845704453358] is: | 2778.1660192850186 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [682.87, 786.47, 315.92, 912.87, 542.62, 602.89, 747.77, 437.42, 3.35, 225.43, 63.6, 535.22, 871.05, 33.58] and [625.58, 654.32, 738.64, 670.61, 575.02, 237.12, 220.81, 78.57, 298.55, 427.21, 396.95, 159.78, 574.71, 847.07] is: | 0.69 radians | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers -14 and 27 = | 41 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [13, -5, -16] . [-6, 11, -2] = | -101 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 10 = | 10 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[73, 79, 98], [11, 18, 14], [41, 47, 26]]) is: | Matrix([[95/6388, -319/1597, 329/6388], [-36/1597, 265/1597, -7/1597], [221/12776, 24/1597, -445/12776]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 7 and angle, 271. Find the area of the sector. | Area of sector = 115.88114 | sector_area | +| 76 | Mean and Median | Given the series of numbers [17, 84, 55, 4, 28, 41, 50, 54, 35, 14]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 38.2 and Arithmetic median of this series is 38.0 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[0, 38], [92, 69]]) = | -3496 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 6315 dollars, 4% rate of interest and for a time period of 8 year is = | 8642.51 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 222= | 0xde | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 16% of 10? | Required percentage = 1.60% | percentage | +| 81 | Celsius To Fahrenheit | Convert -30 degrees Celsius to degrees Fahrenheit = | -22.0 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 23 of the AP series: -14, 86, 186 ... | 2186 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 70 terms of the AP series: 55, -34, -123 ... | -211085.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 2801 in Octal is: | 0o5361 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 1366 in Roman Numerals is: | MCCCLXVI | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 213 in radians is = | 3.72 | degree_to_rad | +| 87 | Radians to Degrees | Angle 0 in degrees is = | 0.0 | radian_to_deg | +| 88 | Differentiation | differentiate w.r.t x : d(ln(x)+5*x^3)/dx | 15*x^2 + 1/x | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 18x^2 + 37x + 1 is = | 25.5 | definite_integral | +| 90 | isprime | 53 | True | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5202 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 10.3exp(i0.51) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 2, 6, 7, 9, 10} ,b={9, 3, 5, 6}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 5, 6, 7, 9, 10},Intersection is {9, 6}, a-b is {1, 2, 10, 7},b-a is {3, 5}, Symmetric difference is {1, 2, 3, 5, 7, 10} | set_operation | +| 94 | Base Conversion | Convert 137673 from base 8 to base 10. | 49083 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 20 and height, 96? | CSA of cylinder = 12063.72 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 10 sided polygon with lengths of [106, 31, 107, 44, 44, 81, 108, 92, 75, 103]cm is: | 791 | perimeter_of_polygons | diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index f3c60bc..2a48ab3 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -101,3 +101,4 @@ from .set_operation import * from .base_conversion import * from .curved_surface_area_cylinder import * from .perimeter_of_polygons import * +from .power_of_powers import * diff --git a/mathgenerator/funcs/power_of_powers.py b/mathgenerator/funcs/power_of_powers.py index 0f4d90b..5892a57 100644 --- a/mathgenerator/funcs/power_of_powers.py +++ b/mathgenerator/funcs/power_of_powers.py @@ -1,5 +1,4 @@ from .__init__ import * -from ..__init__ import Generator def powerOfPowersFunc(maxBase=50, maxPower=10): @@ -17,5 +16,5 @@ def powerOfPowersFunc(maxBase=50, maxPower=10): return problem, solution -power_of_powers = Generator("Power of Powers", 82, +power_of_powers = Generator("Power of Powers", 97, "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) diff --git a/test.py b/test.py index f6339f9..7af7f16 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(96)) +print(mathgen.genById(97)) From ab00d7eb017a661dffea1d062985aa38f3c20ed7 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 21:41:57 -0400 Subject: [PATCH 20/26] quotient of power fixes --- mathgenerator/funcs/__init__.py | 2 ++ mathgenerator/funcs/quotient_of_power_same_base.py | 5 ++--- mathgenerator/funcs/quotient_of_power_same_power.py | 5 ++--- test.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 2a48ab3..7267a14 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -102,3 +102,5 @@ from .base_conversion import * from .curved_surface_area_cylinder import * from .perimeter_of_polygons import * from .power_of_powers import * +from .quotient_of_power_same_base import * +from .quotient_of_power_same_power import * diff --git a/mathgenerator/funcs/quotient_of_power_same_base.py b/mathgenerator/funcs/quotient_of_power_same_base.py index 4b74a7f..79449d2 100644 --- a/mathgenerator/funcs/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -1,5 +1,4 @@ from .__init__ import * -from ..__init__ import Generator def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): @@ -17,5 +16,5 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): return problem, solution -quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc()) +quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 98, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc) diff --git a/mathgenerator/funcs/quotient_of_power_same_power.py b/mathgenerator/funcs/quotient_of_power_same_power.py index d1383da..0c647db 100644 --- a/mathgenerator/funcs/quotient_of_power_same_power.py +++ b/mathgenerator/funcs/quotient_of_power_same_power.py @@ -1,5 +1,4 @@ from .__init__ import * -from ..__init__ import Generator def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): @@ -17,5 +16,5 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): return problem, solution -quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 83, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc()) +quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 99, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc) diff --git a/test.py b/test.py index 7af7f16..f331968 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(97)) +print(mathgen.genById(99)) From 7eb2f4bdf718c0aa6f562e6197eb0c78c7189702 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 21:44:28 -0400 Subject: [PATCH 21/26] complex quadratic id fix --- mathgenerator/funcs/complex_quadratic.py | 2 +- test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/complex_quadratic.py b/mathgenerator/funcs/complex_quadratic.py index 9042c92..c58f915 100644 --- a/mathgenerator/funcs/complex_quadratic.py +++ b/mathgenerator/funcs/complex_quadratic.py @@ -69,5 +69,5 @@ def complexQuadraticFunc(prob_type=0, max_range=10): return problem, solution -complex_quadratic = Generator("complex Quadratic Equation", 91, "Find the roots of given Quadratic Equation ", +complex_quadratic = Generator("complex Quadratic Equation", 100, "Find the roots of given Quadratic Equation ", "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc) diff --git a/test.py b/test.py index f331968..8f1bf49 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(99)) +print(mathgen.genById(100)) From 7a510c1f53b9176b5c44fa4271e24d8d00fe5ae8 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 22:49:08 -0400 Subject: [PATCH 22/26] yapf update --- mathgenerator/funcs/angle_btw_vectors.py | 5 ++++- mathgenerator/funcs/complex_quadratic.py | 15 +++++++++------ mathgenerator/funcs/decimal_to_roman_numerals.py | 3 ++- mathgenerator/funcs/nth_fibonacci_number.py | 3 ++- mathgenerator/funcs/perimeter_of_polygons.py | 4 +++- mathgenerator/funcs/power_of_powers.py | 6 +++--- .../funcs/quotient_of_power_same_base.py | 7 ++++--- .../funcs/quotient_of_power_same_power.py | 7 ++++--- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/mathgenerator/funcs/angle_btw_vectors.py b/mathgenerator/funcs/angle_btw_vectors.py index cc9923c..054c44b 100644 --- a/mathgenerator/funcs/angle_btw_vectors.py +++ b/mathgenerator/funcs/angle_btw_vectors.py @@ -4,7 +4,10 @@ import math def angleBtwVectorsFunc(maxEltAmt=20): s = 0 - v1 = [round(random.uniform(0, 1000), 2) for i in range(random.randint(2, maxEltAmt))] + v1 = [ + round(random.uniform(0, 1000), 2) + for i in range(random.randint(2, maxEltAmt)) + ] v2 = [round(random.uniform(0, 1000), 2) for i in v1] for i in range(len(v1)): s += v1[i] * v2[i] diff --git a/mathgenerator/funcs/complex_quadratic.py b/mathgenerator/funcs/complex_quadratic.py index c58f915..b2d1292 100644 --- a/mathgenerator/funcs/complex_quadratic.py +++ b/mathgenerator/funcs/complex_quadratic.py @@ -14,7 +14,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10): b = random.randrange(1, max_range) c = random.randrange(1, max_range) - d = (b**2 - 4*a*c) + d = (b**2 - 4 * a * c) else: d = 0 while d >= 0: @@ -22,7 +22,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10): b = random.randrange(1, max_range) c = random.randrange(1, max_range) - d = (b**2 - 4*a*c) + d = (b**2 - 4 * a * c) eq = '' @@ -53,8 +53,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10): return problem, solution else: - s_root1 = round((-b + (d)**0.5)/(2*a), 3) - s_root2 = round((-b - (d)**0.5)/(2*a), 3) + s_root1 = round((-b + (d)**0.5) / (2 * a), 3) + s_root2 = round((-b - (d)**0.5) / (2 * a), 3) sqrt_d = (d)**0.5 @@ -69,5 +69,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10): return problem, solution -complex_quadratic = Generator("complex Quadratic Equation", 100, "Find the roots of given Quadratic Equation ", - "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc) +complex_quadratic = Generator( + "complex Quadratic Equation", 100, + "Find the roots of given Quadratic Equation ", + "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", + complexQuadraticFunc) diff --git a/mathgenerator/funcs/decimal_to_roman_numerals.py b/mathgenerator/funcs/decimal_to_roman_numerals.py index c2470dc..ee66ff6 100644 --- a/mathgenerator/funcs/decimal_to_roman_numerals.py +++ b/mathgenerator/funcs/decimal_to_roman_numerals.py @@ -25,7 +25,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000): elif last_value == 4: solution += (roman_dict[divisor] + roman_dict[divisor * 5]) elif 5 <= last_value <= 8: - solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5))) + solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * + (last_value - 5))) elif last_value == 9: solution += (roman_dict[divisor] + roman_dict[divisor * 10]) x = math.floor(x % divisor) diff --git a/mathgenerator/funcs/nth_fibonacci_number.py b/mathgenerator/funcs/nth_fibonacci_number.py index cfb7e8a..3d28655 100644 --- a/mathgenerator/funcs/nth_fibonacci_number.py +++ b/mathgenerator/funcs/nth_fibonacci_number.py @@ -5,7 +5,8 @@ def nthFibonacciNumberFunc(maxN=100): golden_ratio = (1 + math.sqrt(5)) / 2 n = random.randint(1, maxN) problem = f"What is the {n}th Fibonacci number?" - ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5))) + ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / + (math.sqrt(5))) solution = f"{ans}" return problem, solution diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index e15402d..5b61688 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -15,4 +15,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120): perimeter_of_polygons = Generator( - "Perimeter of Polygons", 96, "The perimeter of a x sided polygon with lengths of y cm is: ", "z", perimeterOfPolygons) + "Perimeter of Polygons", 96, + "The perimeter of a x sided polygon with lengths of y cm is: ", "z", + perimeterOfPolygons) diff --git a/mathgenerator/funcs/power_of_powers.py b/mathgenerator/funcs/power_of_powers.py index 5892a57..9381327 100644 --- a/mathgenerator/funcs/power_of_powers.py +++ b/mathgenerator/funcs/power_of_powers.py @@ -12,9 +12,9 @@ def powerOfPowersFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base ** step) + solution = str(base**step) return problem, solution -power_of_powers = Generator("Power of Powers", 97, - "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) +power_of_powers = Generator("Power of Powers", 97, "6^4^2 = 6^(4*2) = 6^6", + "46656", powerOfPowersFunc) diff --git a/mathgenerator/funcs/quotient_of_power_same_base.py b/mathgenerator/funcs/quotient_of_power_same_base.py index 79449d2..cf38296 100644 --- a/mathgenerator/funcs/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -12,9 +12,10 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base ** step) + solution = str(base**step) return problem, solution -quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 98, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc) +quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", + 98, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", + quotientOfPowerSameBaseFunc) diff --git a/mathgenerator/funcs/quotient_of_power_same_power.py b/mathgenerator/funcs/quotient_of_power_same_power.py index 0c647db..1c668a8 100644 --- a/mathgenerator/funcs/quotient_of_power_same_power.py +++ b/mathgenerator/funcs/quotient_of_power_same_power.py @@ -12,9 +12,10 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): base2=base2, power=power, step=step) - solution = str(step ** power) + solution = str(step**power) return problem, solution -quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 99, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc) +quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", + 99, "6^4 / 3^4 = (6/3)^4 = 2^4", "16", + quotientOfPowerSamePowerFunc) From c5d492bb71dddd22088a938eff780da5a1192b04 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 22:51:36 -0400 Subject: [PATCH 23/26] linter fix --- mathgenerator/funcs/complex_quadratic.py | 3 +-- mathgenerator/funcs/decimal_to_roman_numerals.py | 3 +-- mathgenerator/funcs/nth_fibonacci_number.py | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/mathgenerator/funcs/complex_quadratic.py b/mathgenerator/funcs/complex_quadratic.py index b2d1292..7cbf0b0 100644 --- a/mathgenerator/funcs/complex_quadratic.py +++ b/mathgenerator/funcs/complex_quadratic.py @@ -38,10 +38,9 @@ def complexQuadraticFunc(prob_type=0, max_range=10): eq += str(c) + ' = 0' - problem = f'Find the roots of given Quadratic Equation ' + eq + problem = 'Find the roots of given Quadratic Equation ' + eq if d < 0: - roots = '' sqrt_d = (-d)**0.5 if sqrt_d - int(sqrt_d) == 0: diff --git a/mathgenerator/funcs/decimal_to_roman_numerals.py b/mathgenerator/funcs/decimal_to_roman_numerals.py index ee66ff6..c2470dc 100644 --- a/mathgenerator/funcs/decimal_to_roman_numerals.py +++ b/mathgenerator/funcs/decimal_to_roman_numerals.py @@ -25,8 +25,7 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000): elif last_value == 4: solution += (roman_dict[divisor] + roman_dict[divisor * 5]) elif 5 <= last_value <= 8: - solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * - (last_value - 5))) + solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5))) elif last_value == 9: solution += (roman_dict[divisor] + roman_dict[divisor * 10]) x = math.floor(x % divisor) diff --git a/mathgenerator/funcs/nth_fibonacci_number.py b/mathgenerator/funcs/nth_fibonacci_number.py index 3d28655..cfb7e8a 100644 --- a/mathgenerator/funcs/nth_fibonacci_number.py +++ b/mathgenerator/funcs/nth_fibonacci_number.py @@ -5,8 +5,7 @@ def nthFibonacciNumberFunc(maxN=100): golden_ratio = (1 + math.sqrt(5)) / 2 n = random.randint(1, maxN) problem = f"What is the {n}th Fibonacci number?" - ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / - (math.sqrt(5))) + ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5))) solution = f"{ans}" return problem, solution From ab2008bc2a64f3d12e705ed3ff2c2adc9b557011 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 22:53:05 -0400 Subject: [PATCH 24/26] new readme --- README.md | 194 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 99 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index a8d3aa9..f215bfe 100644 --- a/README.md +++ b/README.md @@ -31,100 +31,104 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 13+0= | 13 | addition | -| 1 | Subtraction | 95-6= | 89 | subtraction | -| 2 | Multiplication | 66*0= | 0 | multiplication | -| 3 | Division | 15/42= | 0.35714285714285715 | division | -| 4 | Binary Complement 1s | 01= | 10 | binary_complement_1s | -| 5 | Modulo Division | 59%11= | 4 | modulo_division | -| 6 | Square Root | sqrt(81)= | 9 | square_root | -| 7 | Power Rule Differentiation | 8x^2 + 3x^3 + 1x^9 | 16x^1 + 9x^2 + 9x^8 | power_rule_differentiation | -| 8 | Square | 3^2= | 9 | square | -| 9 | LCM (Least Common Multiple) | LCM of 8 and 4 = | 8 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 12 and 12 = | 12 | gcd | -| 11 | Basic Algebra | 8x + 10 = 10 | 0 | basic_algebra | -| 12 | Logarithm | log2(128) | 7 | log | -| 13 | Easy Division | 230/10 = | 23 | int_division | -| 14 | Decimal to Binary | Binary of 93= | 1011101 | decimal_to_binary | -| 15 | Binary to Decimal | 10001 | 17 | binary_to_decimal | -| 16 | Fraction Division | (4/3)/(4/8) | 8/3 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[6, 2], [0, 8]] = | [[66,22],[0,88]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 10 17 7 = | 0.0 | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 13, 40 and 7 exist? | No | valid_triangle | -| 20 | Midpoint of the two point | (-16,-17),(7,11)= | (-4.5,-3.0) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-3x-18 | (x-6)(x+3) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 49 and 13 = | 118 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | 3x + y = 18, 4x + 10y = 102 | x = 3, y = 9 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (-15, -13) and (-5, -10) | sqrt(109) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 14 and 13 = | 19.10 | pythagorean_theorem | -| 26 | Linear Equations | -9x + -17y = 417, -1x + -4y = 78 | x = -18, y = -15 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 196 | [2, 2, 7, 7] | prime_factors | -| 28 | Fraction Multiplication | (8/1)*(9/6) | 12 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 8 sides | 135.0 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 12 objects picked 2 at a time | 66 | combinations | -| 31 | Factorial | 4! = | 24 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 14m is | 1176 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 16m, 4m, 12m is | 608 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 8m and radius = 13m is | 1715 m^2 | surface_area_cylinder | +| 0 | Addition | 20+38= | 58 | addition | +| 1 | Subtraction | 2-0= | 2 | subtraction | +| 2 | Multiplication | 31*1= | 31 | multiplication | +| 3 | Division | 53/7= | 7.571428571428571 | division | +| 4 | Binary Complement 1s | 111= | 000 | binary_complement_1s | +| 5 | Modulo Division | 90%6= | 0 | modulo_division | +| 6 | Square Root | sqrt(16)= | 4 | square_root | +| 7 | Power Rule Differentiation | 7x^5 + 8x^10 + 4x^1 + 4x^5 + 7x^3 | 35x^4 + 80x^9 + 4x^0 + 20x^4 + 21x^2 | power_rule_differentiation | +| 8 | Square | 9^2= | 81 | square | +| 9 | LCM (Least Common Multiple) | LCM of 20 and 5 = | 20 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 11 and 2 = | 1 | gcd | +| 11 | Basic Algebra | 10x + 4 = 8 | 2/5 | basic_algebra | +| 12 | Logarithm | log3(2187) | 7 | log | +| 13 | Easy Division | 247/19 = | 13 | int_division | +| 14 | Decimal to Binary | Binary of 13= | 1101 | decimal_to_binary | +| 15 | Binary to Decimal | 001 | 1 | binary_to_decimal | +| 16 | Fraction Division | (6/9)/(4/2) | 1/3 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[5, 2], [0, 8]] = | [[55,22],[0,88]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 10 2 11 = | 9.051933495115836 | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 35, 7 and 11 exist? | No | valid_triangle | +| 20 | Midpoint of the two point | (12,-4),(-4,9)= | (4.0,2.5) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2-3x-28 | (x-7)(x+4) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 50 and 19 = | 111 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | -6x - 4y = -2, x + 10y = 47 | x = -3, y = 5 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (16, 20) and (-9, 14) | sqrt(661) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 7 and 3 = | 7.62 | pythagorean_theorem | +| 26 | Linear Equations | 14x + -10y = -26, 15x + -11y = -29 | x = 1, y = 4 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 29 | [29] | prime_factors | +| 28 | Fraction Multiplication | (3/7)*(10/3) | 10/7 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 18 sides | 160.0 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 12 objects picked 5 at a time | 792 | combinations | +| 31 | Factorial | 2! = | 2 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 9m is | 486 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 19m, 9m, 6m is | 678 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 39m and radius = 6m is | 1696 m^2 | surface_area_cylinder | | 35 | Volum of Cube | Volume of cube with side = 14m is | 2744 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 5m, 19m, 11m is | 1045 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 26m and radius = 12m is | 11762 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 13m and radius = 8m is | 584 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 45m and radius = 12m is | 6785 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 53 and 11 = | [1] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -9/6x + 2 and y = 5/4x - 6 | (32/11, -26/11) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 12 objects picked 5 at a time = | 95040 | permutation | -| 43 | Cross Product of 2 Vectors | [-19, 13, 14] X [7, 17, -11] = | [-381, -111, -414] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 7/8 and 3/4? | > | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 4874 dollars, 10% rate of interest and for a time period of 1 years is = | 487.4 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
74-54
0-8-1-5
and
-10-6
-3-6
18
0-1
|
-87-110
2345
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 190 upto 2 decimal places is: | 5.75 | cube_root | -| 48 | Power Rule Integration | 3x^2 + 7x^7 + 1x^6 + 9x^1 | (3/2)x^3 + (7/7)x^8 + (1/6)x^7 + (9/1)x^2 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 126 , 81, 61 = | 92 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 6x^2+139x+34=0 | [-0.25, -22.92] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 19 and 12 = | 1 | hcf | -| 52 | Probability of a certain sum appearing on faces of dice | If 2 dice are rolled at the same time, the probability of getting a sum of 5 = | 4/36 | dice_sum_probability | -| 53 | Exponentiation | 15^7 = | 170859375 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [204, 279, 272, 203, 275, 286, 253, 237, 271, 222, 297, 265, 242, 239, 259, 241, 261, 254, 217, 219, 298, 273, 238, 209, 268] with 80% confidence is | (258.3266706388717, 244.23332936112834) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 95^(1/7) _ 67^(1/6) | < | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 18 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597] | fibonacci_series | -| 57 | Trigonometric Values | What is cos(45)? | 1/√2 | basic_trigonometry | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 4m, 19m, 20m is | 1520 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 27m and radius = 4m is | 1357 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 15m is | 3031 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 46m and radius = 1m is | 48 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 5 and 89 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -10x - 3 and y = -10/5x - 4 | (1/8, -17/4) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 17 objects picked 6 at a time = | 8910720 | permutation | +| 43 | Cross Product of 2 Vectors | [14, -7, -18] X [3, -16, 12] = | [-372, -222, -203] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 6/7 and 2/1? | < | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 1752 dollars, 10% rate of interest and for a time period of 5 years is = | 876.0 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
-27-10
0-4-9
21010
and
6-6
-53
610
|
-107-67
-34-102
22118
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 212 upto 2 decimal places is: | 5.96 | cube_root | +| 48 | Power Rule Integration | 4x^4 | (4/4)x^5 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 81 , 131, 8 = | 140 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 66x^2+177x+45=0 | [-0.28, -2.4] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 8 and 10 = | 2 | hcf | +| 52 | Probability of a certain sum appearing on faces of dice | If 2 dice are rolled at the same time, the probability of getting a sum of 7 = | 6/36 | dice_sum_probability | +| 53 | Exponentiation | 16^3 = | 4096 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [240, 211, 206, 296, 223, 220, 264, 251, 245, 248, 207, 215, 277, 274, 297, 243, 278, 292, 256, 233, 266, 236, 270, 227, 209, 258, 298] with 99% confidence is | (263.9293815733304, 235.32987768592884) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 63^(1/2) _ 37^(1/4) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 12 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | fibonacci_series | +| 57 | Trigonometric Values | What is sin(0)? | 0 | basic_trigonometry | | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 7 sides = | 900 | sum_of_polygon_angles | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[41, 44, 15, 26, 15, 50, 27, 22, 11, 32, 14, 8, 23, 50, 9] | The Mean is 25.8 , Standard Deviation is 199.0933333333333, Variance is 14.110043704160994 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 18m is | 4071.5040790523717 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 88 m = | 2854543.2384361913 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 5th Fibonacci number? | 5 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 190 and SP = 653 is: | 243.68421052631578 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 000 | 0x0 | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (1+11j) * (14-20j) = | (234+134j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [2, 14, 98, 686, 4802, 33614] ,Find the value of a,common ratio,11th term value, sum upto 10th term | The value of a is 2, common ratio is 7 , 11th term is 564950498 , sum upto 10th term is 94158416.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 5 , 36 , 46 , 11 = | (5*36*46*11)^(1/4) = 17.372237396461717 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 2 , 69 , 40 , 85 = | 4/((1/2) + (1/69) + (1/40) + (1/85)) = 7.256137637734391 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[964.0224705098824, 282.67364534639074, 10.524202601537414, 361.644358207216, 691.8214421455904, 573.8396623606926, 972.293614400242, 140.0274501909099, 590.7302519633489, 797.8763197329738, 726.1188608418418, 597.5706485157848, 241.28898511522024, 694.0267219296932, 32.85273313007875, 187.58082258543695, 452.179970384704, 964.184342568536, 589.6017896365979, 936.6845704453358] is: | 2778.1660192850186 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [682.87, 786.47, 315.92, 912.87, 542.62, 602.89, 747.77, 437.42, 3.35, 225.43, 63.6, 535.22, 871.05, 33.58] and [625.58, 654.32, 738.64, 670.61, 575.02, 237.12, 220.81, 78.57, 298.55, 427.21, 396.95, 159.78, 574.71, 847.07] is: | 0.69 radians | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers -14 and 27 = | 41 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [13, -5, -16] . [-6, 11, -2] = | -101 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 10 = | 10 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[73, 79, 98], [11, 18, 14], [41, 47, 26]]) is: | Matrix([[95/6388, -319/1597, 329/6388], [-36/1597, 265/1597, -7/1597], [221/12776, 24/1597, -445/12776]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 7 and angle, 271. Find the area of the sector. | Area of sector = 115.88114 | sector_area | -| 76 | Mean and Median | Given the series of numbers [17, 84, 55, 4, 28, 41, 50, 54, 35, 14]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 38.2 and Arithmetic median of this series is 38.0 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[0, 38], [92, 69]]) = | -3496 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 6315 dollars, 4% rate of interest and for a time period of 8 year is = | 8642.51 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 222= | 0xde | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 16% of 10? | Required percentage = 1.60% | percentage | -| 81 | Celsius To Fahrenheit | Convert -30 degrees Celsius to degrees Fahrenheit = | -22.0 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 23 of the AP series: -14, 86, 186 ... | 2186 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 70 terms of the AP series: 55, -34, -123 ... | -211085.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 2801 in Octal is: | 0o5361 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 1366 in Roman Numerals is: | MCCCLXVI | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 213 in radians is = | 3.72 | degree_to_rad | -| 87 | Radians to Degrees | Angle 0 in degrees is = | 0.0 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(ln(x)+5*x^3)/dx | 15*x^2 + 1/x | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 18x^2 + 37x + 1 is = | 25.5 | definite_integral | -| 90 | isprime | 53 | True | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5202 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 10.3exp(i0.51) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 2, 6, 7, 9, 10} ,b={9, 3, 5, 6}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 5, 6, 7, 9, 10},Intersection is {9, 6}, a-b is {1, 2, 10, 7},b-a is {3, 5}, Symmetric difference is {1, 2, 3, 5, 7, 10} | set_operation | -| 94 | Base Conversion | Convert 137673 from base 8 to base 10. | 49083 | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 20 and height, 96? | CSA of cylinder = 12063.72 | curved_surface_area_cylinder | -| 96 | Perimeter of Polygons | The perimeter of a 10 sided polygon with lengths of [106, 31, 107, 44, 44, 81, 108, 92, 75, 103]cm is: | 791 | perimeter_of_polygons | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[30, 21, 26, 36, 34, 7, 46, 21, 15, 29, 9, 33, 16, 28, 43] | The Mean is 26.266666666666666 , Standard Deviation is 123.39555555555556, Variance is 11.108355213781902 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 6m is | 452.3893421169302 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 10 m = | 4188.790204786391 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 41th Fibonacci number? | 165580141 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 411 and SP = 499 is: | 21.41119221411192 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 00010 | 0x2 | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (-2-6j) * (-10+2j) = | (32+56j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [7, 77, 847, 9317, 102487, 1127357] ,Find the value of a,common ratio,8th term value, sum upto 7th term | The value of a is 7, common ratio is 11 , 8th term is 136410197 , sum upto 7th term is 13641019.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 76 , 98 , 2 , 58 = | (76*98*2*58)^(1/4) = 30.487682589384825 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 3 numbers 77 , 98 and 69 = | 3/((1/77) + (1/98) + (1/69)) = 79.60970388869067 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[229.4364953887822, 570.6032154600009, 199.52328312454694, 658.3975413255898, 605.9566521345233, 616.6627240713517, 572.9546490919761, 508.8683987353998, 666.172347641998, 865.2735159823208, 594.8620516188639, 418.8436115273115, 69.46437421671337, 385.84806581739593] is: | 2015.3622923166513 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [954.08, 488.66, 694.46, 127.67, 912.65, 462.11, 713.4, 179.41, 728.87, 811.04, 760.22, 688.68, 444.93, 237.29, 485.89, 565.71, 520.56, 44.1, 684.62, 665.12] and [736.88, 60.8, 240.61, 677.58, 887.06, 73.3, 470.5, 884.06, 453.97, 168.97, 921.73, 538.36, 967.82, 236.94, 51.62, 402.46, 57.88, 166.91, 676.47, 708.47] is: | 0.63 radians | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers -87 and 69 = | 156 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [14, -1, 7] . [-12, 15, -9] = | -246 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 11010 = | 110 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[17, 31, 76], [3, 65, 91], [42, 2, 28]]) is: | Matrix([[-273/10550, 179/15825, 2119/63300], [-623/10550, 679/15825, 1319/63300], [227/5275, -317/15825, -253/15825]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 4 and angle, 2. Find the area of the sector. | Area of sector = 0.27925 | sector_area | +| 76 | Mean and Median | Given the series of numbers [87, 97, 75, 27, 91, 31, 15, 40, 73, 74]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 61.0 and Arithmetic median of this series is 73.5 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[83, 41], [15, 13]]) = | 464 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 2702 dollars, 7% rate of interest and for a time period of 2 year is = | 3093.52 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 386= | 0x182 | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 64% of 8? | Required percentage = 5.12% | percentage | +| 81 | Celsius To Fahrenheit | Convert 50 degrees Celsius to degrees Fahrenheit = | 122.0 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 89 of the AP series: -35, -98, -161 ... | -5579 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 63 terms of the AP series: 7, 100, 193 ... | 182070.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 265 in Octal is: | 0o411 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 1439 in Roman Numerals is: | MCDXXXIX | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 68 in radians is = | 1.19 | degree_to_rad | +| 87 | Radians to Degrees | Angle 3 in degrees is = | 171.89 | radian_to_deg | +| 88 | Differentiation | differentiate w.r.t x : d(ln(x)+2*x^3)/dx | 6*x^2 + 1/x | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 74x^2 + 55x + 86 is = | 138.1667 | definite_integral | +| 90 | isprime | 32 | False | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5461 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 27.59exp(i-2.38) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 2, 3, 5, 6, 8} ,b={1, 10, 2, 9}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 5, 6, 8, 9, 10},Intersection is {1, 2}, a-b is {8, 3, 5, 6},b-a is {9, 10}, Symmetric difference is {3, 5, 6, 8, 9, 10} | set_operation | +| 94 | Base Conversion | Convert 131222 from base 6 to base 2. | 10111010111110 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 27 and height, 94? | CSA of cylinder = 15946.72 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [48, 30, 110, 95, 10, 33, 87, 70, 78]cm is: | 561 | perimeter_of_polygons | +| 97 | Power of Powers | The 24^1^3 = 24^(1*3) = 24^3 | 13824 | power_of_powers | +| 98 | Quotient of Powers with Same Base | The Quotient of 41^2 and 41^3 = 41^(2-3) = 41^-1 | 0.024390243902439025 | quotient_of_power_same_base | +| 99 | Quotient of Powers with Same Power | The Quotient of 30^5 and 35^5 = (30/35)^5 = 0.8571428571428571^5 | 0.46266436603796024 | quotient_of_power_same_power | +| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 5x^2 + 8x + 2 = 0 | simplified solution : ((-0.31, -1.29)), generalized solution : ((-8 + sqrt(24))/2*5, (-8 - sqrt(24))/2*5) | complex_quadratic | From 7e4c1c5dfa06dfc720e5000ebd7b03d4d963faa7 Mon Sep 17 00:00:00 2001 From: Yogesh Patil Date: Thu, 22 Oct 2020 09:52:32 +0530 Subject: [PATCH 25/26] Added is Leap Year Function File --- mathgenerator/funcs/is_leap_year.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mathgenerator/funcs/is_leap_year.py diff --git a/mathgenerator/funcs/is_leap_year.py b/mathgenerator/funcs/is_leap_year.py new file mode 100644 index 0000000..1f79c2b --- /dev/null +++ b/mathgenerator/funcs/is_leap_year.py @@ -0,0 +1,24 @@ +from .__init__ import * + + +def IsLeapYear(minNumber=1900, maxNumber=2099): + year = random.randint(minNumber, maxNumber) + problem = "Year " + str(year) + " " + solution = "" + if (year % 4) == 0: + if (year % 100) == 0: + if (year % 400) == 0: + solution = "is a leap year" + else: + solution = "is not a leap year" + else: + solution = "is a leap year" + else: + solution = "is not a leap year" + + return problem, solution + +is_leap_year = Generator("Leap Year or Not", 102, + "Year y ", "is/not a leap year", + IsLeapYear) +##for readme ## | 102 | Leap Year or Not | Year 1964 | is a leap year | is_leap_year | From 72e88ac2d923a10dc7cdb24819b1530f20ed5b71 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Fri, 23 Oct 2020 13:33:37 -0400 Subject: [PATCH 26/26] leap year fixes --- README.md | 196 ++++++++++++++-------------- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/is_leap_year.py | 11 +- test.py | 3 +- 4 files changed, 107 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index f215bfe..4fe1e18 100644 --- a/README.md +++ b/README.md @@ -31,104 +31,104 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 20+38= | 58 | addition | -| 1 | Subtraction | 2-0= | 2 | subtraction | -| 2 | Multiplication | 31*1= | 31 | multiplication | -| 3 | Division | 53/7= | 7.571428571428571 | division | -| 4 | Binary Complement 1s | 111= | 000 | binary_complement_1s | -| 5 | Modulo Division | 90%6= | 0 | modulo_division | +| 0 | Addition | 20+9= | 29 | addition | +| 1 | Subtraction | 52-50= | 2 | subtraction | +| 2 | Multiplication | 53*1= | 53 | multiplication | +| 3 | Division | 35/79= | 0.4430379746835443 | division | +| 4 | Binary Complement 1s | 011011= | 100100 | binary_complement_1s | +| 5 | Modulo Division | 27%39= | 27 | modulo_division | | 6 | Square Root | sqrt(16)= | 4 | square_root | -| 7 | Power Rule Differentiation | 7x^5 + 8x^10 + 4x^1 + 4x^5 + 7x^3 | 35x^4 + 80x^9 + 4x^0 + 20x^4 + 21x^2 | power_rule_differentiation | -| 8 | Square | 9^2= | 81 | square | -| 9 | LCM (Least Common Multiple) | LCM of 20 and 5 = | 20 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 11 and 2 = | 1 | gcd | -| 11 | Basic Algebra | 10x + 4 = 8 | 2/5 | basic_algebra | -| 12 | Logarithm | log3(2187) | 7 | log | -| 13 | Easy Division | 247/19 = | 13 | int_division | -| 14 | Decimal to Binary | Binary of 13= | 1101 | decimal_to_binary | -| 15 | Binary to Decimal | 001 | 1 | binary_to_decimal | -| 16 | Fraction Division | (6/9)/(4/2) | 1/3 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[5, 2], [0, 8]] = | [[55,22],[0,88]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 10 2 11 = | 9.051933495115836 | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 35, 7 and 11 exist? | No | valid_triangle | -| 20 | Midpoint of the two point | (12,-4),(-4,9)= | (4.0,2.5) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-3x-28 | (x-7)(x+4) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 50 and 19 = | 111 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | -6x - 4y = -2, x + 10y = 47 | x = -3, y = 5 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (16, 20) and (-9, 14) | sqrt(661) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 7 and 3 = | 7.62 | pythagorean_theorem | -| 26 | Linear Equations | 14x + -10y = -26, 15x + -11y = -29 | x = 1, y = 4 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 29 | [29] | prime_factors | -| 28 | Fraction Multiplication | (3/7)*(10/3) | 10/7 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 18 sides | 160.0 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 12 objects picked 5 at a time | 792 | combinations | +| 7 | Power Rule Differentiation | 7x^5 | 35x^4 | power_rule_differentiation | +| 8 | Square | 10^2= | 100 | square | +| 9 | LCM (Least Common Multiple) | LCM of 14 and 14 = | 14 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 17 and 7 = | 1 | gcd | +| 11 | Basic Algebra | 6x + 5 = 5 | 0 | basic_algebra | +| 12 | Logarithm | log2(64) | 6 | log | +| 13 | Easy Division | 252/12 = | 21 | int_division | +| 14 | Decimal to Binary | Binary of 19= | 10011 | decimal_to_binary | +| 15 | Binary to Decimal | 1000010100 | 532 | binary_to_decimal | +| 16 | Fraction Division | (10/9)/(10/8) | 8/9 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 15 * [[5, 3], [3, 2]] = | [[75,45],[45,30]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 3 17 2 = | (4.221036154550547e-15+68.93475175845634j) | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 24, 20 and 17 exist? | Yes | valid_triangle | +| 20 | Midpoint of the two point | (4,-10),(2,4)= | (3.0,-3.0) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2-3x-54 | (x+6)(x-9) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 6 and 29 = | 145 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | - 5y = -20, 3x + 9y = 9 | x = -9, y = 4 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (-2, -4) and (21, -13) | sqrt(610) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 16 and 11 = | 19.42 | pythagorean_theorem | +| 26 | Linear Equations | 11x + 4y = -72, 17x + -18y = -208 | x = -8, y = 4 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 88 | [2, 2, 2, 11] | prime_factors | +| 28 | Fraction Multiplication | (7/3)*(2/10) | 7/15 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 9 sides | 140.0 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 16 objects picked 6 at a time | 8008 | combinations | | 31 | Factorial | 2! = | 2 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 9m is | 486 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 19m, 9m, 6m is | 678 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 39m and radius = 6m is | 1696 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 14m is | 2744 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 4m, 19m, 20m is | 1520 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 27m and radius = 4m is | 1357 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 15m is | 3031 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 46m and radius = 1m is | 48 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 5 and 89 = | [1] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -10x - 3 and y = -10/5x - 4 | (1/8, -17/4) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 17 objects picked 6 at a time = | 8910720 | permutation | -| 43 | Cross Product of 2 Vectors | [14, -7, -18] X [3, -16, 12] = | [-372, -222, -203] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 6/7 and 2/1? | < | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 1752 dollars, 10% rate of interest and for a time period of 5 years is = | 876.0 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
-27-10
0-4-9
21010
and
6-6
-53
610
|
-107-67
-34-102
22118
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 212 upto 2 decimal places is: | 5.96 | cube_root | -| 48 | Power Rule Integration | 4x^4 | (4/4)x^5 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 81 , 131, 8 = | 140 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 66x^2+177x+45=0 | [-0.28, -2.4] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 8 and 10 = | 2 | hcf | -| 52 | Probability of a certain sum appearing on faces of dice | If 2 dice are rolled at the same time, the probability of getting a sum of 7 = | 6/36 | dice_sum_probability | -| 53 | Exponentiation | 16^3 = | 4096 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [240, 211, 206, 296, 223, 220, 264, 251, 245, 248, 207, 215, 277, 274, 297, 243, 278, 292, 256, 233, 266, 236, 270, 227, 209, 258, 298] with 99% confidence is | (263.9293815733304, 235.32987768592884) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 63^(1/2) _ 37^(1/4) | > | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 12 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | fibonacci_series | -| 57 | Trigonometric Values | What is sin(0)? | 0 | basic_trigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 7 sides = | 900 | sum_of_polygon_angles | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[30, 21, 26, 36, 34, 7, 46, 21, 15, 29, 9, 33, 16, 28, 43] | The Mean is 26.266666666666666 , Standard Deviation is 123.39555555555556, Variance is 11.108355213781902 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 6m is | 452.3893421169302 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 10 m = | 4188.790204786391 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 41th Fibonacci number? | 165580141 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 411 and SP = 499 is: | 21.41119221411192 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 00010 | 0x2 | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (-2-6j) * (-10+2j) = | (32+56j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [7, 77, 847, 9317, 102487, 1127357] ,Find the value of a,common ratio,8th term value, sum upto 7th term | The value of a is 7, common ratio is 11 , 8th term is 136410197 , sum upto 7th term is 13641019.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 76 , 98 , 2 , 58 = | (76*98*2*58)^(1/4) = 30.487682589384825 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 3 numbers 77 , 98 and 69 = | 3/((1/77) + (1/98) + (1/69)) = 79.60970388869067 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[229.4364953887822, 570.6032154600009, 199.52328312454694, 658.3975413255898, 605.9566521345233, 616.6627240713517, 572.9546490919761, 508.8683987353998, 666.172347641998, 865.2735159823208, 594.8620516188639, 418.8436115273115, 69.46437421671337, 385.84806581739593] is: | 2015.3622923166513 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [954.08, 488.66, 694.46, 127.67, 912.65, 462.11, 713.4, 179.41, 728.87, 811.04, 760.22, 688.68, 444.93, 237.29, 485.89, 565.71, 520.56, 44.1, 684.62, 665.12] and [736.88, 60.8, 240.61, 677.58, 887.06, 73.3, 470.5, 884.06, 453.97, 168.97, 921.73, 538.36, 967.82, 236.94, 51.62, 402.46, 57.88, 166.91, 676.47, 708.47] is: | 0.63 radians | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers -87 and 69 = | 156 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [14, -1, 7] . [-12, 15, -9] = | -246 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 11010 = | 110 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[17, 31, 76], [3, 65, 91], [42, 2, 28]]) is: | Matrix([[-273/10550, 179/15825, 2119/63300], [-623/10550, 679/15825, 1319/63300], [227/5275, -317/15825, -253/15825]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 4 and angle, 2. Find the area of the sector. | Area of sector = 0.27925 | sector_area | -| 76 | Mean and Median | Given the series of numbers [87, 97, 75, 27, 91, 31, 15, 40, 73, 74]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 61.0 and Arithmetic median of this series is 73.5 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[83, 41], [15, 13]]) = | 464 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 2702 dollars, 7% rate of interest and for a time period of 2 year is = | 3093.52 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 386= | 0x182 | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 64% of 8? | Required percentage = 5.12% | percentage | -| 81 | Celsius To Fahrenheit | Convert 50 degrees Celsius to degrees Fahrenheit = | 122.0 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 89 of the AP series: -35, -98, -161 ... | -5579 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 63 terms of the AP series: 7, 100, 193 ... | 182070.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 265 in Octal is: | 0o411 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 1439 in Roman Numerals is: | MCDXXXIX | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 68 in radians is = | 1.19 | degree_to_rad | +| 32 | Surface Area of Cube | Surface area of cube with side = 3m is | 54 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 9m, 1m, 14m is | 298 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 30m and radius = 3m is | 622 m^2 | surface_area_cylinder | +| 35 | Volum of Cube | Volume of cube with side = 16m is | 4096 m^3 | volume_cube | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 4m, 12m, 11m is | 528 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 32m and radius = 17m is | 29053 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 18m and radius = 16m is | 2014 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 24m and radius = 6m is | 904 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 73 and 75 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -10/4x - 6 and y = -2/5x + 2 | (-80/21, 74/21) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 18 objects picked 5 at a time = | 1028160 | permutation | +| 43 | Cross Product of 2 Vectors | [-19, -17, 16] X [-3, -10, 19] = | [-163, 313, 139] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 10/8 and 4/7? | > | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 8277 dollars, 8% rate of interest and for a time period of 8 years is = | 5297.28 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
5-36
67-2
55-2
and
-64
-5-2
-51
|
-4532
-618
-458
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 725 upto 2 decimal places is: | 8.98 | cube_root | +| 48 | Power Rule Integration | 6x^8 + 10x^3 + 2x^8 + 8x^8 + 6x^9 | (6/8)x^9 + (10/3)x^4 + (2/8)x^9 + (8/8)x^9 + (6/9)x^10 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 34 , 200, 57 = | 69 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 28x^2+105x+65=0 | [-0.78, -2.97] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 14 and 7 = | 7 | hcf | +| 52 | Probability of a certain sum appearing on faces of dice | If 1 dice are rolled at the same time, the probability of getting a sum of 3 = | 1/6 | dice_sum_probability | +| 53 | Exponentiation | 2^2 = | 4 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [271, 209, 205, 219, 291, 221, 226, 217, 230, 272, 276, 293, 237, 252, 283, 253, 266, 240, 234, 207, 279] with 80% confidence is | (254.68568495447266, 238.74288647409878) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 8^(1/2) _ 55^(1/6) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 19 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584] | fibonacci_series | +| 57 | Trigonometric Values | What is cos(45)? | 1/√2 | basic_trigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 6 sides = | 720 | sum_of_polygon_angles | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[25, 45, 11, 49, 43, 21, 18, 22, 46, 41, 48, 45, 47, 46, 22] | The Mean is 35.266666666666666 , Standard Deviation is 169.9288888888889, Variance is 13.035677538543553 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 20m is | 5026.548245743669 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 6 m = | 904.7786842338604 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 98th Fibonacci number? | 135301852344707186688 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 88 and SP = 155 is: | 76.13636363636364 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 0111100 | 0x3c | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (6+15j) * (-11+14j) = | (-276-81j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [4, 8, 16, 32, 64, 128] ,Find the value of a,common ratio,10th term value, sum upto 7th term | The value of a is 4, common ratio is 2 , 10th term is 2048 , sum upto 7th term is 508.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 15 and 89 = | (15*89)^(1/2) = 36.53765181289022 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 57 , 38 , 60 , 25 = | 4/((1/57) + (1/38) + (1/60) + (1/25)) = 39.79057591623037 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[987.2988424731678, 717.1306649026507, 239.90848831697863, 979.8627407501484, 102.29066104606976, 458.7906478877879, 275.5546983244834, 225.6916602424589, 26.12527792643693, 366.7028959774343, 752.5264100654856] is: | 1885.7336411802055 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [204.34, 989.9, 769.23, 587.22, 313.6, 598.75, 907.67, 221.31, 7.76, 716.11, 697.58, 26.04, 416.61, 562.5, 818.67, 197.06, 492.85, 507.85, 609.86, 475.4] and [877.86, 605.89, 409.16, 650.41, 32.59, 244.04, 903.77, 499.35, 438.81, 709.82, 656.49, 745.17, 497.04, 832.24, 195.85, 37.89, 851.83, 608.87, 119.84, 17.96] is: | 0.66 radians | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers -40 and -6 = | 34 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [-17, 12, 6] . [-2, -9, 9] = | -20 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 10100110 = | 1011010 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[54, 47, 44], [59, 41, 7], [86, 33, 5]]) is: | Matrix([[26/56451, -1217/56451, 1475/56451], [-307/56451, 3514/56451, -2218/56451], [1579/56451, -2260/56451, 559/56451]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 23 and angle, 4. Find the area of the sector. | Area of sector = 18.46558 | sector_area | +| 76 | Mean and Median | Given the series of numbers [19, 93, 45, 37, 39, 8, 48, 44, 12, 10]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 35.5 and Arithmetic median of this series is 38.0 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[73, 67], [64, 58]]) = | -54 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 2095 dollars, 6% rate of interest and for a time period of 3 year is = | 2495.18 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 494= | 0x1ee | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 14% of 51? | Required percentage = 7.14% | percentage | +| 81 | Celsius To Fahrenheit | Convert -22 degrees Celsius to degrees Fahrenheit = | -7.600000000000001 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 39 of the AP series: -42, -102, -162 ... | -2322 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 49 terms of the AP series: 18, -50, -118 ... | -79086.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 3746 in Octal is: | 0o7242 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 2967 in Roman Numerals is: | MMCMLXVII | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 109 in radians is = | 1.9 | degree_to_rad | | 87 | Radians to Degrees | Angle 3 in degrees is = | 171.89 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(ln(x)+2*x^3)/dx | 6*x^2 + 1/x | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 74x^2 + 55x + 86 is = | 138.1667 | definite_integral | -| 90 | isprime | 32 | False | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5461 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 27.59exp(i-2.38) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 2, 3, 5, 6, 8} ,b={1, 10, 2, 9}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 5, 6, 8, 9, 10},Intersection is {1, 2}, a-b is {8, 3, 5, 6},b-a is {9, 10}, Symmetric difference is {3, 5, 6, 8, 9, 10} | set_operation | -| 94 | Base Conversion | Convert 131222 from base 6 to base 2. | 10111010111110 | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 27 and height, 94? | CSA of cylinder = 15946.72 | curved_surface_area_cylinder | -| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [48, 30, 110, 95, 10, 33, 87, 70, 78]cm is: | 561 | perimeter_of_polygons | -| 97 | Power of Powers | The 24^1^3 = 24^(1*3) = 24^3 | 13824 | power_of_powers | -| 98 | Quotient of Powers with Same Base | The Quotient of 41^2 and 41^3 = 41^(2-3) = 41^-1 | 0.024390243902439025 | quotient_of_power_same_base | -| 99 | Quotient of Powers with Same Power | The Quotient of 30^5 and 35^5 = (30/35)^5 = 0.8571428571428571^5 | 0.46266436603796024 | quotient_of_power_same_power | -| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 5x^2 + 8x + 2 = 0 | simplified solution : ((-0.31, -1.29)), generalized solution : ((-8 + sqrt(24))/2*5, (-8 - sqrt(24))/2*5) | complex_quadratic | +| 88 | Differentiation | differentiate w.r.t x : d(sin(x)+9*x^3)/dx | 27*x^2 + cos(x) | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 50x^2 + 38x + 41 is = | 76.6667 | definite_integral | +| 90 | isprime | 11 | True | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 7 is = | 29331 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 14.42exp(i-2.55) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={2, 3, 4, 5, 6, 8, 10} ,b={4, 5, 6, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {2, 3, 4, 5, 6, 7, 8, 10},Intersection is {4, 5, 6}, a-b is {8, 10, 2, 3},b-a is {7}, Symmetric difference is {2, 3, 7, 8, 10} | set_operation | +| 94 | Base Conversion | Convert 33210 from base 10 to base 11. | 22A51 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 3 and height, 21? | CSA of cylinder = 395.84 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 10 sided polygon with lengths of [11, 117, 72, 120, 46, 96, 40, 76, 15, 19]cm is: | 612 | perimeter_of_polygons | +| 97 | Power of Powers | The 41^3^4 = 41^(3*4) = 41^12 | 22563490300366186081 | power_of_powers | +| 98 | Quotient of Powers with Same Base | The Quotient of 19^2 and 19^2 = 19^(2-2) = 19^0 | 1 | quotient_of_power_same_base | +| 99 | Quotient of Powers with Same Power | The Quotient of 29^3 and 22^3 = (29/22)^3 = 1.3181818181818181^3 | 2.2904770848985723 | quotient_of_power_same_power | +| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 9x^2 + 9x + 2 = 0 | simplified solution : ((-0.333, -0.667)), generalized solution : ((-9 + 3)/2*9, (-9 - 3)/2*9) | complex_quadratic | diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index c48f9d8..77a2db3 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -105,3 +105,4 @@ from .power_of_powers import * from .quotient_of_power_same_base import * from .quotient_of_power_same_power import * from .complex_quadratic import * +from .is_leap_year import * diff --git a/mathgenerator/funcs/is_leap_year.py b/mathgenerator/funcs/is_leap_year.py index 1f79c2b..3f9c351 100644 --- a/mathgenerator/funcs/is_leap_year.py +++ b/mathgenerator/funcs/is_leap_year.py @@ -1,4 +1,4 @@ -from .__init__ import * +from .__init__ import * def IsLeapYear(minNumber=1900, maxNumber=2099): @@ -15,10 +15,11 @@ def IsLeapYear(minNumber=1900, maxNumber=2099): solution = "is a leap year" else: solution = "is not a leap year" - + return problem, solution -is_leap_year = Generator("Leap Year or Not", 102, + +is_leap_year = Generator("Leap Year or Not", 101, "Year y ", "is/not a leap year", - IsLeapYear) -##for readme ## | 102 | Leap Year or Not | Year 1964 | is a leap year | is_leap_year | + IsLeapYear) +# for readme ## | 102 | Leap Year or Not | Year 1964 | is a leap year | is_leap_year | diff --git a/test.py b/test.py index 8f1bf49..0b24009 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,5 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(100)) +print(mathgen.decimal_to_roman_numerals()) +print(mathgen.genById(101))