diff --git a/mathgenerator/__init__.py b/mathgenerator/__init__.py index d2423b0..2b2a0d0 100644 --- a/mathgenerator/__init__.py +++ b/mathgenerator/__init__.py @@ -10,11 +10,9 @@ genList = [] class Generator: - def __init__(self, title, id, generalProb, generalSol, func, kwargs): + def __init__(self, title, id, func, kwargs): self.title = title self.id = id - self.generalProb = generalProb - self.generalSol = generalSol self.func = func self.kwargs = kwargs @@ -30,7 +28,7 @@ class Generator: def __str__(self): return str( self.id - ) + " " + self.title + " " + self.generalProb + " " + self.generalSol + ) + " " + self.title def __call__(self, *args, **kwargs): try: diff --git a/mathgenerator/funcs/algebra/basic_algebra.py b/mathgenerator/funcs/algebra/basic_algebra.py index fe2771c..1e9ee4a 100644 --- a/mathgenerator/funcs/algebra/basic_algebra.py +++ b/mathgenerator/funcs/algebra/basic_algebra.py @@ -29,5 +29,5 @@ def basicAlgebraFunc(maxVariable=10, style='raw'): return problem, solution -basic_algebra = Generator("Basic Algebra", 11, "ax + b = c", "d", +basic_algebra = Generator("Basic Algebra", 11, basicAlgebraFunc, ["maxVariable=10"]) diff --git a/mathgenerator/funcs/algebra/combine_like_terms.py b/mathgenerator/funcs/algebra/combine_like_terms.py index ae3cf34..8e80384 100644 --- a/mathgenerator/funcs/algebra/combine_like_terms.py +++ b/mathgenerator/funcs/algebra/combine_like_terms.py @@ -41,5 +41,4 @@ def combineTerms(string): return final_string -combine_like_terms = Generator("Combine Like terms", 105, "nx^m+lx^k+bx^m", - "(n+b)x^m+lx^k", likeTermCombineFunc, ["maxCoef=10", "maxExp=20", "maxTerms=10"]) +combine_like_terms = Generator("Combine Like terms", 105,likeTermCombineFunc, ["maxCoef=10", "maxExp=20", "maxTerms=10"]) diff --git a/mathgenerator/funcs/algebra/complex_quadratic.py b/mathgenerator/funcs/algebra/complex_quadratic.py index 5d3ddd2..2d2435c 100644 --- a/mathgenerator/funcs/algebra/complex_quadratic.py +++ b/mathgenerator/funcs/algebra/complex_quadratic.py @@ -70,7 +70,5 @@ def complexQuadraticFunc(prob_type=0, max_range=10): 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, ["prob_type=0", "max_range=10"]) diff --git a/mathgenerator/funcs/algebra/compound_interest.py b/mathgenerator/funcs/algebra/compound_interest.py index ac2035c..4946349 100644 --- a/mathgenerator/funcs/algebra/compound_interest.py +++ b/mathgenerator/funcs/algebra/compound_interest.py @@ -15,7 +15,5 @@ def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): compound_interest = Generator( "Compound Interest", 78, - "Compound interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", - "d dollars", compoundInterestFunc, ["maxPrinciple=10000", "maxRate=10", "maxTime=10"]) diff --git a/mathgenerator/funcs/algebra/distance_two_points.py b/mathgenerator/funcs/algebra/distance_two_points.py index 1e5f0d2..6a6a461 100644 --- a/mathgenerator/funcs/algebra/distance_two_points.py +++ b/mathgenerator/funcs/algebra/distance_two_points.py @@ -16,6 +16,5 @@ def distanceTwoPointsFunc(maxValXY=20, minValXY=-20): distance_two_points = Generator( "Distance between 2 points", 24, - "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc, ["maxValXY=20", "minValXY=-20"]) diff --git a/mathgenerator/funcs/algebra/expanding.py b/mathgenerator/funcs/algebra/expanding.py index c163c74..8e72a83 100644 --- a/mathgenerator/funcs/algebra/expanding.py +++ b/mathgenerator/funcs/algebra/expanding.py @@ -44,6 +44,5 @@ def expandingFunc(range_x1=10, range_x2=10, range_a=10, range_b=10): return problem, solution -expanding = Generator("Expanding Factored Binomial", 111, "(a*x-x1)(b*x-x2)", - "a*b*x^2+(b*x1+a*x2)*x+x1*x2", expandingFunc, +expanding = Generator("Expanding Factored Binomial", 111, expandingFunc, ["range_x1=10", "range_x2=10", "range_a=10", "range_b=10"]) diff --git a/mathgenerator/funcs/algebra/factoring.py b/mathgenerator/funcs/algebra/factoring.py index f912121..26f87b3 100644 --- a/mathgenerator/funcs/algebra/factoring.py +++ b/mathgenerator/funcs/algebra/factoring.py @@ -29,6 +29,5 @@ def factoringFunc(range_x1=10, range_x2=10): return problem, solution -factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", - "(x-x1)(x-x2)", factoringFunc, +factoring = Generator("Factoring Quadratic", 21, factoringFunc, ["range_x1=10", "range_x2=10"]) diff --git a/mathgenerator/funcs/algebra/int_matrix_22_determinant.py b/mathgenerator/funcs/algebra/int_matrix_22_determinant.py index edafb9f..e387986 100644 --- a/mathgenerator/funcs/algebra/int_matrix_22_determinant.py +++ b/mathgenerator/funcs/algebra/int_matrix_22_determinant.py @@ -14,6 +14,5 @@ def determinantToMatrix22(maxMatrixVal=100): int_matrix_22_determinant = Generator("Determinant to 2x2 Matrix", 77, - "Det([[a,b],[c,d]]) =", " a * d - b * c", determinantToMatrix22, ["maxMatrixVal=100"]) diff --git a/mathgenerator/funcs/algebra/intersection_of_two_lines.py b/mathgenerator/funcs/algebra/intersection_of_two_lines.py index 7fbea24..ebc5c1a 100644 --- a/mathgenerator/funcs/algebra/intersection_of_two_lines.py +++ b/mathgenerator/funcs/algebra/intersection_of_two_lines.py @@ -69,7 +69,5 @@ def intersectionOfTwoLinesFunc(minM=-10, intersection_of_two_lines = Generator( - "Intersection of Two Lines", 41, - "Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", - "(x, y)", intersectionOfTwoLinesFunc, + "Intersection of Two Lines", 41, intersectionOfTwoLinesFunc, ["minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1", "maxDenominator=6"]) diff --git a/mathgenerator/funcs/algebra/invert_matrix.py b/mathgenerator/funcs/algebra/invert_matrix.py index dffaa14..2a38eab 100644 --- a/mathgenerator/funcs/algebra/invert_matrix.py +++ b/mathgenerator/funcs/algebra/invert_matrix.py @@ -79,6 +79,5 @@ def matrixInversion(SquareMatrixDimension=3, invert_matrix = Generator("Inverse of a Matrix", 74, - "Inverse of a matrix A is", "A^(-1)", matrixInversion, ["SquareMatrixDimension=3", "MaxMatrixElement=99", "OnlyIntegerElementsInInvertedMatrix=False"]) diff --git a/mathgenerator/funcs/algebra/linear_equations.py b/mathgenerator/funcs/algebra/linear_equations.py index 43a49df..5259364 100644 --- a/mathgenerator/funcs/algebra/linear_equations.py +++ b/mathgenerator/funcs/algebra/linear_equations.py @@ -30,6 +30,5 @@ def linearEquationsFunc(n=2, varRange=20, coeffRange=20): return problem, solution -linear_equations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", - "x=-20 & y=12", linearEquationsFunc, +linear_equations = Generator("Linear Equations", 26, linearEquationsFunc, ["n=2", "varRange=20", "coeffRange=20"]) diff --git a/mathgenerator/funcs/algebra/log.py b/mathgenerator/funcs/algebra/log.py index 88522e1..9d6c1d1 100644 --- a/mathgenerator/funcs/algebra/log.py +++ b/mathgenerator/funcs/algebra/log.py @@ -17,5 +17,5 @@ def logFunc(maxBase=3, maxVal=8, style='raw'): return problem, solution -log = Generator("Logarithm", 12, "log2(8)", "3", logFunc, +log = Generator("Logarithm", 12, logFunc, ["maxBase=3", "maxVal=8"]) diff --git a/mathgenerator/funcs/algebra/matrix_multiplication.py b/mathgenerator/funcs/algebra/matrix_multiplication.py index dcdcf31..250aab8 100644 --- a/mathgenerator/funcs/algebra/matrix_multiplication.py +++ b/mathgenerator/funcs/algebra/matrix_multiplication.py @@ -54,6 +54,5 @@ def matrixMultiplicationFuncHelper(inp): matrix_multiplication = Generator("Multiplication of two matrices", 46, - "Multiply two matrices A and B", "C", matrixMultiplicationFunc, ["maxVal=100", "max_dim=10"]) diff --git a/mathgenerator/funcs/algebra/midpoint_of_two_points.py b/mathgenerator/funcs/algebra/midpoint_of_two_points.py index 577a33b..208ae63 100644 --- a/mathgenerator/funcs/algebra/midpoint_of_two_points.py +++ b/mathgenerator/funcs/algebra/midpoint_of_two_points.py @@ -13,7 +13,5 @@ def MidPointOfTwoPointFunc(maxValue=20): midPoint_of_two_points = Generator("Midpoint of the two point", 20, - "((X1,Y1),(X2,Y2))=", - "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc, ["maxValue=20"]) diff --git a/mathgenerator/funcs/algebra/multiply_complex_numbers.py b/mathgenerator/funcs/algebra/multiply_complex_numbers.py index 9592d17..51e3bd9 100644 --- a/mathgenerator/funcs/algebra/multiply_complex_numbers.py +++ b/mathgenerator/funcs/algebra/multiply_complex_numbers.py @@ -13,6 +13,5 @@ def multiplyComplexNumbersFunc(minRealImaginaryNum=-20, multiply_complex_numbers = Generator("Multiplication of 2 complex numbers", 65, - "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc, ["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"]) diff --git a/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py b/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py index 5fecda2..4cbef89 100644 --- a/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py +++ b/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py @@ -26,7 +26,5 @@ def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100, style='raw'): multiply_int_to_22_matrix = Generator("Integer Multiplication with 2x2 Matrix", - 17, "k * [[a,b],[c,d]]=", - "[[k*a,k*b],[k*c,k*d]]", - multiplyIntToMatrix22, + 17, multiplyIntToMatrix22, ["maxMatrixVal=10", "maxRes=100"]) diff --git a/mathgenerator/funcs/algebra/quadratic_equation.py b/mathgenerator/funcs/algebra/quadratic_equation.py index 5972647..6fb28f3 100644 --- a/mathgenerator/funcs/algebra/quadratic_equation.py +++ b/mathgenerator/funcs/algebra/quadratic_equation.py @@ -19,6 +19,5 @@ def quadraticEquation(maxVal=100): quadratic_equation = Generator( "Quadratic Equation", 50, - "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation, ["maxVal=100"]) diff --git a/mathgenerator/funcs/algebra/simple_interest.py b/mathgenerator/funcs/algebra/simple_interest.py index 3d61990..455fb75 100644 --- a/mathgenerator/funcs/algebra/simple_interest.py +++ b/mathgenerator/funcs/algebra/simple_interest.py @@ -16,7 +16,5 @@ def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): simple_interest = Generator( - "Simple Interest", 45, - "Simple interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", - "d dollars", simpleInterestFunc, + "Simple Interest", 45, simpleInterestFunc, ["maxPrinciple=10000", "maxRate=10", "maxTime=10"]) diff --git a/mathgenerator/funcs/algebra/system_of_equations.py b/mathgenerator/funcs/algebra/system_of_equations.py index 9e2cd4e..9e10167 100644 --- a/mathgenerator/funcs/algebra/system_of_equations.py +++ b/mathgenerator/funcs/algebra/system_of_equations.py @@ -48,6 +48,5 @@ def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10): system_of_equations = Generator("Solve a System of Equations in R^2", 23, - "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc, ["range_x=10", "range_y=10", "coeff_mult_range=10"]) diff --git a/mathgenerator/funcs/algebra/vector_cross.py b/mathgenerator/funcs/algebra/vector_cross.py index a1ce795..78edf73 100644 --- a/mathgenerator/funcs/algebra/vector_cross.py +++ b/mathgenerator/funcs/algebra/vector_cross.py @@ -14,6 +14,6 @@ def vectorCrossFunc(minVal=-20, maxVal=20): return problem, solution -vector_cross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", +vector_cross = Generator("Cross Product of 2 Vectors", 43, vectorCrossFunc, ["minVal=-20", "maxVal=20"]) diff --git a/mathgenerator/funcs/algebra/vector_dot.py b/mathgenerator/funcs/algebra/vector_dot.py index f1c182e..a4f62d9 100644 --- a/mathgenerator/funcs/algebra/vector_dot.py +++ b/mathgenerator/funcs/algebra/vector_dot.py @@ -11,6 +11,6 @@ def vectorDotFunc(minVal=-20, maxVal=20): return problem, solution -vector_dot = Generator("Dot Product of 2 Vectors", 72, "a . b = ", "c", +vector_dot = Generator("Dot Product of 2 Vectors", 72, vectorDotFunc, ["minVal=-20", "maxVal=20"]) diff --git a/mathgenerator/funcs/basic_math/absolute_difference.py b/mathgenerator/funcs/basic_math/absolute_difference.py index 52b245c..d5cd83f 100644 --- a/mathgenerator/funcs/basic_math/absolute_difference.py +++ b/mathgenerator/funcs/basic_math/absolute_difference.py @@ -17,6 +17,5 @@ def absoluteDifferenceFunc(maxA=100, maxB=100, style='raw'): absolute_difference = Generator( "Absolute difference between two numbers", 71, - "Absolute difference betweeen two numbers a and b =", "|a-b|", absoluteDifferenceFunc, ["maxA=100", "maxB=100"]) diff --git a/mathgenerator/funcs/basic_math/addition.py b/mathgenerator/funcs/basic_math/addition.py index 51c6075..afb2d88 100644 --- a/mathgenerator/funcs/basic_math/addition.py +++ b/mathgenerator/funcs/basic_math/addition.py @@ -1,7 +1,7 @@ from .__init__ import * -def addition_func(maxSum=99, maxAddend=50, style='raw'): +def main(maxSum=99, maxAddend=50, style='raw'): if maxAddend > maxSum: maxAddend = maxSum a = random.randint(0, maxAddend) @@ -19,5 +19,4 @@ def addition_func(maxSum=99, maxAddend=50, style='raw'): return problem, solution -addition = Generator("Addition", 0, "a+b=", "c", addition_func, - ["maxSum=99", "maxAddend=50"]) +addition = Generator("Addition", 0, main, ["maxSum=99", "maxAddend=50"]) diff --git a/mathgenerator/funcs/basic_math/compare_fractions.py b/mathgenerator/funcs/basic_math/compare_fractions.py index 806e8ff..95195ed 100644 --- a/mathgenerator/funcs/basic_math/compare_fractions.py +++ b/mathgenerator/funcs/basic_math/compare_fractions.py @@ -31,6 +31,5 @@ def compareFractionsFunc(maxVal=10, style='raw'): compare_fractions = Generator( "Compare Fractions", 44, - "Which symbol represents the comparison between a/b and c/d?", ">//=", - surdsComparisonFunc, +surds_comparison = Generator("Comparing surds", 55, surdsComparisonFunc, ["maxValue=100", "maxRoot=10"]) diff --git a/mathgenerator/funcs/statistics/combinations.py b/mathgenerator/funcs/statistics/combinations.py index ac31861..1498dd5 100644 --- a/mathgenerator/funcs/statistics/combinations.py +++ b/mathgenerator/funcs/statistics/combinations.py @@ -20,7 +20,5 @@ def combinationsFunc(maxlength=20): combinations = Generator( - "Combinations of Objects", 30, - "Combinations available for picking 4 objects at a time from 6 distinct objects =", - " 15", combinationsFunc, + "Combinations of Objects", 30, combinationsFunc, ["maxlength=20"]) diff --git a/mathgenerator/funcs/statistics/conditional_probability.py b/mathgenerator/funcs/statistics/conditional_probability.py index 42870f5..f53f628 100644 --- a/mathgenerator/funcs/statistics/conditional_probability.py +++ b/mathgenerator/funcs/statistics/conditional_probability.py @@ -26,5 +26,5 @@ def conditionalProbFunc(): conditional_probability = Generator("Conditional Probability", - 107, "P(A|+)=", "c", conditionalProbFunc, + 107, conditionalProbFunc, [""]) diff --git a/mathgenerator/funcs/statistics/confidence_interval.py b/mathgenerator/funcs/statistics/confidence_interval.py index 8efee86..32a667d 100644 --- a/mathgenerator/funcs/statistics/confidence_interval.py +++ b/mathgenerator/funcs/statistics/confidence_interval.py @@ -34,6 +34,5 @@ def confidenceIntervalFunc(): confidence_interval = Generator("Confidence interval For sample S", 54, - "With X% confidence", "is (A,B)", confidenceIntervalFunc, [""]) diff --git a/mathgenerator/funcs/statistics/data_summary.py b/mathgenerator/funcs/statistics/data_summary.py index 7c59a6b..28b96e6 100644 --- a/mathgenerator/funcs/statistics/data_summary.py +++ b/mathgenerator/funcs/statistics/data_summary.py @@ -25,6 +25,5 @@ def dataSummaryFunc(number_values=15, minval=5, maxval=50): return problem, solution -data_summary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", - "Mean:a+b+c/3,Std,Var", dataSummaryFunc, +data_summary = Generator("Mean,Standard Deviation,Variance", 59, dataSummaryFunc, ["number_values=15", "minval=5", "maxval=50"]) diff --git a/mathgenerator/funcs/statistics/dice_sum_probability.py b/mathgenerator/funcs/statistics/dice_sum_probability.py index 6edc18f..e22c3f1 100644 --- a/mathgenerator/funcs/statistics/dice_sum_probability.py +++ b/mathgenerator/funcs/statistics/dice_sum_probability.py @@ -28,6 +28,5 @@ def DiceSumProbFunc(maxDice=3): dice_sum_probability = Generator( "Probability of a certain sum appearing on faces of dice", 52, - "If n dices are rolled then probabilty of getting sum of x is =", "z", DiceSumProbFunc, ["maxDice=3"]) diff --git a/mathgenerator/funcs/statistics/mean_median.py b/mathgenerator/funcs/statistics/mean_median.py index c5e4273..c1f0760 100644 --- a/mathgenerator/funcs/statistics/mean_median.py +++ b/mathgenerator/funcs/statistics/mean_median.py @@ -15,7 +15,5 @@ def meanMedianFunc(maxlen=10): return problem, solution -mean_median = Generator("Mean and Median", 76, - "Mean and median of given set of numbers", - "Mean, Median", meanMedianFunc, +mean_median = Generator("Mean and Median", 76, meanMedianFunc, ["maxlen=10"]) diff --git a/mathgenerator/funcs/statistics/permutation.py b/mathgenerator/funcs/statistics/permutation.py index 97462b9..287b2a3 100644 --- a/mathgenerator/funcs/statistics/permutation.py +++ b/mathgenerator/funcs/statistics/permutation.py @@ -14,7 +14,5 @@ def permutationFunc(maxlength=20): permutation = Generator( - "Permutations", 42, - "Total permutations of 4 objects at a time from 10 objects is", "5040", - permutationFunc, + "Permutations", 42, permutationFunc, ["maxlength=20"])