diff --git a/README.md b/README.md index 966f13b..94f68c3 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,19 @@ problem, solution = mathgen.addition() ``` ## List of Generators -| Id | Skill | Example problem | Example Solution | Function Name | Status | -|------|----------------------------|-----------------|-------------------|--------------------------|-------------| -| 0 | Addition | 1+5= | 6 | addition | Complete | -| 1 | Subtraction | 9-4= | 5 | subtraction | Complete | -| 2 | Multiplication | 4*6= | 24 | multiplication | Complete | -| 3 | Division | 4/2= | 2 | division | Complete | -| 4 | Binary Complement 1s | 1010= | 0101 | binaryComplement1s | Complete | -| 5 | Modulo Division | 10%3= | 1 | moduloDivision | Complete | -| 6 | Square Root | sqrt(a)= | b | squareRootFunction | Complete | -| 7 | Power Rule Differentiation | nx^m | (n*m)x^(m-1) | powerRuleDifferentiation | Complete | +| Id | Skill | Example problem | Example Solution | Function Name | +|------|-----------------------------------|--------------------|-------------------|--------------------------| +| 0 | Addition | 1+5= | 6 | addition | +| 1 | Subtraction | 9-4= | 5 | subtraction | +| 2 | Multiplication | 4*6= | 24 | multiplication | +| 3 | Division | 4/3= | 1.33333333 | division | +| 4 | Binary Complement 1s | 1010= | 0101 | binaryComplement1s | +| 5 | Modulo Division | 10%3= | 1 | moduloDivision | +| 6 | Square Root | sqrt(25)= | 5 | squareRootFunction | +| 7 | Power Rule Differentiation | 4x^3 | 12x^2 | powerRuleDifferentiation | +| 8 | Square | 4^2 | 16 | square | +| 9 | LCM (Least Common Multiple) | LCM of 14 and 9 = | 126 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 18 and 18 = | 18 | gcd | +| 11 | Basic Algebra | 9x + 7 = 10 | 1/3 | basicAlgebra | +| 12 | Logarithm | log3(3) | 1 | log | +| 13 | Easy Division | 270/15 = | 18 | intDivision | diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 496d9ac..e2c486f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -77,7 +77,7 @@ def moduloFunc(maxRes = 99, maxModulo= 99): solution = str(c) return problem, solution -def squareRootFunction(minNo = 1, maxNo = 12): +def squareRootFunc(minNo = 1, maxNo = 12): b = random.randint(minNo, maxNo) a = b*b problem = "sqrt(" + str(a) + ")=" @@ -163,16 +163,16 @@ def divisionToIntFunc(maxA=25, maxB=25): solution=int(divisor/dividend) return problem,solution -def DecimalToBinary(max_dec=99): +def DecimalToBinaryFunc(max_dec=99): a = random.randint(1, max_dec) b = bin(a).replace("0b", "") problem = "Binary of "+str(a)+"=" solution = str(b) return problem, solution -def BinaryToDecimal(max_dig=10): +def BinaryToDecimalFunc(max_dig=10): problem='' - for i in range(random.randint(1,max_dig)): + for i in range(random.randint(1,max_dig)): temp = str(random.randint(0, 1)) problem += temp @@ -211,17 +211,16 @@ addition = Generator("Addition", 0, "a+b=", "c", additionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc) multiplication = Generator("Multiplication", 2, "a*b=", "c", multiplicationFunc) division = Generator("Division", 3, "a/b=", "c", divisionFunc) -binaryComplement1s = Generator("binary_complement_1s", 4, "1010=", "0101", binaryComplement1sFunc) -moduloDivision = Generator("Modulo_Division", 5, "a%b=", "c", moduloFunc) -squareRoot = Generator("Square_Root", 6, "sqrt(a)=", "b", squareRootFunction) -powerRuleDifferentiation = Generator("Power_Rule_Differentiation", 7, "nx^m=", "(n*m)x^(m-1)", powerRuleDifferentiationFunc) +binaryComplement1s = Generator("Binary Complement 1s", 4, "1010=", "0101", binaryComplement1sFunc) +moduloDivision = Generator("Modulo Division", 5, "a%b=", "c", moduloFunc) +squareRoot = Generator("Square Root", 6, "sqrt(a)=", "b", squareRootFunc) +powerRuleDifferentiation = Generator("Power Rule Differentiation", 7, "nx^m=", "(n*m)x^(m-1)", powerRuleDifferentiationFunc) square = Generator("Square", 8,"a^2", "b", squareFunc) -lcm = Generator("Lcm_generator", 9, "LCM of a and b = ", "c", lcmFunc) -gcd = Generator("Gcd_generator", 10, "GCD of a and b = ", "c", gcdFunc) -basicAlgebra = Generator("Basic_Algebra", 11, "ax + b = c", "d", basicAlgebraFunc) +lcm = Generator("LCM (Least Common Multiple)", 9, "LCM of a and b = ", "c", lcmFunc) +gcd = Generator("GCD (Greatest Common Denominator)", 10, "GCD of a and b = ", "c", gcdFunc) +basicAlgebra = Generator("Basic Algebra", 11, "ax + b = c", "d", basicAlgebraFunc) log = Generator("Logarithm", 12, "log2(8)", "3", logFunc) -intdivision = Generator("Easy Divisio", 13,"a/b=","c",divisionToIntFunc) - -decimaltobinary = Generator("Decimal to Binary",15,"Binary of a=","b",DecimalToBinary) -binarytodecimal = Generator("Binary to Decimal",16,"Decimal of a=","b",BinaryToDecimal) -fractionDivision = Generator("Fraction Division", 17, "(a/b)/(c/d)=", "x/y", divideFractionsFunc) +intDivision = Generator("Easy Division", 13,"a/b=","c",divisionToIntFunc) +decimalToBinary = Generator("Decimal to Binary",14,"Binary of a=","b",DecimalToBinaryFunc) +binaryToDecimal = Generator("Binary to Decimal",15,"Decimal of a=","b",BinaryToDecimalFunc) +fractionDivision = Generator("Fraction Division", 16, "(a/b)/(c/d)=", "x/y", divideFractionsFunc)