mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
lint fixes
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
from mathgenerator.mathgen import *
|
from mathgenerator.mathgen import *
|
||||||
|
|
||||||
write_list = []
|
write_list = []
|
||||||
subjects = ['algebra', 'basic_math', 'calculus',
|
subjects = [
|
||||||
'computer_science', 'geometry', 'misc', 'statistics']
|
'algebra', 'basic_math', 'calculus', 'computer_science', 'geometry',
|
||||||
|
'misc', 'statistics'
|
||||||
|
]
|
||||||
wList = getGenList()
|
wList = getGenList()
|
||||||
|
|
||||||
|
|
||||||
@@ -71,12 +73,14 @@ def gen_to_row_string(item):
|
|||||||
kwargs_list = myGen.kwargs
|
kwargs_list = myGen.kwargs
|
||||||
for kwarg in kwargs_list:
|
for kwarg in kwargs_list:
|
||||||
kwargs += '`' + kwarg + '` '
|
kwargs += '`' + kwarg + '` '
|
||||||
title = '[' + myGen.title + '](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/' + item[4] + '/' + func_name + '.py)'
|
title = '[' + myGen.title + '](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/' + item[
|
||||||
|
4] + '/' + func_name + '.py)'
|
||||||
row = [myGen.id, title, prob, solu, func_name, kwargs]
|
row = [myGen.id, title, prob, solu, func_name, kwargs]
|
||||||
# tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
# tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
||||||
# row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n"
|
# row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n"
|
||||||
tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
||||||
row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " | " + str(row[5]) + " |\n"
|
row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " | " + str(
|
||||||
|
row[5]) + " |\n"
|
||||||
print('added', item[1], '-', func_name, 'to the README.md')
|
print('added', item[1], '-', func_name, 'to the README.md')
|
||||||
return tableLine
|
return tableLine
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ class Generator:
|
|||||||
genList.append([id, title, self, funcname, subjectname, kwargs])
|
genList.append([id, title, self, funcname, subjectname, kwargs])
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(
|
return str(self.id) + " " + self.title
|
||||||
self.id
|
|
||||||
) + " " + self.title
|
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
return self.func(*args, **kwargs)
|
return self.func(*args, **kwargs)
|
||||||
|
|||||||
@@ -32,6 +32,5 @@ def basicAlgebraFunc(maxVariable=10, format='string'):
|
|||||||
return a, b, c, x
|
return a, b, c, x
|
||||||
|
|
||||||
|
|
||||||
|
basic_algebra = Generator("Basic Algebra", 11, basicAlgebraFunc,
|
||||||
basic_algebra = Generator("Basic Algebra", 11,
|
["maxVariable=10"])
|
||||||
basicAlgebraFunc, ["maxVariable=10"])
|
|
||||||
|
|||||||
@@ -44,4 +44,5 @@ def combineTerms(string):
|
|||||||
return final_string
|
return final_string
|
||||||
|
|
||||||
|
|
||||||
combine_like_terms = Generator("Combine Like terms", 105,likeTermCombineFunc, ["maxCoef=10", "maxExp=20", "maxTerms=10"])
|
combine_like_terms = Generator("Combine Like terms", 105, likeTermCombineFunc,
|
||||||
|
["maxCoef=10", "maxExp=20", "maxTerms=10"])
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ def complexQuadraticFunc(prob_type=0, max_range=10, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
complex_quadratic = Generator(
|
complex_quadratic = Generator("complex Quadratic Equation", 100,
|
||||||
"complex Quadratic Equation", 100,
|
|
||||||
complexQuadraticFunc,
|
complexQuadraticFunc,
|
||||||
["prob_type=0", "max_range=10"])
|
["prob_type=0", "max_range=10"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='string'):
|
def compoundInterestFunc(maxPrinciple=10000,
|
||||||
|
maxRate=10,
|
||||||
|
maxTime=10,
|
||||||
|
format='string'):
|
||||||
p = random.randint(1000, maxPrinciple)
|
p = random.randint(1000, maxPrinciple)
|
||||||
r = random.randint(1, maxRate)
|
r = random.randint(1, maxRate)
|
||||||
n = random.randint(1, maxTime)
|
n = random.randint(1, maxTime)
|
||||||
@@ -17,6 +20,5 @@ def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='str
|
|||||||
|
|
||||||
|
|
||||||
compound_interest = Generator(
|
compound_interest = Generator(
|
||||||
"Compound Interest", 78,
|
"Compound Interest", 78, compoundInterestFunc,
|
||||||
compoundInterestFunc,
|
|
||||||
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def distanceTwoPointsFunc(maxValXY=20, minValXY=-20, format='string'):
|
|||||||
else:
|
else:
|
||||||
return point1X, point1Y, point2X, point2Y, distanceSq
|
return point1X, point1Y, point2X, point2Y, distanceSq
|
||||||
|
|
||||||
distance_two_points = Generator(
|
|
||||||
"Distance between 2 points", 24,
|
distance_two_points = Generator("Distance between 2 points", 24,
|
||||||
distanceTwoPointsFunc,
|
distanceTwoPointsFunc,
|
||||||
["maxValXY=20", "minValXY=-20"])
|
["maxValXY=20", "minValXY=-20"])
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def expandingFunc(range_x1=10, range_x2=10, range_a=10, range_b=10, format='string'):
|
def expandingFunc(range_x1=10,
|
||||||
|
range_x2=10,
|
||||||
|
range_a=10,
|
||||||
|
range_b=10,
|
||||||
|
format='string'):
|
||||||
x1 = random.randint(-range_x1, range_x1)
|
x1 = random.randint(-range_x1, range_x1)
|
||||||
x2 = random.randint(-range_x2, range_x2)
|
x2 = random.randint(-range_x2, range_x2)
|
||||||
a = random.randint(-range_a, range_a)
|
a = random.randint(-range_a, range_a)
|
||||||
@@ -48,5 +52,6 @@ def expandingFunc(range_x1=10, range_x2=10, range_a=10, range_b=10, format='stri
|
|||||||
return p1, p2, p3, p4, c1, c2, c3
|
return p1, p2, p3, p4, c1, c2, c3
|
||||||
|
|
||||||
|
|
||||||
expanding = Generator("Expanding Factored Binomial", 111, expandingFunc,
|
expanding = Generator(
|
||||||
|
"Expanding Factored Binomial", 111, expandingFunc,
|
||||||
["range_x1=10", "range_x2=10", "range_a=10", "range_b=10"])
|
["range_x1=10", "range_x2=10", "range_a=10", "range_b=10"])
|
||||||
|
|||||||
@@ -73,5 +73,7 @@ def intersectionOfTwoLinesFunc(minM=-10,
|
|||||||
|
|
||||||
|
|
||||||
intersection_of_two_lines = Generator(
|
intersection_of_two_lines = Generator(
|
||||||
"Intersection of Two Lines", 41, intersectionOfTwoLinesFunc,
|
"Intersection of Two Lines", 41, intersectionOfTwoLinesFunc, [
|
||||||
["minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1", "maxDenominator=6"])
|
"minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1",
|
||||||
|
"maxDenominator=6"
|
||||||
|
])
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ def matrixInversion(SquareMatrixDimension=3,
|
|||||||
return Mat, sympy.Matrix.inv(Mat)
|
return Mat, sympy.Matrix.inv(Mat)
|
||||||
|
|
||||||
|
|
||||||
invert_matrix = Generator("Inverse of a Matrix", 74,
|
invert_matrix = Generator("Inverse of a Matrix", 74, matrixInversion, [
|
||||||
matrixInversion,
|
"SquareMatrixDimension=3", "MaxMatrixElement=99",
|
||||||
["SquareMatrixDimension=3", "MaxMatrixElement=99", "OnlyIntegerElementsInInvertedMatrix=False"])
|
"OnlyIntegerElementsInInvertedMatrix=False"
|
||||||
|
])
|
||||||
|
|||||||
@@ -19,5 +19,4 @@ def logFunc(maxBase=3, maxVal=8, format='string'):
|
|||||||
return b, c, a
|
return b, c, a
|
||||||
|
|
||||||
|
|
||||||
log = Generator("Logarithm", 12, logFunc,
|
log = Generator("Logarithm", 12, logFunc, ["maxBase=3", "maxVal=8"])
|
||||||
["maxBase=3", "maxVal=8"])
|
|
||||||
|
|||||||
@@ -18,5 +18,4 @@ def MidPointOfTwoPointFunc(maxValue=20, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
midPoint_of_two_points = Generator("Midpoint of the two point", 20,
|
midPoint_of_two_points = Generator("Midpoint of the two point", 20,
|
||||||
MidPointOfTwoPointFunc,
|
MidPointOfTwoPointFunc, ["maxValue=20"])
|
||||||
["maxValue=20"])
|
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ def multiplyComplexNumbersFunc(minRealImaginaryNum=-20,
|
|||||||
return num1, num2, product
|
return num1, num2, product
|
||||||
|
|
||||||
|
|
||||||
multiply_complex_numbers = Generator("Multiplication of 2 complex numbers", 65,
|
multiply_complex_numbers = Generator(
|
||||||
multiplyComplexNumbersFunc,
|
"Multiplication of 2 complex numbers", 65, multiplyComplexNumbersFunc,
|
||||||
["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"])
|
["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"])
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
elif style == 'latex':
|
elif style == 'latex':
|
||||||
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(
|
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(
|
||||||
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(d) + "\\end{bmatrix}=\\)"
|
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(
|
||||||
|
d) + "\\end{bmatrix}=\\)"
|
||||||
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + \
|
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + \
|
||||||
"\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
|
"\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|||||||
@@ -11,16 +11,14 @@ def quadraticEquation(maxVal=100, format='string'):
|
|||||||
D = math.sqrt(b * b - 4 * a * c)
|
D = math.sqrt(b * b - 4 * a * c)
|
||||||
res = [round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]
|
res = [round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]
|
||||||
|
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c)
|
problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(
|
||||||
|
a, b, c)
|
||||||
solution = str(res)
|
solution = str(res)
|
||||||
return problem, solution
|
return problem, solution
|
||||||
else:
|
else:
|
||||||
return a, b, c, res
|
return a, b, c, res
|
||||||
|
|
||||||
|
|
||||||
quadratic_equation = Generator(
|
quadratic_equation = Generator("Quadratic Equation", 50, quadraticEquation,
|
||||||
"Quadratic Equation", 50,
|
|
||||||
quadraticEquation,
|
|
||||||
["maxVal=100"])
|
["maxVal=100"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='string'):
|
def simpleInterestFunc(maxPrinciple=10000,
|
||||||
|
maxRate=10,
|
||||||
|
maxTime=10,
|
||||||
|
format='string'):
|
||||||
a = random.randint(1000, maxPrinciple)
|
a = random.randint(1000, maxPrinciple)
|
||||||
b = random.randint(1, maxRate)
|
b = random.randint(1, maxRate)
|
||||||
c = random.randint(1, maxTime)
|
c = random.randint(1, maxTime)
|
||||||
@@ -18,6 +21,5 @@ def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='strin
|
|||||||
return a, b, c, d
|
return a, b, c, d
|
||||||
|
|
||||||
|
|
||||||
simple_interest = Generator(
|
simple_interest = Generator("Simple Interest", 45, simpleInterestFunc,
|
||||||
"Simple Interest", 45, simpleInterestFunc,
|
|
||||||
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10, format='string'):
|
def systemOfEquationsFunc(range_x=10,
|
||||||
|
range_y=10,
|
||||||
|
coeff_mult_range=10,
|
||||||
|
format='string'):
|
||||||
# Generate solution point first
|
# Generate solution point first
|
||||||
x = random.randint(-range_x, range_x)
|
x = random.randint(-range_x, range_x)
|
||||||
y = random.randint(-range_y, range_y)
|
y = random.randint(-range_y, range_y)
|
||||||
@@ -50,6 +53,6 @@ def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10, format='s
|
|||||||
# Add random (non-zero) multiple of equations to each other
|
# Add random (non-zero) multiple of equations to each other
|
||||||
|
|
||||||
|
|
||||||
system_of_equations = Generator("Solve a System of Equations in R^2", 23,
|
system_of_equations = Generator(
|
||||||
systemOfEquationsFunc,
|
"Solve a System of Equations in R^2", 23, systemOfEquationsFunc,
|
||||||
["range_x=10", "range_y=10", "coeff_mult_range=10"])
|
["range_x=10", "range_y=10", "coeff_mult_range=10"])
|
||||||
|
|||||||
@@ -17,6 +17,5 @@ def vectorCrossFunc(minVal=-20, maxVal=20, format='string'):
|
|||||||
return a, b, c
|
return a, b, c
|
||||||
|
|
||||||
|
|
||||||
vector_cross = Generator("Cross Product of 2 Vectors", 43,
|
vector_cross = Generator("Cross Product of 2 Vectors", 43, vectorCrossFunc,
|
||||||
vectorCrossFunc,
|
|
||||||
["minVal=-20", "maxVal=20"])
|
["minVal=-20", "maxVal=20"])
|
||||||
|
|||||||
@@ -14,6 +14,5 @@ def vectorDotFunc(minVal=-20, maxVal=20, format='string'):
|
|||||||
return a, b, c
|
return a, b, c
|
||||||
|
|
||||||
|
|
||||||
vector_dot = Generator("Dot Product of 2 Vectors", 72,
|
vector_dot = Generator("Dot Product of 2 Vectors", 72, vectorDotFunc,
|
||||||
vectorDotFunc,
|
|
||||||
["minVal=-20", "maxVal=20"])
|
["minVal=-20", "maxVal=20"])
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ def main(maxA=100, maxB=100, format='string'):
|
|||||||
if format == "string":
|
if format == "string":
|
||||||
return "|" + str(a) + "-" + str(b) + "|=", absDiff
|
return "|" + str(a) + "-" + str(b) + "|=", absDiff
|
||||||
elif format == 'latex':
|
elif format == 'latex':
|
||||||
return ("\\(|" + str(a) + "-" + str(b) + "|=\\)",
|
return ("\\(|" + str(a) + "-" + str(b) + "|=\\)", f"\\({absDiff}\\)")
|
||||||
f"\\({absDiff}\\)")
|
|
||||||
else:
|
else:
|
||||||
return a, b, absDiff
|
return a, b, absDiff
|
||||||
|
|
||||||
|
|
||||||
absolute_difference = Generator(
|
absolute_difference = Generator("Absolute difference between two numbers", 71,
|
||||||
"Absolute difference between two numbers", 71,
|
main, ["maxA=100", "maxB=100"])
|
||||||
main,
|
|
||||||
["maxA=100", "maxB=100"])
|
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ def compareFractionsFunc(maxVal=10, format='string'):
|
|||||||
solution = "="
|
solution = "="
|
||||||
|
|
||||||
if format == "string":
|
if format == "string":
|
||||||
return (f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?",
|
return (
|
||||||
|
f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?",
|
||||||
solution)
|
solution)
|
||||||
elif format == 'latex':
|
elif format == 'latex':
|
||||||
return (f"Which symbol represents the comparison between \\(\\frac{{{a}}}{{{b}}}\\) and \\(\\frac{{{c}}}{{{d}}}\\)?",
|
return (
|
||||||
|
f"Which symbol represents the comparison between \\(\\frac{{{a}}}{{{b}}}\\) and \\(\\frac{{{c}}}{{{d}}}\\)?",
|
||||||
solution)
|
solution)
|
||||||
else:
|
else:
|
||||||
return a, b, c, d, solution
|
return a, b, c, d, solution
|
||||||
|
|
||||||
|
|
||||||
compare_fractions = Generator(
|
compare_fractions = Generator("Compare Fractions", 44, compareFractionsFunc,
|
||||||
"Compare Fractions", 44,
|
|
||||||
compareFractionsFunc,
|
|
||||||
["maxVal=10"])
|
["maxVal=10"])
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ def complexDivisionFunc(maxRes=99, maxDivid=99, format='string'):
|
|||||||
c = round(c, 2)
|
c = round(c, 2)
|
||||||
|
|
||||||
if format == "string":
|
if format == "string":
|
||||||
return (str(a) + "/" + str(b) + "=",
|
return (str(a) + "/" + str(b) + "=", str(c))
|
||||||
str(c))
|
|
||||||
elif format == 'latex':
|
elif format == 'latex':
|
||||||
return ("\\(" + str(a) + "\\div" + str(b) + "=\\)",
|
return ("\\(" + str(a) + "\\div" + str(b) + "=\\)",
|
||||||
"\\(" + str(c) + "\\)")
|
"\\(" + str(c) + "\\)")
|
||||||
|
|||||||
@@ -6,15 +6,12 @@ def cubeRootFunc(minNo=1, maxNo=1000, format='string'):
|
|||||||
a = b**(1 / 3)
|
a = b**(1 / 3)
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
return ("What is the cube root of " + str(b) + " up to 2 decimal places?",
|
return ("What is the cube root of " + str(b) +
|
||||||
str(round(a, 2)))
|
" up to 2 decimal places?", str(round(a, 2)))
|
||||||
elif format == 'latex':
|
elif format == 'latex':
|
||||||
return (f"\\(\\sqrt[3]{{{b}}}=\\)",
|
return (f"\\(\\sqrt[3]{{{b}}}=\\)", "\\(" + str(round(a, 2)) + "\\)")
|
||||||
"\\(" + str(round(a, 2)) + "\\)")
|
|
||||||
else:
|
else:
|
||||||
return b, a
|
return b, a
|
||||||
|
|
||||||
|
|
||||||
cube_root = Generator("Cube Root", 47,
|
cube_root = Generator("Cube Root", 47, cubeRootFunc, ["minNo=1", "maxNo=1000"])
|
||||||
cubeRootFunc,
|
|
||||||
["minNo=1", "maxNo=1000"])
|
|
||||||
|
|||||||
@@ -44,6 +44,5 @@ def divideFractionsFunc(maxVal=10, format='string'):
|
|||||||
return a, b, c, d, x
|
return a, b, c, d, x
|
||||||
|
|
||||||
|
|
||||||
divide_fractions = Generator("Fraction Division", 16,
|
divide_fractions = Generator("Fraction Division", 16, divideFractionsFunc,
|
||||||
divideFractionsFunc,
|
|
||||||
["maxVal=10"])
|
["maxVal=10"])
|
||||||
|
|||||||
@@ -18,5 +18,4 @@ def divisionToIntFunc(maxA=25, maxB=25, format='string'):
|
|||||||
return divisor, dividend, quotient
|
return divisor, dividend, quotient
|
||||||
|
|
||||||
|
|
||||||
division = Generator("Division", 3,
|
division = Generator("Division", 3, divisionToIntFunc, ["maxA=25", "maxB=25"])
|
||||||
divisionToIntFunc, ["maxA=25", "maxB=25"])
|
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ def exponentiationFunc(maxBase=20, maxExpo=10, format='string'):
|
|||||||
expo = random.randint(1, maxExpo)
|
expo = random.randint(1, maxExpo)
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
return (f"{base}^{expo} =",
|
return (f"{base}^{expo} =", str(base**expo))
|
||||||
str(base**expo))
|
|
||||||
elif format == 'latex':
|
elif format == 'latex':
|
||||||
return f"\\({base}^{{{expo}}}\\)", "\\(" + str(base**expo) + "\\)"
|
return f"\\({base}^{{{expo}}}\\)", "\\(" + str(base**expo) + "\\)"
|
||||||
else:
|
else:
|
||||||
return base, expo, base**expo
|
return base, expo, base**expo
|
||||||
|
|
||||||
|
|
||||||
exponentiation = Generator("Exponentiation", 53,
|
exponentiation = Generator("Exponentiation", 53, exponentiationFunc,
|
||||||
exponentiationFunc,
|
|
||||||
["maxBase=20", "maxExpo=10"])
|
["maxBase=20", "maxExpo=10"])
|
||||||
|
|||||||
@@ -15,5 +15,4 @@ def factorialFunc(maxInput=6, format='string'):
|
|||||||
return a, b
|
return a, b
|
||||||
|
|
||||||
|
|
||||||
factorial = Generator("Factorial", 31,
|
factorial = Generator("Factorial", 31, factorialFunc, ["maxInput=6"])
|
||||||
factorialFunc, ["maxInput=6"])
|
|
||||||
|
|||||||
@@ -41,5 +41,4 @@ def multiplyFractionsFunc(maxVal=10, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
fraction_multiplication = Generator("Fraction Multiplication", 28,
|
fraction_multiplication = Generator("Fraction Multiplication", 28,
|
||||||
multiplyFractionsFunc,
|
multiplyFractionsFunc, ["maxVal=10"])
|
||||||
["maxVal=10"])
|
|
||||||
|
|||||||
@@ -22,6 +22,4 @@ def isprime(max_num=100, format='string'):
|
|||||||
return a, solution
|
return a, solution
|
||||||
|
|
||||||
|
|
||||||
is_prime = Generator('isprime', 90,
|
is_prime = Generator('isprime', 90, isprime, ["max_num=100"])
|
||||||
isprime,
|
|
||||||
["max_num=100"])
|
|
||||||
|
|||||||
@@ -17,6 +17,5 @@ def multiplicationFunc(maxMulti=12, format='string'):
|
|||||||
return a, b, c
|
return a, b, c
|
||||||
|
|
||||||
|
|
||||||
multiplication = Generator("Multiplication", 2,
|
multiplication = Generator("Multiplication", 2, multiplicationFunc,
|
||||||
multiplicationFunc,
|
|
||||||
["maxMulti=12"])
|
["maxMulti=12"])
|
||||||
|
|||||||
@@ -23,7 +23,5 @@ def definiteIntegralFunc(max_coeff=100, format='string'):
|
|||||||
return a, b, c, S
|
return a, b, c, S
|
||||||
|
|
||||||
|
|
||||||
definite_integral = Generator(
|
definite_integral = Generator("Definite Integral of Quadratic Equation", 89,
|
||||||
"Definite Integral of Quadratic Equation", 89,
|
definiteIntegralFunc, ["max_coeff=100"])
|
||||||
definiteIntegralFunc,
|
|
||||||
["max_coeff=100"])
|
|
||||||
|
|||||||
@@ -51,6 +51,5 @@ def differentiationFunc(diff_lvl=2, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
differentiation = Generator("Differentiation", 88,
|
differentiation = Generator("Differentiation", 88, differentiationFunc,
|
||||||
differentiationFunc,
|
|
||||||
["diff_lvl=2"])
|
["diff_lvl=2"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='string'):
|
def powerRuleDifferentiationFunc(maxCoef=10,
|
||||||
|
maxExp=10,
|
||||||
|
maxTerms=5,
|
||||||
|
format='string'):
|
||||||
numTerms = random.randint(1, maxTerms)
|
numTerms = random.randint(1, maxTerms)
|
||||||
problem = ""
|
problem = ""
|
||||||
solution = ""
|
solution = ""
|
||||||
@@ -22,6 +25,6 @@ def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='stri
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
power_rule_differentiation = Generator("Power Rule Differentiation", 7,
|
power_rule_differentiation = Generator(
|
||||||
powerRuleDifferentiationFunc,
|
"Power Rule Differentiation", 7, powerRuleDifferentiationFunc,
|
||||||
["maxCoef=10", "maxExp=10", "maxTerms=5"])
|
["maxCoef=10", "maxExp=10", "maxTerms=5"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='string'):
|
def powerRuleIntegrationFunc(maxCoef=10,
|
||||||
|
maxExp=10,
|
||||||
|
maxTerms=5,
|
||||||
|
format='string'):
|
||||||
numTerms = random.randint(1, maxTerms)
|
numTerms = random.randint(1, maxTerms)
|
||||||
problem = ""
|
problem = ""
|
||||||
solution = ""
|
solution = ""
|
||||||
|
|||||||
@@ -12,10 +12,9 @@ def stationaryPointsFunc(maxExp=3, maxCoef=10, format='string'):
|
|||||||
solution = sympy.stationary_points(problem, x)
|
solution = sympy.stationary_points(problem, x)
|
||||||
|
|
||||||
#if len(solution) != 0:
|
#if len(solution) != 0:
|
||||||
solution = ','.join('({},{})'.format(
|
solution = ','.join(
|
||||||
str(p),
|
'({},{})'.format(str(p), sympy.sympify(problem.replace(x, p)))
|
||||||
sympy.sympify(problem.replace(x, p))
|
for p in solution)
|
||||||
) for p in solution)
|
|
||||||
problem = 'f(x)=' + str(problem).replace('**', '^')
|
problem = 'f(x)=' + str(problem).replace('**', '^')
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|||||||
@@ -24,5 +24,4 @@ def BCDtoDecimalFunc(maxNumber=10000, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91,
|
bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91,
|
||||||
BCDtoDecimalFunc,
|
BCDtoDecimalFunc, ["maxNumber=10000"])
|
||||||
["maxNumber=10000"])
|
|
||||||
|
|||||||
@@ -32,5 +32,4 @@ def binary2sComplementFunc(maxDigits=10, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
binary_2s_complement = Generator("Binary 2's Complement", 73,
|
binary_2s_complement = Generator("Binary 2's Complement", 73,
|
||||||
binary2sComplementFunc,
|
binary2sComplementFunc, ["maxDigits=10"])
|
||||||
["maxDigits=10"])
|
|
||||||
|
|||||||
@@ -18,5 +18,4 @@ def binaryComplement1sFunc(maxDigits=10, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
binary_complement_1s = Generator("Binary Complement 1s", 4,
|
binary_complement_1s = Generator("Binary Complement 1s", 4,
|
||||||
binaryComplement1sFunc,
|
binaryComplement1sFunc, ["maxDigits=10"])
|
||||||
["maxDigits=10"])
|
|
||||||
|
|||||||
@@ -15,6 +15,5 @@ def binaryToDecimalFunc(max_dig=10, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
binary_to_decimal = Generator("Binary to Decimal", 15,
|
binary_to_decimal = Generator("Binary to Decimal", 15, binaryToDecimalFunc,
|
||||||
binaryToDecimalFunc,
|
|
||||||
["max_dig=10"])
|
["max_dig=10"])
|
||||||
|
|||||||
@@ -17,5 +17,4 @@ def DecimalToBCDFunc(maxNumber=10000, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
decimal_to_bcd = Generator("Decimal to Binary Coded Decimal", 103,
|
decimal_to_bcd = Generator("Decimal to Binary Coded Decimal", 103,
|
||||||
DecimalToBCDFunc,
|
DecimalToBCDFunc, ["maxNumber=10000"])
|
||||||
["maxNumber=10000"])
|
|
||||||
|
|||||||
@@ -11,6 +11,5 @@ def DecimalToBinaryFunc(max_dec=99, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
decimal_to_binary = Generator("Decimal to Binary", 14,
|
decimal_to_binary = Generator("Decimal to Binary", 14, DecimalToBinaryFunc,
|
||||||
DecimalToBinaryFunc,
|
|
||||||
["max_dec=99"])
|
["max_dec=99"])
|
||||||
|
|||||||
@@ -13,5 +13,4 @@ def decimalToOctalFunc(maxDecimal=4096, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
decimal_to_octal = Generator("Converts decimal to octal", 84,
|
decimal_to_octal = Generator("Converts decimal to octal", 84,
|
||||||
decimalToOctalFunc,
|
decimalToOctalFunc, ["maxDecimal=4096"])
|
||||||
["maxDecimal=4096"])
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ def fibonacciSeriesFunc(minNo=1, format='string'):
|
|||||||
fibList = createFibList(n)
|
fibList = createFibList(n)
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = "The Fibonacci Series of the first " + str(n) + " numbers is ?"
|
problem = "The Fibonacci Series of the first " + str(
|
||||||
|
n) + " numbers is ?"
|
||||||
return problem, fibList
|
return problem, fibList
|
||||||
else:
|
else:
|
||||||
return n, fibList
|
return n, fibList
|
||||||
|
|
||||||
|
|
||||||
fibonacci_series = Generator(
|
fibonacci_series = Generator("Fibonacci Series", 56, fibonacciSeriesFunc,
|
||||||
"Fibonacci Series", 56, fibonacciSeriesFunc,
|
|
||||||
["minNo=1"])
|
["minNo=1"])
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ def nthFibonacciNumberFunc(maxN=100, format='string'):
|
|||||||
golden_ratio = (1 + math.sqrt(5)) / 2
|
golden_ratio = (1 + math.sqrt(5)) / 2
|
||||||
n = random.randint(1, maxN)
|
n = random.randint(1, maxN)
|
||||||
problem = f"What is the {n}th Fibonacci number?"
|
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)))
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
solution = f"{ans}"
|
solution = f"{ans}"
|
||||||
@@ -17,5 +18,4 @@ def nthFibonacciNumberFunc(maxN=100, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
nth_fibonacci_number = Generator("nth Fibonacci number", 62,
|
nth_fibonacci_number = Generator("nth Fibonacci number", 62,
|
||||||
nthFibonacciNumberFunc,
|
nthFibonacciNumberFunc, ["maxN=100"])
|
||||||
["maxN=100"])
|
|
||||||
|
|||||||
@@ -25,6 +25,5 @@ def angleBtwVectorsFunc(maxEltAmt=20, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
angle_btw_vectors = Generator(
|
angle_btw_vectors = Generator("Angle between 2 vectors", 70,
|
||||||
"Angle between 2 vectors", 70, angleBtwVectorsFunc,
|
angleBtwVectorsFunc, ["maxEltAmt=20"])
|
||||||
["maxEltAmt=20"])
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ def regularPolygonAngleFunc(minVal=3, maxVal=20, format='string'):
|
|||||||
return sideNum, solution
|
return sideNum, solution
|
||||||
|
|
||||||
|
|
||||||
angle_regular_polygon = Generator(
|
angle_regular_polygon = Generator("Angle of a Regular Polygon", 29,
|
||||||
"Angle of a Regular Polygon", 29,
|
|
||||||
regularPolygonAngleFunc,
|
regularPolygonAngleFunc,
|
||||||
["minVal=3", "maxVal=20"])
|
["minVal=3", "maxVal=20"])
|
||||||
|
|||||||
@@ -18,6 +18,5 @@ def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20, format='string'):
|
|||||||
return a, b, c, area
|
return a, b, c, area
|
||||||
|
|
||||||
|
|
||||||
area_of_triangle = Generator("Area of Triangle", 18,
|
area_of_triangle = Generator("Area of Triangle", 18, areaOfTriangleFunc,
|
||||||
areaOfTriangleFunc,
|
|
||||||
["maxA=20", "maxB=20", "maxC=20"])
|
["maxA=20", "maxB=20", "maxC=20"])
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import math
|
|||||||
|
|
||||||
# Handles degrees in quadrant one
|
# Handles degrees in quadrant one
|
||||||
def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
|
def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
|
||||||
functions=["sin", "cos", "tan"], format='string'):
|
functions=["sin", "cos", "tan"],
|
||||||
|
format='string'):
|
||||||
angle = random.choice(angles)
|
angle = random.choice(angles)
|
||||||
function = random.choice(functions)
|
function = random.choice(functions)
|
||||||
|
|
||||||
@@ -31,5 +32,6 @@ def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
|
|||||||
return function, angle, solution
|
return function, angle, solution
|
||||||
|
|
||||||
|
|
||||||
basic_trigonometry = Generator("Trigonometric Values", 57, basicTrigonometryFunc,
|
basic_trigonometry = Generator(
|
||||||
|
"Trigonometric Values", 57, basicTrigonometryFunc,
|
||||||
["angles=[0, 30, 45, 60, 90]", "functions=['sin', 'cos', 'tan']"])
|
["angles=[0, 30, 45, 60, 90]", "functions=['sin', 'cos', 'tan']"])
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ def curvedSurfaceAreaCylinderFunc(maxRadius=49, maxHeight=99, format='string'):
|
|||||||
return r, h, formatted_float
|
return r, h, formatted_float
|
||||||
|
|
||||||
|
|
||||||
curved_surface_area_cylinder = Generator(
|
curved_surface_area_cylinder = Generator("Curved surface area of a cylinder",
|
||||||
"Curved surface area of a cylinder", 95,
|
95, curvedSurfaceAreaCylinderFunc,
|
||||||
curvedSurfaceAreaCylinderFunc,
|
|
||||||
["maxRadius=49", "maxHeight=99"])
|
["maxRadius=49", "maxHeight=99"])
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ def fourthAngleOfQuadriFunc(maxAngle=180, format='string'):
|
|||||||
return angle1, angle2, angle3, angle4
|
return angle1, angle2, angle3, angle4
|
||||||
|
|
||||||
|
|
||||||
fourth_angle_of_quadrilateral = Generator(
|
fourth_angle_of_quadrilateral = Generator("Fourth Angle of Quadrilateral", 49,
|
||||||
"Fourth Angle of Quadrilateral", 49,
|
|
||||||
fourthAngleOfQuadriFunc,
|
fourthAngleOfQuadriFunc,
|
||||||
["maxAngle=180"])
|
["maxAngle=180"])
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120, format='string'):
|
|||||||
return size_of_sides, sides, solution
|
return size_of_sides, sides, solution
|
||||||
|
|
||||||
|
|
||||||
perimeter_of_polygons = Generator(
|
perimeter_of_polygons = Generator("Perimeter of Polygons", 96,
|
||||||
"Perimeter of Polygons", 96,
|
|
||||||
perimeterOfPolygons,
|
perimeterOfPolygons,
|
||||||
["maxSides=12", "maxLength=120"])
|
["maxSides=12", "maxLength=120"])
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ def pythagoreanTheoremFunc(maxLength=20, format='string'):
|
|||||||
solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}"
|
solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}"
|
||||||
return problem, solution
|
return problem, solution
|
||||||
else:
|
else:
|
||||||
return a, b, round(c,2)
|
return a, b, round(c, 2)
|
||||||
|
|
||||||
|
|
||||||
pythagorean_theorem = Generator(
|
pythagorean_theorem = Generator("Pythagorean Theorem", 25,
|
||||||
"Pythagorean Theorem", 25, pythagoreanTheoremFunc,
|
pythagoreanTheoremFunc, ["maxLength=20"])
|
||||||
["maxLength=20"])
|
|
||||||
|
|||||||
@@ -13,5 +13,4 @@ def sumOfAnglesOfPolygonFunc(maxSides=12, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
sum_of_polygon_angles = Generator("Sum of Angles of Polygon", 58,
|
sum_of_polygon_angles = Generator("Sum of Angles of Polygon", 58,
|
||||||
sumOfAnglesOfPolygonFunc,
|
sumOfAnglesOfPolygonFunc, ["maxSides=12"])
|
||||||
["maxSides=12"])
|
|
||||||
|
|||||||
@@ -16,7 +16,5 @@ def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
|||||||
return a, b, ans, unit
|
return a, b, ans, unit
|
||||||
|
|
||||||
|
|
||||||
surface_area_cone = Generator(
|
surface_area_cone = Generator("Surface Area of cone", 38, surfaceAreaCone,
|
||||||
"Surface Area of cone", 38,
|
|
||||||
surfaceAreaCone,
|
|
||||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||||
|
|||||||
@@ -13,6 +13,5 @@ def surfaceAreaCube(maxSide=20, unit='m', format='string'):
|
|||||||
return a, ans, unit
|
return a, ans, unit
|
||||||
|
|
||||||
|
|
||||||
surface_area_cube = Generator("Surface Area of Cube", 32,
|
surface_area_cube = Generator("Surface Area of Cube", 32, surfaceAreaCube,
|
||||||
surfaceAreaCube,
|
|
||||||
["maxSide=20", "unit='m'"])
|
["maxSide=20", "unit='m'"])
|
||||||
|
|||||||
@@ -15,7 +15,5 @@ def surfaceAreaCuboid(maxSide=20, unit='m', format='string'):
|
|||||||
return a, b, c, ans, unit
|
return a, b, c, ans, unit
|
||||||
|
|
||||||
|
|
||||||
surface_area_cuboid = Generator(
|
surface_area_cuboid = Generator("Surface Area of Cuboid", 33,
|
||||||
"Surface Area of Cuboid", 33,
|
surfaceAreaCuboid, ["maxSide=20", "unit='m'"])
|
||||||
surfaceAreaCuboid,
|
|
||||||
["maxSide=20", "unit='m'"])
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ def surfaceAreaCylinder(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
|||||||
return a, b, ans, unit
|
return a, b, ans, unit
|
||||||
|
|
||||||
|
|
||||||
surface_area_cylinder = Generator(
|
surface_area_cylinder = Generator("Surface Area of Cylinder", 34,
|
||||||
"Surface Area of Cylinder", 34,
|
|
||||||
surfaceAreaCylinder,
|
surfaceAreaCylinder,
|
||||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||||
|
|||||||
@@ -13,7 +13,5 @@ def surfaceAreaSphere(maxSide=20, unit='m', format='string'):
|
|||||||
return r, ans, unit
|
return r, ans, unit
|
||||||
|
|
||||||
|
|
||||||
surface_area_sphere = Generator(
|
surface_area_sphere = Generator("Surface Area of Sphere", 60,
|
||||||
"Surface Area of Sphere", 60,
|
surfaceAreaSphere, ["maxSide=20", "unit='m'"])
|
||||||
surfaceAreaSphere,
|
|
||||||
["maxSide=20", "unit='m'"])
|
|
||||||
|
|||||||
@@ -14,5 +14,4 @@ def thirdAngleOfTriangleFunc(maxAngle=89, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
third_angle_of_triangle = Generator("Third Angle of Triangle", 22,
|
third_angle_of_triangle = Generator("Third Angle of Triangle", 22,
|
||||||
thirdAngleOfTriangleFunc,
|
thirdAngleOfTriangleFunc, ["maxAngle=89"])
|
||||||
["maxAngle=89"])
|
|
||||||
|
|||||||
@@ -23,6 +23,5 @@ def isTriangleValidFunc(maxSideLength=50, format='string'):
|
|||||||
return sideA, sideB, sideC, exists
|
return sideA, sideB, sideC, exists
|
||||||
|
|
||||||
|
|
||||||
valid_triangle = Generator("Triangle exists check", 19,
|
valid_triangle = Generator("Triangle exists check", 19, isTriangleValidFunc,
|
||||||
isTriangleValidFunc,
|
|
||||||
["maxSideLength=50"])
|
["maxSideLength=50"])
|
||||||
|
|||||||
@@ -14,7 +14,5 @@ def volumeCone(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
|||||||
return a, b, ans, unit
|
return a, b, ans, unit
|
||||||
|
|
||||||
|
|
||||||
volume_cone = Generator(
|
volume_cone = Generator("Volume of cone", 39, volumeCone,
|
||||||
"Volume of cone", 39,
|
|
||||||
volumeCone,
|
|
||||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from .__init__ import *
|
|||||||
|
|
||||||
def volumeCube(maxSide=20, unit='m', format='string'):
|
def volumeCube(maxSide=20, unit='m', format='string'):
|
||||||
a = random.randint(1, maxSide)
|
a = random.randint(1, maxSide)
|
||||||
ans = a ** 3
|
ans = a**3
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = f"Volume of cube with side = {a}{unit} is"
|
problem = f"Volume of cube with side = {a}{unit} is"
|
||||||
@@ -13,6 +13,5 @@ def volumeCube(maxSide=20, unit='m', format='string'):
|
|||||||
return a, ans, unit
|
return a, ans, unit
|
||||||
|
|
||||||
|
|
||||||
volume_cube = Generator("Volum of Cube", 35,
|
volume_cube = Generator("Volum of Cube", 35, volumeCube,
|
||||||
volumeCube,
|
|
||||||
["maxSide=20", "unit='m'"])
|
["maxSide=20", "unit='m'"])
|
||||||
|
|||||||
@@ -15,7 +15,5 @@ def volumeCuboid(maxSide=20, unit='m', format='string'):
|
|||||||
return a, b, c, ans, unit
|
return a, b, c, ans, unit
|
||||||
|
|
||||||
|
|
||||||
volume_cuboid = Generator(
|
volume_cuboid = Generator("Volume of Cuboid", 36, volumeCuboid,
|
||||||
"Volume of Cuboid", 36,
|
|
||||||
volumeCuboid,
|
|
||||||
["maxSide=20", "unit='m'"])
|
["maxSide=20", "unit='m'"])
|
||||||
|
|||||||
@@ -14,7 +14,5 @@ def volumeCylinder(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
|||||||
return a, b, ans, unit
|
return a, b, ans, unit
|
||||||
|
|
||||||
|
|
||||||
volume_cylinder = Generator(
|
volume_cylinder = Generator("Volume of cylinder", 37, volumeCylinder,
|
||||||
"Volume of cylinder", 37,
|
|
||||||
volumeCylinder,
|
|
||||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from .__init__ import *
|
|||||||
|
|
||||||
def volumeSphereFunc(maxRadius=100, format='string'):
|
def volumeSphereFunc(maxRadius=100, format='string'):
|
||||||
r = random.randint(1, maxRadius)
|
r = random.randint(1, maxRadius)
|
||||||
ans = (4 * math.pi / 3) * r ** 3
|
ans = (4 * math.pi / 3) * r**3
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = f"Volume of sphere with radius {r} m = "
|
problem = f"Volume of sphere with radius {r} m = "
|
||||||
@@ -13,6 +13,5 @@ def volumeSphereFunc(maxRadius=100, format='string'):
|
|||||||
return r, ans
|
return r, ans
|
||||||
|
|
||||||
|
|
||||||
volume_sphere = Generator("Volume of Sphere", 61,
|
volume_sphere = Generator("Volume of Sphere", 61, volumeSphereFunc,
|
||||||
volumeSphereFunc,
|
|
||||||
["maxRadius=100"])
|
["maxRadius=100"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
def arithmeticProgressionSumFunc(maxd=100,
|
||||||
|
maxa=100,
|
||||||
|
maxn=100,
|
||||||
|
format='string'):
|
||||||
d = random.randint(-1 * maxd, maxd)
|
d = random.randint(-1 * maxd, maxd)
|
||||||
a1 = random.randint(-1 * maxa, maxa)
|
a1 = random.randint(-1 * maxa, maxa)
|
||||||
a2 = a1 + d
|
a2 = a1 + d
|
||||||
@@ -11,7 +14,6 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
|||||||
an = a1 + (n - 1) * d
|
an = a1 + (n - 1) * d
|
||||||
solution = n * (a1 + an) / 2
|
solution = n * (a1 + an) / 2
|
||||||
|
|
||||||
|
|
||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = 'Find the sum of first ' + \
|
problem = 'Find the sum of first ' + \
|
||||||
str(n) + ' terms of the AP series: ' + apString
|
str(n) + ' terms of the AP series: ' + apString
|
||||||
@@ -20,7 +22,6 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
|||||||
return n, apString, solution
|
return n, apString, solution
|
||||||
|
|
||||||
|
|
||||||
arithmetic_progression_sum = Generator(
|
arithmetic_progression_sum = Generator("AP Sum Calculation", 83,
|
||||||
"AP Sum Calculation", 83,
|
|
||||||
arithmeticProgressionSumFunc,
|
arithmeticProgressionSumFunc,
|
||||||
["maxd=100", "maxa=100", "maxn=100"])
|
["maxd=100", "maxa=100", "maxn=100"])
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
def arithmeticProgressionTermFunc(maxd=100,
|
||||||
|
maxa=100,
|
||||||
|
maxn=100,
|
||||||
|
format='string'):
|
||||||
d = random.randint(-1 * maxd, maxd)
|
d = random.randint(-1 * maxd, maxd)
|
||||||
a1 = random.randint(-1 * maxa, maxa)
|
a1 = random.randint(-1 * maxa, maxa)
|
||||||
a2 = a1 + d
|
a2 = a1 + d
|
||||||
@@ -18,7 +21,6 @@ def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100, format='string')
|
|||||||
return n, apString, solution
|
return n, apString, solution
|
||||||
|
|
||||||
|
|
||||||
arithmetic_progression_term = Generator(
|
arithmetic_progression_term = Generator("AP Term Calculation", 82,
|
||||||
"AP Term Calculation", 82,
|
|
||||||
arithmeticProgressionTermFunc,
|
arithmeticProgressionTermFunc,
|
||||||
["maxd=100", "maxa=100", "maxn=100"])
|
["maxd=100", "maxa=100", "maxn=100"])
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ def baseConversionFunc(maxNum=60000, maxBase=16, format='string'):
|
|||||||
ans = fromBaseTenTo(n, bases[1])
|
ans = fromBaseTenTo(n, bases[1])
|
||||||
return problem, ans
|
return problem, ans
|
||||||
else:
|
else:
|
||||||
return fromBaseTenTo(n, bases[0]), bases[0], bases[1], fromBaseTenTo(n, bases[1])
|
return fromBaseTenTo(n, bases[0]), bases[0], bases[1], fromBaseTenTo(
|
||||||
|
n, bases[1])
|
||||||
|
|
||||||
|
|
||||||
base_conversion = Generator("Base Conversion", 94,
|
base_conversion = Generator("Base Conversion", 94, baseConversionFunc,
|
||||||
baseConversionFunc,
|
|
||||||
["maxNum=60000", "maxBase=16"])
|
["maxNum=60000", "maxBase=16"])
|
||||||
|
|||||||
@@ -15,5 +15,4 @@ def celsiustofahrenheitFunc(maxTemp=100, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
celsius_to_fahrenheit = Generator("Celsius To Fahrenheit", 81,
|
celsius_to_fahrenheit = Generator("Celsius To Fahrenheit", 81,
|
||||||
celsiustofahrenheitFunc,
|
celsiustofahrenheitFunc, ["maxTemp=100"])
|
||||||
["maxTemp=100"])
|
|
||||||
|
|||||||
@@ -27,6 +27,5 @@ def commonFactorsFunc(maxVal=100, format='string'):
|
|||||||
return a, b, arr
|
return a, b, arr
|
||||||
|
|
||||||
|
|
||||||
common_factors = Generator("Common Factors", 40,
|
common_factors = Generator("Common Factors", 40, commonFactorsFunc,
|
||||||
commonFactorsFunc,
|
|
||||||
["maxVal=100"])
|
["maxVal=100"])
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ from .__init__ import *
|
|||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
def complexToPolarFunc(minRealImaginaryNum=-20, maxRealImaginaryNum=20, format='string'):
|
def complexToPolarFunc(minRealImaginaryNum=-20,
|
||||||
|
maxRealImaginaryNum=20,
|
||||||
|
format='string'):
|
||||||
num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
|
num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
|
||||||
random.randint(minRealImaginaryNum, maxRealImaginaryNum))
|
random.randint(minRealImaginaryNum, maxRealImaginaryNum))
|
||||||
a = num.real
|
a = num.real
|
||||||
@@ -18,5 +20,6 @@ def complexToPolarFunc(minRealImaginaryNum=-20, maxRealImaginaryNum=20, format='
|
|||||||
return r, a, b, theta
|
return r, a, b, theta
|
||||||
|
|
||||||
|
|
||||||
complex_to_polar = Generator("Complex To Polar Form", 92, complexToPolarFunc,
|
complex_to_polar = Generator(
|
||||||
|
"Complex To Polar Form", 92, complexToPolarFunc,
|
||||||
["minRealImaginaryNum=-20, maxRealImaginaryNum=20"])
|
["minRealImaginaryNum=-20, maxRealImaginaryNum=20"])
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000, format='string'):
|
|||||||
elif last_value == 4:
|
elif last_value == 4:
|
||||||
solution += (roman_dict[divisor] + roman_dict[divisor * 5])
|
solution += (roman_dict[divisor] + roman_dict[divisor * 5])
|
||||||
elif 5 <= last_value <= 8:
|
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:
|
elif last_value == 9:
|
||||||
solution += (roman_dict[divisor] + roman_dict[divisor * 10])
|
solution += (roman_dict[divisor] + roman_dict[divisor * 10])
|
||||||
x = math.floor(x % divisor)
|
x = math.floor(x % divisor)
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ def euclidianNormFunc(maxEltAmt=20, format='string'):
|
|||||||
return vec, solution
|
return vec, solution
|
||||||
|
|
||||||
|
|
||||||
eucldian_norm = Generator(
|
eucldian_norm = Generator("Euclidian norm or L2 norm of a vector", 69,
|
||||||
"Euclidian norm or L2 norm of a vector", 69, euclidianNormFunc,
|
euclidianNormFunc, ["maxEltAmt=20"])
|
||||||
["maxEltAmt=20"])
|
|
||||||
|
|||||||
@@ -27,6 +27,5 @@ def geometricMeanFunc(maxValue=100, maxNum=4, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
geometric_mean = Generator(
|
geometric_mean = Generator("Geometric Mean of N Numbers", 67,
|
||||||
"Geometric Mean of N Numbers", 67, geometricMeanFunc,
|
geometricMeanFunc, ["maxValue=100", "maxNum=4"])
|
||||||
["maxValue=100", "maxNum=4"])
|
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def geomProgrFunc(number_values=6,
|
|||||||
if format == 'string':
|
if format == 'string':
|
||||||
problem = "For the given GP " + str(
|
problem = "For the given GP " + str(
|
||||||
GP) + " ,Find the value of a,common ratio," + str(
|
GP) + " ,Find the value of a,common ratio," + str(
|
||||||
n_term) + "th term value, sum upto " + str(sum_term) + "th term"
|
n_term) + "th term value, sum upto " + str(
|
||||||
|
sum_term) + "th term"
|
||||||
solution = "The value of a is {}, common ratio is {} , {}th term is {} , sum upto {}th term is {}".format(
|
solution = "The value of a is {}, common ratio is {} , {}th term is {} , sum upto {}th term is {}".format(
|
||||||
a, r, n_term, value_nth_term, sum_term, sum_till_nth_term)
|
a, r, n_term, value_nth_term, sum_term, sum_till_nth_term)
|
||||||
return problem, solution
|
return problem, solution
|
||||||
@@ -28,7 +29,6 @@ def geomProgrFunc(number_values=6,
|
|||||||
return GP, n_term, sum_term, a, r, n_term, value_nth_term, sum_term, sum_till_nth_term
|
return GP, n_term, sum_term, a, r, n_term, value_nth_term, sum_term, sum_till_nth_term
|
||||||
|
|
||||||
|
|
||||||
|
geometric_progression = Generator("Geometric Progression", 66, geomProgrFunc, [
|
||||||
geometric_progression = Generator(
|
"number_values=6", "min_value=2", "max_value=12", "n_term=7", "sum_term=5"
|
||||||
"Geometric Progression", 66, geomProgrFunc,
|
])
|
||||||
["number_values=6", "min_value=2", "max_value=12", "n_term=7", "sum_term=5"])
|
|
||||||
|
|||||||
@@ -28,6 +28,5 @@ def harmonicMeanFunc(maxValue=100, maxNum=4, format='string'):
|
|||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
harmonic_mean = Generator("Harmonic Mean of N Numbers", 68,
|
harmonic_mean = Generator("Harmonic Mean of N Numbers", 68, harmonicMeanFunc,
|
||||||
harmonicMeanFunc,
|
|
||||||
["maxValue=100", "maxNum=4"])
|
["maxValue=100", "maxNum=4"])
|
||||||
|
|||||||
@@ -16,5 +16,4 @@ def hcfFunc(maxVal=20, format='string'):
|
|||||||
return a, b, x
|
return a, b, x
|
||||||
|
|
||||||
|
|
||||||
hcf = Generator("HCF (Highest Common Factor)", 51, hcfFunc,
|
hcf = Generator("HCF (Highest Common Factor)", 51, hcfFunc, ["maxVal=20"])
|
||||||
["maxVal=20"])
|
|
||||||
|
|||||||
@@ -25,6 +25,5 @@ def IsLeapYear(minNumber=1900, maxNumber=2099, format='string'):
|
|||||||
return year, ans
|
return year, ans
|
||||||
|
|
||||||
|
|
||||||
is_leap_year = Generator("Leap Year or Not", 101,
|
is_leap_year = Generator("Leap Year or Not", 101, IsLeapYear,
|
||||||
IsLeapYear,
|
|
||||||
["minNumber=1900", "maxNumber=2099"])
|
["minNumber=1900", "maxNumber=2099"])
|
||||||
|
|||||||
@@ -19,6 +19,4 @@ def lcmFunc(maxVal=20, format='string'):
|
|||||||
return a, b, d
|
return a, b, d
|
||||||
|
|
||||||
|
|
||||||
lcm = Generator("LCM (Least Common Multiple)", 9,
|
lcm = Generator("LCM (Least Common Multiple)", 9, lcmFunc, ["maxVal=20"])
|
||||||
lcmFunc,
|
|
||||||
["maxVal=20"])
|
|
||||||
|
|||||||
@@ -15,5 +15,4 @@ def minutesToHoursFunc(maxMinutes=999, format='string'):
|
|||||||
|
|
||||||
|
|
||||||
minutes_to_hours = Generator("Minute to Hour conversion", 102,
|
minutes_to_hours = Generator("Minute to Hour conversion", 102,
|
||||||
minutesToHoursFunc,
|
minutesToHoursFunc, ["maxMinutes=999"])
|
||||||
["maxMinutes=999"])
|
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ def primeFactorsFunc(minVal=1, maxVal=200, format='string'):
|
|||||||
return a, factors
|
return a, factors
|
||||||
|
|
||||||
|
|
||||||
prime_factors = Generator("Prime Factorisation", 27,primeFactorsFunc,
|
prime_factors = Generator("Prime Factorisation", 27, primeFactorsFunc,
|
||||||
["minVal=1", "maxVal=200"])
|
["minVal=1", "maxVal=200"])
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ def profitLossPercentFunc(maxCP=1000, maxSP=1000, format='string'):
|
|||||||
return profitOrLoss, cP, sP, percent
|
return profitOrLoss, cP, sP, percent
|
||||||
|
|
||||||
|
|
||||||
profit_loss_percent = Generator(
|
profit_loss_percent = Generator("Profit or Loss Percent", 63,
|
||||||
"Profit or Loss Percent", 63,
|
|
||||||
profitLossPercentFunc,
|
profitLossPercentFunc,
|
||||||
["maxCP=1000", "maxSP=1000"])
|
["maxCP=1000", "maxSP=1000"])
|
||||||
|
|||||||
@@ -21,6 +21,5 @@ def combinationsFunc(maxlength=20, format='string'):
|
|||||||
return a, b, solution
|
return a, b, solution
|
||||||
|
|
||||||
|
|
||||||
combinations = Generator(
|
combinations = Generator("Combinations of Objects", 30, combinationsFunc,
|
||||||
"Combinations of Objects", 30, combinationsFunc,
|
|
||||||
["maxlength=20"])
|
["maxlength=20"])
|
||||||
|
|||||||
@@ -28,6 +28,5 @@ def conditionalProbFunc(format='string'):
|
|||||||
return P_disease, true_positive, true_negative, answer
|
return P_disease, true_positive, true_negative, answer
|
||||||
|
|
||||||
|
|
||||||
conditional_probability = Generator("Conditional Probability",
|
conditional_probability = Generator("Conditional Probability", 107,
|
||||||
107, conditionalProbFunc,
|
conditionalProbFunc, [""])
|
||||||
[""])
|
|
||||||
|
|||||||
@@ -39,5 +39,4 @@ def confidenceIntervalFunc(format='string'):
|
|||||||
|
|
||||||
|
|
||||||
confidence_interval = Generator("Confidence interval For sample S", 54,
|
confidence_interval = Generator("Confidence interval For sample S", 54,
|
||||||
confidenceIntervalFunc,
|
confidenceIntervalFunc, [""])
|
||||||
[""])
|
|
||||||
|
|||||||
@@ -27,5 +27,6 @@ def dataSummaryFunc(number_values=15, minval=5, maxval=50, format='string'):
|
|||||||
return random_list, mean, standardDeviation, variance
|
return random_list, mean, standardDeviation, variance
|
||||||
|
|
||||||
|
|
||||||
data_summary = Generator("Mean,Standard Deviation,Variance", 59, dataSummaryFunc,
|
data_summary = Generator("Mean,Standard Deviation,Variance", 59,
|
||||||
|
dataSummaryFunc,
|
||||||
["number_values=15", "minval=5", "maxval=50"])
|
["number_values=15", "minval=5", "maxval=50"])
|
||||||
|
|||||||
@@ -30,5 +30,4 @@ def DiceSumProbFunc(maxDice=3, format='string'):
|
|||||||
|
|
||||||
dice_sum_probability = Generator(
|
dice_sum_probability = Generator(
|
||||||
"Probability of a certain sum appearing on faces of dice", 52,
|
"Probability of a certain sum appearing on faces of dice", 52,
|
||||||
DiceSumProbFunc,
|
DiceSumProbFunc, ["maxDice=3"])
|
||||||
["maxDice=3"])
|
|
||||||
|
|||||||
@@ -19,5 +19,4 @@ def meanMedianFunc(maxlen=10, format='string'):
|
|||||||
return randomlist, mean, median
|
return randomlist, mean, median
|
||||||
|
|
||||||
|
|
||||||
mean_median = Generator("Mean and Median", 76, meanMedianFunc,
|
mean_median = Generator("Mean and Median", 76, meanMedianFunc, ["maxlen=10"])
|
||||||
["maxlen=10"])
|
|
||||||
|
|||||||
@@ -16,6 +16,4 @@ def permutationFunc(maxlength=20, format='string'):
|
|||||||
return a, b, answer
|
return a, b, answer
|
||||||
|
|
||||||
|
|
||||||
permutation = Generator(
|
permutation = Generator("Permutations", 42, permutationFunc, ["maxlength=20"])
|
||||||
"Permutations", 42, permutationFunc,
|
|
||||||
["maxlength=20"])
|
|
||||||
|
|||||||
Reference in New Issue
Block a user