From c4f21014d023dc926f40260fc96669f35d27947f Mon Sep 17 00:00:00 2001 From: razinc Date: Fri, 16 Oct 2020 22:43:40 +0800 Subject: [PATCH 01/79] multiply complex numbers issue number #75 --- mathgenerator/mathgen.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 94631b7..a2b81fc 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -339,6 +339,13 @@ def distanceTwoPointsFunc(maxValXY = 20, minValXY=-20): problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})" return problem, solution +def multiplyComplexNumbersFunc(minRealImaginaryNum = -20, maxRealImaginaryNum = 20): + num1 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum)) + num2 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum)) + problem = f"{num1} * {num2} = " + solution = num1 * num2 + return problem, solution + # || Class Instances #Format is: @@ -368,4 +375,5 @@ factoring = Generator("Subtraction", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", fa thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) -distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) \ No newline at end of file +distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) +ComplexNumMultiply = Generator("Multiplication of 2 complex numbers", 25, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) From bac53548085b8fac4375ca93fb614f74489eaa5c Mon Sep 17 00:00:00 2001 From: Shiven Tripathi <58358532+ShivenTripathi@users.noreply.github.com> Date: Fri, 16 Oct 2020 23:56:22 +0530 Subject: [PATCH 02/79] add problem to find roots of quadratic equation --- mathgenerator/mathgen.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 917fccc..90cd1ac 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -531,6 +531,15 @@ def commonFactorsFunc(maxVal=100): problem = f"Common Factors of {a} and {b} = " solution = arr return problem, solution + +def quadraticEquation(maxVal=100): + a = random.randint(1,maxVal) + c = random.randint(1,maxVal) + b = random.randint(4*a*c,4*maxVal*maxVal) + + problem = "Zeros of the Quadratic Equation {a}x^2+{b}x+{c}=0".format(a,b,c) + solution = str[(-b+sqrt(b^2-4*a*c))/2*a,(-b-sqrt(b^2-4*a*c))/2*a] + return problem,solution # || Class Instances #Format is: @@ -577,3 +586,4 @@ volumeCylinderGen = Generator("Volume of cylinder", 37, "Volume of cylinder with surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is","c units^2", surfaceAreaCone) volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is","c units^3", volumeCone) commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc) +quadraticEquationSolve = Generator("Quadratic Equation", 41, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) From 61ba85f4b0fcca1872843f90f1b45f2cfa08ad5b Mon Sep 17 00:00:00 2001 From: lukew3 Date: Fri, 16 Oct 2020 20:53:33 -0400 Subject: [PATCH 03/79] makeReadme.py added and generators with newloine chars fixed --- README.md | 69 +++++++++++++++++++++++++++++----------- makeReadme.py | 25 +++++++++++++++ mathgenerator/mathgen.py | 65 +++++++++++++++++++++++++------------ 3 files changed, 121 insertions(+), 38 deletions(-) create mode 100644 makeReadme.py diff --git a/README.md b/README.md index 45ffcec..dfc7d41 100644 --- a/README.md +++ b/README.md @@ -30,21 +30,54 @@ problem, solution = mathgen.genById(0) | 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 | -| 14 | Decimal to Binary | Binary of a= | b | decimalToBinary | -| 15 | Binary to Decimal | Decimal of a= | b | binaryToDecimal | -| 16 | Fraction Division | (a/b)/(c/d)= | x/y | fractionDivision | -| 17 | Int 2x2 Matrix Multiplication | k * [[a,b],[c,d]]= | [[k*a,k*b],[k*c,k*d]] | intMatrix22Multiplication| +| 0 | Addition | 29+33= | 62 | addition | +| 1 | Subtraction | 62-7= | 55 | subtraction | +| 2 | Multiplication | 93*1= | 93 | multiplication | +| 3 | Division | 59/47= | 1.2553191489361701 | division | +| 4 | Binary Complement 1s | 001110000 | 110001111 | binaryComplement1s | +| 5 | Modulo Division | 89%34= | 21 | moduloDivision | +| 6 | Square Root | sqrt(16)= | 4 | squareRoot | +| 7 | Power Rule Differentiation | 4x^3 | 12x^2 | powerRuleDifferentiation | +| 8 | Square | 12^2= | 144 | square | +| 9 | LCM (Least Common Multiple) | LCM of 10 and 1 = | 10 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 12 and 5 = | 1 | gcd | +| 11 | Basic Algebra | 8x + 7 = 10 | 3/8 | basicAlgebra | +| 12 | Logarithm | log3(729) | 6 | log | +| 13 | Easy Division | 378/21 = | 18 | intDivision | +| 14 | Decimal to Binary | Binary of 4= | 100 | decimalToBinary | +| 15 | Binary to Decimal | 10011 | 19 | binaryToDecimal | +| 16 | Fraction Division | (1/2)/(4/3) | 3/8 | fractionDivision | +| 17 | Integer Multiplication with 2x2 Matrix | 2 * [[0, 7], [7, 7]] = | [[0,14],[14,14]] | intMatrix22Multiplication | +| 18 | Area of Triangle | Area of triangle with side lengths: 9 14 15 = | 61.644140029689765 | areaOfTriangle | +| 19 | Triangle exists check | Does triangle with sides 33, 6 and 43 exist? | No | doesTriangleExist | +| 20 | Midpoint of the two point | (-15,-10),(-5,2)= | (-10.0,-4.0) | midPointOfTwoPoint | +| 21 | Factoring Quadratic | x^2-17x+72 | (x-9)(x-8) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 4 and 31 = | 145 | thirdAngleOfTriangle | +| 23 | Solve a System of Equations in R^2 | 4x - 8y = 48, 3x - 8y = 40 | x = 8, y = -2 | systemOfEquations | +| 24 | Distance between 2 points | Find the distance between (-9, -20) and (18, -19) | sqrt(730) | distance2Point | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 18 and 13 = | 22.20 | pythagoreanTheorem | +| 26 | Linear Equations | -11x + -16y = -302 +1x + 20y = 250 | x = 10, y = 12 | linearEquations | +| 27 | Prime Factorisation | Find prime factors of 55 | [5, 11] | primeFactors | +| 28 | Fraction Multiplication | (4/9)*(8/10) | 16/45 | fractionMultiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 15 sides | 156.0 | angleRegularPolygon | +| 30 | Combinations of Objects | Number of combinations from 13 objects picked 1 at a time | 13 | combinations | +| 31 | Factorial | 2! = | 2 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 13m is | 1014 m^2 | surfaceAreaCubeGen | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 5m, 3m, 7m is | 142 m^2 | surfaceAreaCuboidGen | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 15m and radius = 7m is | 967 m^2 | surfaceAreaCylinderGen | +| 35 | Volum of Cube | Volume of cube with side = 11m is | 1331 m^3 | volumeCubeGen | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 6m, 1m, 10m is | 60 m^3 | volumeCuboidGen | +| 37 | Volume of cylinder | Volume of cylinder with height = 26m and radius = 15m is | 18378 m^3 | volumeCylinderGen | +| 38 | Surface Area of cone | Surface area of cone with height = 46m and radius = 14m is | 2730 m^2 | surfaceAreaConeGen | +| 39 | Volume of cone | Volume of cone with height = 7m and radius = 11m is | 886 m^3 | volumeConeGen | +| 40 | Common Factors | Common Factors of 91 and 51 = | [1] | commonFactors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 6/4x + 5 and y = -7/2x + 3 | (-2/5, 22/5) | intersectionOfTwoLines | +| 42 | Permutations | Number of Permutations from 13 objects picked 4 at a time = | 17160 | permutations | +| 43 | Cross Product of 2 Vectors | [-14, 13, 20] X [-5, -18, 19] = | [607, 166, 317] | vectorCross | +| 44 | Compare Fractions | Which symbol represents the comparison between 8/3 and 6/7? | > | compareFractions | +| 45 | Simple Interest | Simple interest for a principle amount of 6128 dollars, 5% rate of interest and for a time period of 5 years is = | 1532.0 | simpleInterest | +| 46 | Multiplication of two matrices | Multiply [[-20, -14, -88, -62, 39, 94, 21, 75, 26], [89, -67, -80, -60, 32, -23, -79, 11, -69], [13, -75, -66, 3, 67, -79, -49, 6, 36], [-44, -84, 68, -27, -86, -95, -71, -77, -62], [45, 58, 89, 82, 30, -83, -23, 51, 95], [11, 46, 100, -15, 60, -34, 85, 50, -44], [93, -100, -62, 63, -73, -64, 90, -15, 23], [-8, 91, -22, 53, -42, 25, 32, -26, 31], [-60, 90, 75, -42, 19, 33, -30, 74, 13]] and [[-80, 54, -39, 37, -99], [31, -28, -31, 64, 73], [-21, -34, -28, -21, -76], [-94, 55, 66, 0, 17], [-28, 25, -65, -74, 100], [76, 74, -96, -98, -5], [-90, -70, -66, -71, -35], [65, 49, -100, 72, -23], [-95, -97, -31, -84, -86]] | [[15409, 6508, -21665, -10161, 5326], [9859, 17962, 3267, 12768, 3119], [-8761, 1272, 8611, 738, 3881], [4489, -5790, 29652, 11947, -5940], [-22167, -8208, -1142, 6747, -10714], [-4628, -5167, -15527, 1404, 243], [-29240, -2432, 11103, 615, -22487], [-5498, -5038, 1462, -100, 2495], [18214, -3238, -15548, 3691, 6061]] | matrixMultiplication | +| 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | +| 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | diff --git a/makeReadme.py b/makeReadme.py new file mode 100644 index 0000000..7ca8f2c --- /dev/null +++ b/makeReadme.py @@ -0,0 +1,25 @@ +#To use, paste at bottom of mathgen.py code, change line variable and remove all table rows in README.md except for the top 2 and run mathgen.py + +wList = getGenList() +allRows = [] +f=open('mathgen.py') +lines=f.readlines() +line = 720 #This has to be changed depending on which line the first generator appears on +for item in wList: + myGen = item[2] + prob, sol = myGen() + prob = str(prob).rstrip("\n") + sol = str(sol).rstrip("\n") + instName = lines[line] + def_name = instName[:instName.find('=')].strip() + row = [myGen.id, myGen.title, prob, sol, def_name] + line+=1 + allRows.append(row) + +g=open('../README.md', "a") +for row in allRows: + tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n" + g.write(tableLine) +g.close() + +print("New README.md table generated") diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..d00ea30 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -224,7 +224,7 @@ def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): c = random.randint(1, maxC) s = (a+b+c)/2 area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 - problem = "Area of triangle with side lengths: "+ str(a) +" "+ str(b) +" "+ str(c) + " = " + problem = "Area of triangle with side lengths: "+ str(a) +" "+ str(b) +" "+ str(c) + " = " solution = area return problem, solution @@ -234,7 +234,7 @@ def isTriangleValidFunc(maxSideLength = 50): sideC = random.randint(1, maxSideLength) sideSums = [sideA + sideB, sideB + sideC, sideC + sideA] sides = [sideC, sideA, sideB] - exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) + exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" if exists: solution = "Yes" @@ -267,7 +267,7 @@ def factoringFunc(range_x1 = 10, range_x2 = 10): if (b == "+1"): b = "+" - + if (b == ""): problem = f"x^2{c}" else: @@ -277,7 +277,7 @@ def factoringFunc(range_x1 = 10, range_x2 = 10): x2 = intParser(x2) solution = f"(x{x1})(x{x2})" return problem, solution - + def thirdAngleOfTriangleFunc(maxAngle=89): angle1 = random.randint(1, maxAngle) angle2 = random.randint(1, maxAngle) @@ -362,13 +362,13 @@ def linearEquationsFunc(n = 2, varRange = 20, coeffRange = 20): for _ in range(n): coeff = [ random.randint(-coeffRange, coeffRange) for i in range(n) ] res = sum([ coeff[i] * soln[i] for i in range(n)]) - + prob = ["{}{}".format(coeff[i], vars[i]) if coeff[i] != 0 else "" for i in range(n)] while "" in prob: prob.remove("") prob = " + ".join(prob) + " = " + str(res) problem.append(prob) - + problem = "\n".join(problem) return problem, solution @@ -417,8 +417,8 @@ def regularPolygonAngleFunc(minVal = 3,maxVal = 20): problem = f"Find the angle of a regular polygon with {sideNum} sides" exteriorAngle = round((360/sideNum),2) solution = 180 - exteriorAngle - return problem, solution - + return problem, solution + def combinationsFunc(maxlength=20): def factorial(a): @@ -434,9 +434,9 @@ def combinationsFunc(maxlength=20): solution= int(factorial(a)/(factorial(b)*factorial(a-b))) problem= "Number of combinations from {} objects picked {} at a time ".format(a,b) - + return problem, solution - + def factorialFunc(maxInput = 6): a = random.randint(0, maxInput) n = a @@ -470,7 +470,7 @@ def surfaceAreaCuboid(maxSide = 20, unit = 'm'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) c = random.randint(1, maxSide) - + problem = f"Surface area of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" ans = 2 * (a*b + b*c + c*a) solution = f"{ans} {unit}^2" @@ -567,7 +567,7 @@ def intersectionOfTwoLinesFunc( else: x = f"{x.numerator}/{x.denominator}" return x - + m1 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) m2 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) b1 = random.randint(minB, maxB) @@ -625,7 +625,7 @@ def compareFractionsFunc(maxVal=10): solution="<" else: solution="=" - + problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?" return problem,solution @@ -648,7 +648,7 @@ def matrixMultiplicationFunc(maxVal=100): a.append([]) for c in range(n): a[r].append(random.randint(-maxVal,maxVal)) - + b=[] for r in range(n): b.append([]) @@ -666,8 +666,8 @@ def matrixMultiplicationFunc(maxVal=100): for t in range(n): temp+=a[r][t]*b[t][c] res[r].append(temp) - problem= f"Multiply \n{a_string}\n and \n\n{b_string}" #consider using a, b instead of a_string, b_string if the problem doesn't look right - solution= matrixMultiplicationFuncHelper(res) + problem= f"Multiply {a} and {b}" #consider using a, b instead of a_string, b_string if the problem doesn't look right + solution= res#matrixMultiplicationFuncHelper(res) return problem, solution def matrixMultiplicationFuncHelper(inp): @@ -703,7 +703,7 @@ def powerRuleIntegrationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): solution = solution + " + c" return problem, solution - + def fourthAngleOfQuadriFunc(maxAngle = 180): angle1 = random.randint(1, maxAngle) angle2 = random.randint(1, 240-angle1) @@ -741,8 +741,7 @@ doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with s midPointOfTwoPoint=Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPointFunc) factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) -systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", - systemOfEquationsFunc) +systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) #This has multiple variables whereas #23 has only x and y @@ -754,7 +753,7 @@ factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc) surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube with side a units is","b units^2", surfaceAreaCube) surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is","d units^2", surfaceAreaCuboid) surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is","c units^2", surfaceAreaCylinder) -volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is","b units^3", volumeCube) +volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is","b units^3", volumeCube) volumeCuboidGen = Generator("Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is","d units^3", volumeCuboid) volumeCylinderGen = Generator("Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is","c units^3", volumeCylinder) surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is","c units^2", surfaceAreaCone) @@ -769,3 +768,29 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) + +wList = getGenList() +#print(wList) +allRows = [] +f=open('mathgen.py') +lines=f.readlines() +line = 720 +for item in wList: + myGen = item[2] + prob, sol = myGen() + prob = str(prob).rstrip("\n") + sol = str(sol).rstrip("\n") + instName = lines[line] + def_name = instName[:instName.find('=')].strip() + print(def_name) + row = [myGen.id, myGen.title, prob, sol, def_name] + print(row) + line+=1 + allRows.append(row) + +g=open('../README.md', "a") +for row in allRows: + tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n" + g.write(tableLine) + #print(tableLine) +g.close() From 1572bd616c473906914c2e72f7fcff6b9971600f Mon Sep 17 00:00:00 2001 From: c0d3nh4ck <50226641+c0d3nh4ck@users.noreply.github.com> Date: Sat, 17 Oct 2020 08:01:21 +0530 Subject: [PATCH 04/79] added HCF function --- mathgenerator/mathgen.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..660a961 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,17 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution + +def hcfFunc(maxVal=20): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + x, y = a, b + while(y): + x, y = y, x % y + problem = f"HCF of {a} and {b} = " + solution = str(x) + return problem, solution + # || Class Instances #Format is: @@ -769,3 +780,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +hcf = Generator("HCF (Highest Common Factor)", 50, "HCF of a and b = ", "c", hcfFunc) From dedbb7027e1f53cad75608991fdd6d50de75589d Mon Sep 17 00:00:00 2001 From: Ritu Raj <68614399+Ritu1611@users.noreply.github.com> Date: Sat, 17 Oct 2020 11:47:30 +0530 Subject: [PATCH 05/79] Probability Function for Sum on dice faces --- mathgenerator/mathgen.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..866a2f2 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,27 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution +def DiceSumProbFunc(maxDice=3): + a = random.randint(1,maxDice) + b = random.randint(a,6*a) + count=0 + for i in [1,2,3,4,5,6]: + if a==1: + if i==b: + count=count+1 + elif a==2: + for j in [1,2,3,4,5,6]: + if i+j==b: + count=count+1 + elif a==3: + for j in [1,2,3,4,5,6]: + for k in [1,2,3,4,5,6]: + if i+j+k==b: + count=count+1 + problem = "If {} dices rolled at the same time, Probability of getting a sum of {} =".format(a,b) + solution="{}/{}".format(count, 6**a) + return problem, solution + # || Class Instances #Format is: @@ -769,3 +790,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +DiceSumProbability=Generator("Probability of a certain sum appearing on faces of dice",50,"If n dices are rolled then probabilty of getting sum of x is", DiceSumProbFunc) From e3834b2c8951be2670dc6a8a3ea64c7eca81725a Mon Sep 17 00:00:00 2001 From: Ritu Raj <68614399+Ritu1611@users.noreply.github.com> Date: Sat, 17 Oct 2020 11:54:50 +0530 Subject: [PATCH 06/79] Update mathgen.py --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 866a2f2..a5164a1 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -790,4 +790,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) -DiceSumProbability=Generator("Probability of a certain sum appearing on faces of dice",50,"If n dices are rolled then probabilty of getting sum of x is", DiceSumProbFunc) +DiceSumProbability=Generator("Probability of a certain sum appearing on faces of dice",50,"If n dices are rolled then probabilty of getting sum of x is =","z", DiceSumProbFunc) From 91b42f8ab6287219c767ed38937db1508f853414 Mon Sep 17 00:00:00 2001 From: palmcm Date: Sat, 17 Oct 2020 13:38:19 +0700 Subject: [PATCH 07/79] Add exponentiation function --- mathgenerator/mathgen.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..0722c35 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,12 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution +def exponentiationFunc(maxBase = 20,maxExpo = 10): + base = random.randint(1, maxBase) + expo = random.randint(1, maxExpo) + problem = f"{base}^{expo} =" + solution = str(base ** expo) + return problem, solution # || Class Instances #Format is: @@ -769,3 +775,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +exponentiation = Generator("Exponentiation",50,"a^b = ","c",exponentiationFunc) \ No newline at end of file From efc3df0b275784b1cce4fa3e182b4f974317e427 Mon Sep 17 00:00:00 2001 From: Ritu Raj <68614399+Ritu1611@users.noreply.github.com> Date: Sat, 17 Oct 2020 13:22:26 +0530 Subject: [PATCH 08/79] Confidence Interval Problem Generator --- mathgenerator/mathgen.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..e7da9a6 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -713,6 +713,27 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" solution = angle4 return problem, solution +def confidenceIntervalFunc(): + n=random.randint(20,40) + j=random.randint(1,4) + lst=random.sample(range(200,300),n) + lst_per=[80 ,90, 95, 99] + lst_t = [1.282, 1.645, 1.960, 2.576] + mean=0 + sd=0 + for i in lst: + count= i + mean + mean=count + mean = mean/n + for i in lst: + x=(i-mean)**2+sd + sd=x + sd=sd/n + standard_error = lst_t[j]*math.sqrt(sd/n) + problem= 'The confidence interval for sample {} with {}% confidence is'.format([x for x in lst], lst_per[j]) + solution= '({}, {})'.format(mean+standard_error, mean-standard_error) + return problem, solution + # || Class Instances @@ -769,3 +790,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +ConfidenceInterval = Generator("Confidence interval For sample S", 51, "With X% confidence", "is (A,B)", confidenceIntervalFunc) From 6651379fb82862edd1b970fec65ddbebbd3c7549 Mon Sep 17 00:00:00 2001 From: MaxwellJpg <70202524+MaxwellJpg@users.noreply.github.com> Date: Sat, 17 Oct 2020 10:26:46 +0100 Subject: [PATCH 09/79] Update README.md correct row 26 of table --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index dfc7d41..3f3ab03 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,7 @@ problem, solution = mathgen.genById(0) | 23 | Solve a System of Equations in R^2 | 4x - 8y = 48, 3x - 8y = 40 | x = 8, y = -2 | systemOfEquations | | 24 | Distance between 2 points | Find the distance between (-9, -20) and (18, -19) | sqrt(730) | distance2Point | | 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 18 and 13 = | 22.20 | pythagoreanTheorem | -| 26 | Linear Equations | -11x + -16y = -302 -1x + 20y = 250 | x = 10, y = 12 | linearEquations | +| 26 | Linear Equations | -11x + -16y = -302 , 1x + 20y = 250 | x = 10, y = 12 | linearEquations | | 27 | Prime Factorisation | Find prime factors of 55 | [5, 11] | primeFactors | | 28 | Fraction Multiplication | (4/9)*(8/10) | 16/45 | fractionMultiplication | | 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 15 sides | 156.0 | angleRegularPolygon | From e2857e8f18aff94aee4fb02265842d6d075374d8 Mon Sep 17 00:00:00 2001 From: MaxwellJpg Date: Sat, 17 Oct 2020 12:26:10 +0100 Subject: [PATCH 10/79] correct int powerRuleIntegrationFunc --- mathgenerator/mathgen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..3c67452 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -699,7 +699,7 @@ def powerRuleIntegrationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): coefficient = random.randint(1, maxCoef) exponent = random.randint(1, maxExp) problem += str(coefficient) + "x^" + str(exponent) - solution += "("+str(coefficient) +"/"+str(exponent) +")x^" + str(exponent +1) + solution += "("+str(coefficient) +"/"+str(exponent + 1) +")x^" + str(exponent +1) solution = solution + " + c" return problem, solution @@ -767,5 +767,5 @@ compareFractions=Generator("Compare Fractions",44,"Which symbol represents the c simpleInterest = 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) matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) -powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) +powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m+1)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) From 7bbfec529ff49cdfb7b61f46067df81eb09cf399 Mon Sep 17 00:00:00 2001 From: ieshaan12 Date: Sat, 17 Oct 2020 17:24:23 +0530 Subject: [PATCH 11/79] Surds comparison --- README.md | 1 + mathgenerator/mathgen.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index dfc7d41..621b2a4 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,4 @@ problem, solution = mathgen.genById(0) | 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | | 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | +| 50 | Surd Comparison | 25^(1/3) _ 37^(1/2) | < | surdsComparisonGen | diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..fb435d2 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,20 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution +def surdsComparison(maxValue = 100, maxRoot = 10): + radicand1,radicand2 = tuple(random.sample(range(1,maxValue),2)) + degree1, degree2 = tuple(random.sample(range(1,maxRoot),2)) + problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})" + first = math.pow(radicand1, 1/degree1) + second = math.pow(radicand2, 1/degree2) + solution = "=" + if first > second: + solution = ">" + elif first < second: + solution = "<" + return problem, solution + + # || Class Instances #Format is: @@ -769,3 +783,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +surdsComparisonGen = Generator("Comparing surds", 50, "Fill in the blanks a^(1/b) _ c^(1/d)", "/=", surdsComparison) From b8a5741ecd424ce57bf76d23dd6380fb91f33020 Mon Sep 17 00:00:00 2001 From: vishnudk Date: Sat, 17 Oct 2020 17:31:20 +0530 Subject: [PATCH 12/79] add a --- mathgenerator/mathgen.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..0791512 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -713,6 +713,22 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" solution = angle4 return problem, solution +def createFibList(n): + l=[] + for i in range(n): + if i<2: + l.append(i) + else: + val = l[i-1]+l[i-2] + l.append(val) + return l + +def fibonacciSeriesFunc(minNo=1): + n = random.randint(minNo,20) + fibList=createFibList(n) + problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" + solution = fibList + return problem,solution # || Class Instances @@ -769,3 +785,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +fibonacciSeries = Generator("Fibonacci Series",50,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) \ No newline at end of file From 783f0ce953c3bc844341ca79f6a7bf2f2c9191b0 Mon Sep 17 00:00:00 2001 From: Dark Prince Date: Sat, 17 Oct 2020 17:42:43 +0530 Subject: [PATCH 13/79] Added Trigonometric Values Generator for Standard Angles in Degrees --- .../__pycache__/mathgen.cpython-37.pyc | Bin 19103 -> 29724 bytes mathgenerator/mathgen.py | 13 +++++++++++++ 2 files changed, 13 insertions(+) diff --git a/mathgenerator/__pycache__/mathgen.cpython-37.pyc b/mathgenerator/__pycache__/mathgen.cpython-37.pyc index 418e0a56baea2c94655d34c4eac76225870c1ea8..82bcec4b454f2a62c9cf0b2088c33baea54dfaef 100644 GIT binary patch delta 13355 zcmbO~m2u7sMm{HAUM>a(28R8|yW;=7^65RFs4|i2&4$MFh+4rU`(+|5l#_lVT|IQz?fp2QZJe!*1{OY zGl4P1E=4j$s)aF%cLHOIeTqzqYzt!)-vq`KhZOk~g%-vr{t1jJjwy;MN-d000uvZh zoKloiR9YCL1Sc@2IH#zlsI@Rg2~A*3aY@lk(Q09g5}v@A;+mq9qT9k4B{G3A#VtiI zMZbkHN^}BaihGJdieU?5lvw=)#uSefqZH#7#whU#j47TerYUAEj8PI37*o7b%u_5{ z7^5U7Fs68?Sf*IDFh)sDU`+8zu}-mRVT_WVz?kBjVw+;u!WbnpficA|#UaJ9g)vHY z0%MAQic^Yn3uBbr1jdwr6xS5D7RD&~35+R$DefsAEsRkL6Btv1QoK^?y;~Tg6elpI z1gH3>__Z)bDNSHZ2}$u!320%AQl7w=5}Fd264b&Nr80prB`hU4C8UKhN_7HbN_a|G zN_Y!nl-dNwl!%nbl&BWQDD?@9DUm7BDKRaKQ5q8%Q=(F0Q{q|}qckTlrbMU2rzEs6 zMrlo8Oo>TJOi5~CjMARKSf3J`lAMy#!WgA9fiWd6B{e0jg)vHZ0%J;iN_t903uBbt z1jdwvl+2W@7RD(335+R;DLE;*EsRkH6BtvHQu0#rTNtAZCorZYrxc_VwlGE+O<+t( zNhwMxZeffvp1_!rno^ol*1{NNGJ!EAEu}oAqJ=TaG^H}7s)ZrSY(hO_N_t97N^J{c zl=%e4l#GFND2oY8vU3DIF=D>C91jdDn3 zNtvAznldM4ZYpmxYm{R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xby?72`%NlxsgD? zD0CT%9I#OaAVH=gFHkUeL)d{JcHrbcISR&cAQ5J;P6VOJSR@S+hnmP#1Tq6mXfhTR zO!m(ePXJj})P$sn8C*mlnZZP>1rhEb!V^RUfQV2K5dk71K}0NwNB|MZAR-M!WP=D$0bW!LVl{$@ zW)RT|B0yDe(QFWF4v3fsA{K&(#SEMb3`I*p%vF<5=l6(!l6Vvka{XT9vpKuKlTmd( z0|P@8Z!$RMpb>XVAUQv`Ah9Ubttc_MBr`v+cya=#$YkAO{-8+=3=AAhEX;fY94s8H zTpUoy!^OeH&c(;Y&c(&W!zIkc!NtkN&c(?k!36?*T%26eTpV1wTwGinT;g1UT;gEW W{9Hm@vXc)Kt4zL7%r*H*u^0fiPjV#y diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..1306a95 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,18 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution +def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): + angle=random.choice(angles) + function=random.choice(functions) + + problem=f"What is {function}({angle})?\n" + expression='math.'+function+'(math.radians(angle))' + result_fraction_map={0.0:"0",0.5:"1/2",0.71:"1/√2",0.87:"√3/2",1.0:"1",0.58:"1/√3",1.73:"√3"} + + solution=result_fraction_map[round(eval(expression),2)] if round(eval(expression),2)<=99999 else "∞" #for handling the ∞ condition + + return problem,solution + # || Class Instances #Format is: @@ -769,3 +781,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +basicTrigonometry=Generator("Trigonometric Values",50,"What is sin(X)?","ans",basicTrigonometryFunc) From 2b5a8135dc47f1209103fbbb75804ffb3a82bd09 Mon Sep 17 00:00:00 2001 From: Shiven Tripathi <58358532+ShivenTripathi@users.noreply.github.com> Date: Sat, 17 Oct 2020 18:22:20 +0530 Subject: [PATCH 14/79] debug, tested --- mathgenerator/mathgen.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 90cd1ac..fda0d0e 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -535,10 +535,13 @@ def commonFactorsFunc(maxVal=100): def quadraticEquation(maxVal=100): a = random.randint(1,maxVal) c = random.randint(1,maxVal) - b = random.randint(4*a*c,4*maxVal*maxVal) + b = random.randint(round(math.sqrt(4*a*c))+1,round(math.sqrt(4*maxVal*maxVal))) - problem = "Zeros of the Quadratic Equation {a}x^2+{b}x+{c}=0".format(a,b,c) - solution = str[(-b+sqrt(b^2-4*a*c))/2*a,(-b-sqrt(b^2-4*a*c))/2*a] + problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a,b,c) + + D = math.sqrt(b*b-4*a*c) + + solution = str([(-b+D)/(2*a),(-b-D)/(2*a)]) return problem,solution # || Class Instances From 7e9f8a4d2b19e5ed168cca1498a6c26958d5123d Mon Sep 17 00:00:00 2001 From: "sakshi.kst" Date: Sat, 17 Oct 2020 18:30:57 +0530 Subject: [PATCH 15/79] Sum of Angles of Polygon function added --- README.md | 1 + mathgenerator/mathgen.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index dfc7d41..d39ce06 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,4 @@ problem, solution = mathgen.genById(0) | 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | | 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | +| 50 | Sum of Angles of Polygon | Sum of angles of polygon with 4 sides = | 360 | sumOfAnglesOfPolygon | \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1041a55..52ee492 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -714,6 +714,13 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): solution = angle4 return problem, solution +def sumOfAnglesOfPolygonFunc(maxSides = 12): + side = random.randint(3, maxSides) + sum = (side - 2) * 180 + problem = f"Sum of angles of polygon with {side} sides = " + solution = sum + return problem, solution + # || Class Instances #Format is: @@ -769,3 +776,4 @@ matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multipl CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 50, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) From e2bbbee7c6957ac6276c9b95dad579fcc93745ac Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 12:54:30 -0400 Subject: [PATCH 16/79] Rounded solution --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 3a44119..72eb108 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -723,7 +723,7 @@ def quadraticEquation(maxVal=100): D = math.sqrt(b*b-4*a*c) - solution = str([(-b+D)/(2*a),(-b-D)/(2*a)]) + solution = str([round((-b+D)/(2*a), 2),round((-b-D)/(2*a), 2)]) return problem,solution # || Class Instances From 08fc9d0663e90b96ee9d7cb7451aa3ee5c212576 Mon Sep 17 00:00:00 2001 From: YuvalG Date: Sat, 17 Oct 2020 20:05:47 +0300 Subject: [PATCH 17/79] Add flake8 as linter --- .github/workflows/tests.yaml | 44 +- Makefile | 9 +- dev-requirements.txt | 5 +- .../__pycache__/__init__.cpython-37.pyc | Bin 164 -> 0 bytes .../__pycache__/mathgen.cpython-37.pyc | Bin 19103 -> 0 bytes mathgenerator/mathgen.py | 500 ++++++++++-------- tests/test_mathgen.py | 92 ++-- 7 files changed, 358 insertions(+), 292 deletions(-) delete mode 100644 mathgenerator/__pycache__/__init__.cpython-37.pyc delete mode 100644 mathgenerator/__pycache__/mathgen.cpython-37.pyc diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3252576..cc6cf9d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,21 +1,23 @@ -name: Run tests - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -r dev-requirements.txt - - name: Test - run: make test +name: Run tests + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -r dev-requirements.txt + - name: Linter + run: make lint + - name: Test + run: make test diff --git a/Makefile b/Makefile index dbf1f17..bd04e35 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,7 @@ -test: - python -m pytest --verbose -s tests +FLAKE_FLAGS = --ignore=E501,F401,F403,F405 + +lint: + python -m flake8 $(FLAKE_FLAGS) + +test: + python -m pytest --verbose -s tests diff --git a/dev-requirements.txt b/dev-requirements.txt index a965899..6e46af4 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,2 +1,3 @@ -pytest -hypothesis \ No newline at end of file +pytest +hypothesis +flake8 \ No newline at end of file diff --git a/mathgenerator/__pycache__/__init__.cpython-37.pyc b/mathgenerator/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 893336fc37f23c5d8be2b5e049b532e5ed6e2ea6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 164 zcmZ?b<>g{vU|`t!q%$5wKL!yn%*epN;K0DZP|U)>z>vZa%%I8Wx00aaCYEHRr{<*=C6?qDq4DD5 dGxIV_;^XxSDsOSvg{vU|^X1x-(win}Ojmhy%lH3=9ko3=9m#ii#jk}iN+IP% zihoK#3uBaG%FC3%l%N*ID5aEFDZwcrEsRmhDX&w)Qo>spqf}Dfq(r1dwlGGiro2sw zN{Mb^j8aQwN{LBfNQq5}OJ!|ljZ#l#N{LSqPf19LOJ!?jjnYVEN=Z!dOi4OXY87jWS4ON-0kfN~uVROXX{3jWSGSN~uh#N~un%Nfl^jjWSAQN~ukeNU2My zPZextjWSMUN@+-G1iMeDnKjBJl_{kur8%V~B{x;LnKjBZl_{k)r7fjBB{x;1nKjBR zl_{kor8A`~r8`x$nKjBhl_{ksr8lK7r9V}ynKjBHl__OH%EXjODU(yhn^~hQQ<+kx zq)bhjmNGq6qM0?yDwQc^Mv7d@%#>NFlFh79)~QS>vs31z%uSh>D%H#yWs}O3GCyTO z%EFXIsnX4?QMRc}DT`BvOZ-)%EnarX4WXjRHl?oDVtNaq-;%9Xl9LaN@Ysfma;u%M@o09 zVl!)$b1GBH&Xip#yHob0DmAl4xui0s>`mF1vOncOs&X@Hlxr$e%E6RFDTh;XQ&pN- zquf%NQjVk?O*xiwJXN)sHOf7eDdj}U$&^zmr&HCMS))8s7=sx!-@OFoT)$)x3BydV zJgmaNz>vxi#hAhn#gxLB!UWE-%qcA39Lt)**1{0Qn!+B;pviHI(>*mWwJ5P9zbF}0 z1b~bJ(X0#%49=k9z=(l?p@y-BA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?6=Qg;b@B zE)1~<)Qp0Up(W}lBOmi_H7X3XD~vR?D-5+N zjH-AvDs(FhH9@42W|cT(9va;E1Gxd_zn7pjPE~SfvS1fN*BF7qqzGh(QgD7wS*k*! zLNItj5o8K{Xh$J4Pa!DI=%qMFp|lYwO`3v6?hTD~6m*R%6m%7gL0nz4DqhgQzOEr; zVBfe((gl4i*+>B#F2yfF6?K&^yg3aU=!KVs8Wn~*m4?tU=L#d8N+ZoGQE>i-DTU0-aYiLx(Q(>zM76J2w1Hc_{Xe1YdCu?6ygF;jUSq9uSPgJn2;)@2QSsjHG9R)o- zz1S*ocosy>ST8~SYiLH)f@VZ1cuGiA2!i%b0w5iPm!Q3~RR-{YC)AHIgLGq}m<^2# zs>Gd4nHf}v>?Cp5?sb6$dmyQ^3eLCwf2KGa6gOHk{h3RXx%w1C61IP>)lEow3q1%lWh zLX#2fCQYbSP>Km+C}@5}lNoF%g3x4ycmQe(R4LdF#-aj{GmzZ{7H5L!ZURX{wJ}3_ zzaaO5B{iAAU4WvQ5H(P3U?+prApEolq5$kPsB1kTyH-F0ZQz3iz}x)6d-B2i(ThME zvx{^=J_c>q1#d_#0`JoVZEY+9?W`*TZAk;~%qnsRsRM05DFSW9C<1LjC<3j?2d`5v z0LmUHN?jI$PRs>mF z4%Z`@nO6d-<&BI`3#%wT)FrM_f+_i_#jxti6||T$N+=g&tzZ}NtU2|}UK8hEm zqXb%118Val+TV~q6{x8PVS)Pbw>WITQJZQ98mTFs#K6G7!NkJMC&0nN!OFz}g*;pw zTwliX?1_0$(qi6sC diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 7bf36d8..b8d9033 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -4,6 +4,7 @@ import fractions genList = [] + # || Generator class class Generator: def __init__(self, title, id, generalProb, generalSol, func): @@ -20,52 +21,59 @@ class Generator: def __call__(self, **kwargs): return self.func(**kwargs) + # || Non-generator Functions def genById(id): generator = genList[id][2] return(generator()) + def getGenList(): return(genList) # || Generator Functions -def additionFunc(maxSum = 99, maxAddend = 50): + +def additionFunc(maxSum=99, maxAddend=50): a = random.randint(0, maxAddend) - b = random.randint(0, min((maxSum-a), maxAddend)) #The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well - c = a+b + b = random.randint(0, min((maxSum - a), maxAddend)) # The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well + c = a + b problem = str(a) + "+" + str(b) + "=" solution = str(c) return problem, solution -def subtractionFunc(maxMinuend = 99, maxDiff = 99): + +def subtractionFunc(maxMinuend=99, maxDiff=99): a = random.randint(0, maxMinuend) - b = random.randint(max(0, (a-maxDiff)), a) - c = a-b + b = random.randint(max(0, (a - maxDiff)), a) + c = a - b problem = str(a) + "-" + str(b) + "=" solution = str(c) return problem, solution -def multiplicationFunc(maxRes = 99, maxMulti = 99): + +def multiplicationFunc(maxRes=99, maxMulti=99): a = random.randint(0, maxMulti) - b = random.randint(0, min(int(maxMulti/a), maxRes)) - c = a*b + b = random.randint(0, min(int(maxMulti / a), maxRes)) + c = a * b problem = str(a) + "*" + str(b) + "=" solution = str(c) return problem, solution -def divisionFunc(maxRes = 99, maxDivid = 99): + +def divisionFunc(maxRes=99, maxDivid=99): a = random.randint(0, maxDivid) b = random.randint(0, min(maxRes, maxDivid)) - c = a/b + c = a / b problem = str(a) + "/" + str(b) + "=" solution = str(c) return problem, solution -def binaryComplement1sFunc(maxDigits = 10): + +def binaryComplement1sFunc(maxDigits=10): question = '' answer = '' - for i in range(random.randint(1,maxDigits)): + for i in range(random.randint(1, maxDigits)): temp = str(random.randint(0, 1)) question += temp answer += "0" if temp == "1" else "1" @@ -74,22 +82,25 @@ def binaryComplement1sFunc(maxDigits = 10): solution = answer return problem, solution -def moduloFunc(maxRes = 99, maxModulo= 99): + +def moduloFunc(maxRes=99, maxModulo=99): a = random.randint(0, maxModulo) b = random.randint(0, min(maxRes, maxModulo)) - c = a%b + c = a % b problem = str(a) + "%" + str(b) + "=" solution = str(c) return problem, solution -def squareRootFunc(minNo = 1, maxNo = 12): + +def squareRootFunc(minNo=1, maxNo=12): b = random.randint(minNo, maxNo) - a = b*b + a = b * b problem = "sqrt(" + str(a) + ")=" solution = str(b) return problem, solution -def powerRuleDifferentiationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): + +def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5): numTerms = random.randint(1, maxTerms) problem = "" solution = "" @@ -103,23 +114,26 @@ def powerRuleDifferentiationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): solution += str(coefficient * exponent) + "x^" + str(exponent - 1) return problem, solution -def squareFunc(maxSquareNum = 20): + +def squareFunc(maxSquareNum=20): a = random.randint(1, maxSquareNum) b = a * a problem = str(a) + "^2" + "=" solution = str(b) return problem, solution + def gcdFunc(maxVal=20): a = random.randint(1, maxVal) b = random.randint(1, maxVal) x, y = a, b while(y): - x, y = y, x % y + x, y = y, x % y problem = f"GCD of {a} and {b} = " solution = str(x) return problem, solution + def lcmFunc(maxVal=20): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -132,11 +146,13 @@ def lcmFunc(maxVal=20): solution = str(d) return problem, solution -def basicAlgebraFunc(maxVariable = 10): + +def basicAlgebraFunc(maxVariable=10): a = random.randint(1, maxVariable) b = random.randint(1, maxVariable) c = random.randint(b, maxVariable) # calculate gcd + def calculate_gcd(x, y): while(y): x, y = y, x % y @@ -145,44 +161,49 @@ def basicAlgebraFunc(maxVariable = 10): x = f"{(c - b)//i}/{a//i}" if (c - b == 0): x = "0" - elif a == 1 or a == i : + elif a == 1 or a == i: x = f"{c - b}" problem = f"{a}x + {b} = {c}" solution = x return problem, solution + def logFunc(maxBase=3, maxVal=8): a = random.randint(1, maxVal) b = random.randint(2, maxBase) - c = pow(b,a) - problem = "log"+str(b)+"("+str(c)+")" + c = pow(b, a) + problem = "log" + str(b) + "(" + str(c) + ")" solution = str(a) return problem, solution + def divisionToIntFunc(maxA=25, maxB=25): - a = random.randint(1,maxA) - b = random.randint(1,maxB) - divisor = a*b - dividend=random.choice([a,b]) + a = random.randint(1, maxA) + b = random.randint(1, maxB) + divisor = a * b + dividend = random.choice([a, b]) problem = f"{divisor}/{dividend} = " - solution=int(divisor/dividend) - return problem,solution + solution = int(divisor / dividend) + return problem, solution + def DecimalToBinaryFunc(max_dec=99): a = random.randint(1, max_dec) b = bin(a).replace("0b", "") - problem = "Binary of "+str(a)+"=" + problem = "Binary of " + str(a) + "=" solution = str(b) return problem, solution -def BinaryToDecimalFunc(max_dig=10): - problem='' - for i in range(random.randint(1,max_dig)): - temp = str(random.randint(0, 1)) - problem += temp - solution=int(problem, 2); - return problem, solution +def BinaryToDecimalFunc(max_dig=10): + problem = '' + for i in range(random.randint(1, max_dig)): + temp = str(random.randint(0, 1)) + problem += temp + + solution = int(problem, 2) + return problem, solution + def divideFractionsFunc(maxVal=10): a = random.randint(1, maxVal) @@ -193,6 +214,7 @@ def divideFractionsFunc(maxVal=10): d = random.randint(1, maxVal) while (c == d): d = random.randint(1, maxVal) + def calculate_gcd(x, y): while(y): x, y = y, x % y @@ -208,33 +230,36 @@ def divideFractionsFunc(maxVal=10): solution = x return problem, solution -def multiplyIntToMatrix22(maxMatrixVal = 10, maxRes = 100): + +def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100): a = random.randint(0, maxMatrixVal) b = random.randint(0, maxMatrixVal) c = random.randint(0, maxMatrixVal) d = random.randint(0, maxMatrixVal) - constant = random.randint(0, int(maxRes/max(a,b,c,d))) + constant = random.randint(0, int(maxRes / max(a, b, c, d))) problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = " solution = f"[[{a*constant},{b*constant}],[{c*constant},{d*constant}]]" return problem, solution -def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): - a = random.randint(1, maxA) - b = random.randint(1, maxB) - c = random.randint(1, maxC) - s = (a+b+c)/2 - area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 - problem = "Area of triangle with side lengths: "+ str(a) +" "+ str(b) +" "+ str(c) + " = " - solution = area - return problem, solution -def isTriangleValidFunc(maxSideLength = 50): +def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): + a = random.randint(1, maxA) + b = random.randint(1, maxB) + c = random.randint(1, maxC) + s = (a + b + c) / 2 + area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 + problem = "Area of triangle with side lengths: " + str(a) + " " + str(b) + " " + str(c) + " = " + solution = area + return problem, solution + + +def isTriangleValidFunc(maxSideLength=50): sideA = random.randint(1, maxSideLength) sideB = random.randint(1, maxSideLength) sideC = random.randint(1, maxSideLength) sideSums = [sideA + sideB, sideB + sideC, sideC + sideA] sides = [sideC, sideA, sideB] - exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) + exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" if exists: solution = "Yes" @@ -242,51 +267,56 @@ def isTriangleValidFunc(maxSideLength = 50): solution = "No" return problem, solution + def MidPointOfTwoPointFunc(maxValue=20): - x1=random.randint(-20,maxValue) - y1=random.randint(-20,maxValue) - x2=random.randint(-20,maxValue) - y2=random.randint(-20,maxValue) - problem=f"({x1},{y1}),({x2},{y2})=" - solution=f"({(x1+x2)/2},{(y1+y2)/2})" - return problem,solution + x1 = random.randint(-20, maxValue) + y1 = random.randint(-20, maxValue) + x2 = random.randint(-20, maxValue) + y2 = random.randint(-20, maxValue) + problem = f"({x1},{y1}),({x2},{y2})=" + solution = f"({(x1+x2)/2},{(y1+y2)/2})" + return problem, solution -def factoringFunc(range_x1 = 10, range_x2 = 10): - x1 = random.randint(-range_x1, range_x1) - x2 = random.randint(-range_x2, range_x2) - def intParser(z): - if (z == 0): - return "" - if (z > 0): - return "+" + str(z) - if (z < 0): - return "-" + str(abs(z)) - b = intParser(x1 + x2) - c = intParser(x1 * x2) +def factoringFunc(range_x1=10, range_x2=10): + x1 = random.randint(-range_x1, range_x1) + x2 = random.randint(-range_x2, range_x2) + + def intParser(z): + if (z == 0): + return "" + if (z > 0): + return "+" + str(z) + if (z < 0): + return "-" + str(abs(z)) + + b = intParser(x1 + x2) + c = intParser(x1 * x2) + + if (b == "+1"): + b = "+" + + if (b == ""): + problem = f"x^2{c}" + else: + problem = f"x^2{b}x{c}" + + x1 = intParser(x1) + x2 = intParser(x2) + solution = f"(x{x1})(x{x2})" + return problem, solution - if (b == "+1"): - b = "+" - - if (b == ""): - problem = f"x^2{c}" - else: - problem = f"x^2{b}x{c}" - x1 = intParser(x1) - x2 = intParser(x2) - solution = f"(x{x1})(x{x2})" - return problem, solution - def thirdAngleOfTriangleFunc(maxAngle=89): - angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, maxAngle) - angle3 = 180 - (angle1 + angle2) - problem = f"Third angle of triangle with angles {angle1} and {angle2} = " - solution = angle3 - return problem, solution + angle1 = random.randint(1, maxAngle) + angle2 = random.randint(1, maxAngle) + angle3 = 180 - (angle1 + angle2) + problem = f"Third angle of triangle with angles {angle1} and {angle2} = " + solution = angle3 + return problem, solution -def systemOfEquationsFunc(range_x = 10, range_y = 10, coeff_mult_range=10): + +def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10): # Generate solution point first x = random.randint(-range_x, range_x) y = random.randint(-range_y, range_y) @@ -331,17 +361,19 @@ def systemOfEquationsFunc(range_x = 10, range_y = 10, coeff_mult_range=10): # Add random (non-zero) multiple of equations to each other -def distanceTwoPointsFunc(maxValXY = 20, minValXY=-20): - point1X = random.randint(minValXY, maxValXY+1) - point1Y = random.randint(minValXY, maxValXY+1) - point2X = random.randint(minValXY, maxValXY+1) - point2Y = random.randint(minValXY, maxValXY+1) + +def distanceTwoPointsFunc(maxValXY=20, minValXY=-20): + point1X = random.randint(minValXY, maxValXY + 1) + point1Y = random.randint(minValXY, maxValXY + 1) + point2X = random.randint(minValXY, maxValXY + 1) + point2Y = random.randint(minValXY, maxValXY + 1) distanceSq = (point1X - point2X) ** 2 + (point1Y - point2Y) ** 2 solution = f"sqrt({distanceSq})" problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})" return problem, solution -def pythagoreanTheoremFunc(maxLength = 20): + +def pythagoreanTheoremFunc(maxLength=20): a = random.randint(1, maxLength) b = random.randint(1, maxLength) c = (a**2 + b**2)**0.5 @@ -349,29 +381,31 @@ def pythagoreanTheoremFunc(maxLength = 20): solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}" return problem, solution -def linearEquationsFunc(n = 2, varRange = 20, coeffRange = 20): + +def linearEquationsFunc(n=2, varRange=20, coeffRange=20): if n > 10: print("[!] n cannot be greater than 10") return None, None vars = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'][:n] - soln = [ random.randint(-varRange, varRange) for i in range(n) ] + soln = [random.randint(-varRange, varRange) for i in range(n)] problem = list() solution = ", ".join(["{} = {}".format(vars[i], soln[i]) for i in range(n)]) for _ in range(n): - coeff = [ random.randint(-coeffRange, coeffRange) for i in range(n) ] - res = sum([ coeff[i] * soln[i] for i in range(n)]) - + coeff = [random.randint(-coeffRange, coeffRange) for i in range(n)] + res = sum([coeff[i] * soln[i] for i in range(n)]) + prob = ["{}{}".format(coeff[i], vars[i]) if coeff[i] != 0 else "" for i in range(n)] while "" in prob: prob.remove("") prob = " + ".join(prob) + " = " + str(res) problem.append(prob) - + problem = "\n".join(problem) return problem, solution + def primeFactorsFunc(minVal=1, maxVal=200): a = random.randint(minVal, maxVal) n = a @@ -389,6 +423,7 @@ def primeFactorsFunc(minVal=1, maxVal=200): solution = f"{factors}" return problem, solution + def multiplyFractionsFunc(maxVal=10): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -398,6 +433,7 @@ def multiplyFractionsFunc(maxVal=10): b = random.randint(1, maxVal) while (c == d): d = random.randint(1, maxVal) + def calculate_gcd(x, y): while(y): x, y = y, x % y @@ -412,32 +448,33 @@ def multiplyFractionsFunc(maxVal=10): solution = x return problem, solution -def regularPolygonAngleFunc(minVal = 3,maxVal = 20): + +def regularPolygonAngleFunc(minVal=3, maxVal=20): sideNum = random.randint(minVal, maxVal) problem = f"Find the angle of a regular polygon with {sideNum} sides" - exteriorAngle = round((360/sideNum),2) + exteriorAngle = round((360 / sideNum), 2) solution = 180 - exteriorAngle - return problem, solution - + return problem, solution + + def combinationsFunc(maxlength=20): def factorial(a): - d=1 + d = 1 for i in range(a): - a=(i+1)*d - d=a + a = (i + 1) * d + d = a return d - a= random.randint(10,maxlength) - b=random.randint(0,9) + a = random.randint(10, maxlength) + b = random.randint(0, 9) + solution = int(factorial(a) / (factorial(b) * factorial(a - b))) + problem = "Number of combinations from {} objects picked {} at a time ".format(a, b) - - solution= int(factorial(a)/(factorial(b)*factorial(a-b))) - problem= "Number of combinations from {} objects picked {} at a time ".format(a,b) - return problem, solution - -def factorialFunc(maxInput = 6): + + +def factorialFunc(maxInput=6): a = random.randint(0, maxInput) n = a problem = str(a) + "! = " @@ -452,31 +489,35 @@ def factorialFunc(maxInput = 6): solution = str(b) return problem, solution -def surfaceAreaCube(maxSide = 20, unit = 'm'): + +def surfaceAreaCube(maxSide=20, unit='m'): a = random.randint(1, maxSide) problem = f"Surface area of cube with side = {a}{unit} is" ans = 6 * a * a solution = f"{ans} {unit}^2" return problem, solution -def volumeCube(maxSide = 20, unit = 'm'): + +def volumeCube(maxSide=20, unit='m'): a = random.randint(1, maxSide) problem = f"Volume of cube with side = {a}{unit} is" ans = a * a * a solution = f"{ans} {unit}^3" return problem, solution -def surfaceAreaCuboid(maxSide = 20, unit = 'm'): + +def surfaceAreaCuboid(maxSide=20, unit='m'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) c = random.randint(1, maxSide) - + problem = f"Surface area of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" - ans = 2 * (a*b + b*c + c*a) + ans = 2 * (a * b + b * c + c * a) solution = f"{ans} {unit}^2" return problem, solution -def volumeCuboid(maxSide = 20, unit = 'm'): + +def volumeCuboid(maxSide=20, unit='m'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) c = random.randint(1, maxSide) @@ -485,7 +526,8 @@ def volumeCuboid(maxSide = 20, unit = 'm'): solution = f"{ans} {unit}^3" return problem, solution -def surfaceAreaCylinder(maxRadius = 20, maxHeight = 50,unit = 'm'): + +def surfaceAreaCylinder(maxRadius=20, maxHeight=50, unit='m'): a = random.randint(1, maxHeight) b = random.randint(1, maxRadius) problem = f"Surface area of cylinder with height = {a}{unit} and radius = {b}{unit} is" @@ -493,7 +535,8 @@ def surfaceAreaCylinder(maxRadius = 20, maxHeight = 50,unit = 'm'): solution = f"{ans} {unit}^2" return problem, solution -def volumeCylinder(maxRadius = 20, maxHeight = 50, unit = 'm'): + +def volumeCylinder(maxRadius=20, maxHeight=50, unit='m'): a = random.randint(1, maxHeight) b = random.randint(1, maxRadius) problem = f"Volume of cylinder with height = {a}{unit} and radius = {b}{unit} is" @@ -501,7 +544,8 @@ def volumeCylinder(maxRadius = 20, maxHeight = 50, unit = 'm'): solution = f"{ans} {unit}^3" return problem, solution -def surfaceAreaCone(maxRadius = 20, maxHeight = 50,unit = 'm'): + +def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m'): a = random.randint(1, maxHeight) b = random.randint(1, maxRadius) slopingHeight = math.sqrt(a**2 + b**2) @@ -510,14 +554,16 @@ def surfaceAreaCone(maxRadius = 20, maxHeight = 50,unit = 'm'): solution = f"{ans} {unit}^2" return problem, solution -def volumeCone(maxRadius = 20, maxHeight = 50, unit = 'm'): + +def volumeCone(maxRadius=20, maxHeight=50, unit='m'): a = random.randint(1, maxHeight) b = random.randint(1, maxRadius) problem = f"Volume of cone with height = {a}{unit} and radius = {b}{unit} is" - ans = int(math.pi * b * b * a * (1/3)) + ans = int(math.pi * b * b * a * (1 / 3)) solution = f"{ans} {unit}^3" return problem, solution + def commonFactorsFunc(maxVal=100): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -537,6 +583,7 @@ def commonFactorsFunc(maxVal=100): solution = arr return problem, solution + def intersectionOfTwoLinesFunc( minM=-10, maxM=10, minB=-10, maxB=10, minDenominator=1, maxDenominator=6 ): @@ -567,7 +614,7 @@ def intersectionOfTwoLinesFunc( else: x = f"{x.numerator}/{x.denominator}" return x - + m1 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) m2 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) b1 = random.randint(minB, maxB) @@ -590,21 +637,24 @@ def intersectionOfTwoLinesFunc( solution = f"({fractionToString(intersection_x)}, {fractionToString(intersection_y)})" return problem, solution + def permutationFunc(maxlength=20): - a = random.randint(10,maxlength) - b = random.randint(0,9) - solution= int(math.factorial(a)/(math.factorial(a-b))) - problem= "Number of Permutations from {} objects picked {} at a time = ".format(a,b) + a = random.randint(10, maxlength) + b = random.randint(0, 9) + solution = int(math.factorial(a) / (math.factorial(a - b))) + problem = "Number of Permutations from {} objects picked {} at a time = ".format(a, b) return problem, solution + def vectorCrossFunc(minVal=-20, maxVal=20): a = [random.randint(minVal, maxVal) for i in range(3)] b = [random.randint(minVal, maxVal) for i in range(3)] - c = [a[1]*b[2] - a[2]*b[1], - a[2]*b[0] - a[0]*b[2], - a[0]*b[1] - a[1]*b[0]] + c = [a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0]] return str(a) + " X " + str(b) + " = ", str(c) + def compareFractionsFunc(maxVal=10): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -616,79 +666,84 @@ def compareFractionsFunc(maxVal=10): while (c == d): d = random.randint(1, maxVal) - first=a/b - second=c/d + first = a / b + second = c / d - if(first>second): - solution=">" - elif(first second): + solution = ">" + elif(first < second): + solution = "<" else: - solution="=" - - problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?" - return problem,solution + solution = "=" + + problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?" + return problem, solution + + +def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): + a = random.randint(1000, maxPrinciple) + b = random.randint(1, maxRate) + c = random.randint(1, maxTime) + d = (a * b * c) / 100 + problem = "Simple interest for a principle amount of " + str(a) + " dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " + solution = round(d, 2) + return problem, solution -def simpleInterestFunc(maxPrinciple = 10000, maxRate = 10, maxTime = 10): - a = random.randint(1000, maxPrinciple) - b = random.randint(1, maxRate) - c = random.randint(1, maxTime) - d = (a*b*c)/100 - problem = "Simple interest for a principle amount of " + str(a) +" dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " - solution = round(d, 2) - return problem, solution def matrixMultiplicationFunc(maxVal=100): - m= random.randint(2, 10) - n= random.randint(2, 10) - k= random.randint(2, 10) - #generate matrices a and b - a=[] + m = random.randint(2, 10) + n = random.randint(2, 10) + k = random.randint(2, 10) + # generate matrices a and b + a = [] for r in range(m): a.append([]) for c in range(n): - a[r].append(random.randint(-maxVal,maxVal)) - - b=[] + a[r].append(random.randint(-maxVal, maxVal)) + + b = [] for r in range(n): b.append([]) for c in range(k): b[r].append(random.randint(-maxVal, maxVal)) - res= [] - a_string= matrixMultiplicationFuncHelper(a) - b_string= matrixMultiplicationFuncHelper(b) + res = [] + a_string = matrixMultiplicationFuncHelper(a) + b_string = matrixMultiplicationFuncHelper(b) for r in range(m): res.append([]) for c in range(k): - temp= 0 + temp = 0 for t in range(n): - temp+=a[r][t]*b[t][c] + temp += a[r][t] * b[t][c] res[r].append(temp) - problem= f"Multiply \n{a_string}\n and \n\n{b_string}" #consider using a, b instead of a_string, b_string if the problem doesn't look right - solution= matrixMultiplicationFuncHelper(res) + problem = f"Multiply \n{a_string}\n and \n\n{b_string}" # consider using a, b instead of a_string, b_string if the problem doesn't look right + solution = matrixMultiplicationFuncHelper(res) return problem, solution + def matrixMultiplicationFuncHelper(inp): - m= len(inp) - n= len(inp[0]) - string= "" + m = len(inp) + n = len(inp[0]) + string = "" for i in range(m): for j in range(n): - string+=f"{inp[i][j]: 6d}" - string+=" " - string+="\n" + string += f"{inp[i][j]: 6d}" + string += " " + string += "\n" return string -def cubeRootFunc(minNo = 1, maxNo = 1000): + +def cubeRootFunc(minNo=1, maxNo=1000): b = random.randint(minNo, maxNo) - a = b**(1/3) + a = b**(1 / 3) problem = "cuberoot of " + str(b) + " upto 2 decimal places is:" - solution = str(round(a,2)) + solution = str(round(a, 2)) return problem, solution -def powerRuleIntegrationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): + +def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): numTerms = random.randint(1, maxTerms) problem = "" solution = "" @@ -699,32 +754,33 @@ def powerRuleIntegrationFunc(maxCoef = 10, maxExp = 10, maxTerms = 5): coefficient = random.randint(1, maxCoef) exponent = random.randint(1, maxExp) problem += str(coefficient) + "x^" + str(exponent) - solution += "("+str(coefficient) +"/"+str(exponent) +")x^" + str(exponent +1) + solution += "(" + str(coefficient) + "/" + str(exponent) + ")x^" + str(exponent + 1) solution = solution + " + c" return problem, solution - -def fourthAngleOfQuadriFunc(maxAngle = 180): + +def fourthAngleOfQuadriFunc(maxAngle=180): angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, 240-angle1) - angle3 = random.randint(1, 340-(angle1 + angle2)) + angle2 = random.randint(1, 240 - angle1) + angle3 = random.randint(1, 340 - (angle1 + angle2)) sum_ = angle1 + angle2 + angle3 angle4 = 360 - sum_ problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" solution = angle4 return problem, solution - -def quadraticEquation(maxVal=100): - a = random.randint(1,maxVal) - c = random.randint(1,maxVal) - b = random.randint(round(math.sqrt(4*a*c))+1,round(math.sqrt(4*maxVal*maxVal))) - - problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a,b,c) - D = math.sqrt(b*b-4*a*c) - - solution = str([round((-b+D)/(2*a), 2),round((-b-D)/(2*a), 2)]) - return problem,solution + +def quadraticEquation(maxVal=100): + a = random.randint(1, maxVal) + c = random.randint(1, maxVal) + b = random.randint(round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal))) + + problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c) + + D = math.sqrt(b * b - 4 * a * c) + + solution = str([round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]) + return problem, solution def hcfFunc(maxVal=20): @@ -732,15 +788,17 @@ def hcfFunc(maxVal=20): b = random.randint(1, maxVal) x, y = a, b while(y): - x, y = y, x % y + x, y = y, x % y problem = f"HCF of {a} and {b} = " solution = str(x) return problem, solution # || Class Instances -#Format is: -# = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) +# Format is: +# <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) + + addition = Generator("Addition", 0, "a+b=", "c", additionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc) multiplication = Generator("Multiplication", 2, "a*b=", "c", multiplicationFunc) @@ -749,48 +807,48 @@ binaryComplement1s = Generator("Binary Complement 1s", 4, "1010=", "0101", binar 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) +square = Generator("Square", 8, "a^2", "b", squareFunc) 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 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) +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) intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) -doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?","Yes/No", isTriangleValidFunc) -midPointOfTwoPoint=Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPointFunc) +doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?", "Yes/No", isTriangleValidFunc) +midPointOfTwoPoint = Generator("Midpoint of the two point", 20, "((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) -distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) +distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) -linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) #This has multiple variables whereas #23 has only x and y +linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) # This has multiple variables whereas #23 has only x and y primeFactors = Generator("Prime Factorisation", 27, "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) fractionMultiplication = Generator("Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) -angleRegularPolygon = Generator("Angle of a Regular Polygon",29,"Find the angle of a regular polygon with 6 sides","120",regularPolygonAngleFunc) -combinations = Generator("Combinations of Objects",30, "Combinations available for picking 4 objects at a time from 6 distinct objects ="," 15", combinationsFunc) +angleRegularPolygon = Generator("Angle of a Regular Polygon", 29, "Find the angle of a regular polygon with 6 sides", "120", regularPolygonAngleFunc) +combinations = Generator("Combinations of Objects", 30, "Combinations available for picking 4 objects at a time from 6 distinct objects =", " 15", combinationsFunc) factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc) -surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube with side a units is","b units^2", surfaceAreaCube) -surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is","d units^2", surfaceAreaCuboid) -surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is","c units^2", surfaceAreaCylinder) -volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is","b units^3", volumeCube) -volumeCuboidGen = Generator("Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is","d units^3", volumeCuboid) -volumeCylinderGen = Generator("Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is","c units^3", volumeCylinder) -surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is","c units^2", surfaceAreaCone) -volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is","c units^3", volumeCone) -commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc) +surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube with side a units is", "b units^2", surfaceAreaCube) +surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid) +surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder) +volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube) +volumeCuboidGen = Generator("Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid) +volumeCylinderGen = Generator("Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder) +surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone) +volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone) +commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc) intersectionOfTwoLines = 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) -permutations= Generator("Permutations",42, "Total permutations of 4 objects at a time from 10 objects is","5040", permutationFunc) +permutations = Generator("Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc) vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc) -compareFractions=Generator("Compare Fractions",44,"Which symbol represents the comparison between a/b and c/d?",">/</=",compareFractionsFunc) +compareFractions = Generator("Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc) simpleInterest = 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) -matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) -CubeRoot = Generator("Cube Root",47,"Cuberoot of a upto 2 decimal places is","b",cubeRootFunc) +matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) +CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) -fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral",49,"Fourth angle of Quadrilateral with angles a,b,c =","angle4",fourthAngleOfQuadriFunc) +fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc) diff --git a/tests/test_mathgen.py b/tests/test_mathgen.py index ace72a5..af38bff 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -1,46 +1,46 @@ -from math import sqrt -from mathgenerator.mathgen import * - -from hypothesis import strategies as st, given, assume - - -@given(maxSum=st.integers(min_value=1), maxAddend=st.integers(min_value=1)) -def test_additionFunc(maxSum, maxAddend): - assume(maxSum > maxAddend) - problem, solution = additionFunc(maxSum, maxAddend) - assert eval(problem[:-1]) == int(solution) - - -@given(maxMinuend=st.integers(min_value=1), maxDiff=st.integers(min_value=1)) -def test_subtractionFunc(maxMinuend, maxDiff): - assume(maxMinuend > maxDiff) - problem, solution = subtractionFunc(maxMinuend, maxDiff) - assert eval(problem[:-1]) == int(solution) - - -@given(maxRes=st.integers(min_value=1), maxMulti=st.integers(min_value=1)) -def test_multiplicationFunc(maxRes, maxMulti): - assume(maxRes > maxMulti) - problem, solution = multiplicationFunc(maxRes, maxMulti) - assert eval(problem[:-1]) == int(solution) - - -@given(maxRes=st.integers(min_value=1), maxDivid=st.integers(min_value=1)) -def test_divisionFunc(maxRes, maxDivid): - assume(maxRes > maxDivid) - problem, solution = divisionFunc(maxRes, maxDivid) - assert eval(problem[:-1]) == float(solution) - - -@given(maxRes=st.integers(min_value=1), maxModulo=st.integers(min_value=1)) -def test_moduloFunc(maxRes, maxModulo): - assume(maxRes > maxModulo) - problem, solution = moduloFunc(maxRes, maxModulo) - assert eval(problem[:-1]) == int(solution) - - -@given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) -def test_squareRootFunc(minNo, maxNo): - assume(maxNo > minNo) - problem, solution = squareRootFunc(minNo, maxNo) - assert eval(problem[:-1]) == float(solution) +from math import sqrt +from mathgenerator.mathgen import * + +from hypothesis import strategies as st, given, assume + + +@given(maxSum=st.integers(min_value=1), maxAddend=st.integers(min_value=1)) +def test_addition(maxSum, maxAddend): + assume(maxSum > maxAddend) + problem, solution = addition.func(maxSum, maxAddend) + assert eval(problem[:-1]) == int(solution) + + +@given(maxMinuend=st.integers(min_value=1), maxDiff=st.integers(min_value=1)) +def test_subtraction(maxMinuend, maxDiff): + assume(maxMinuend > maxDiff) + problem, solution = subtraction.func(maxMinuend, maxDiff) + assert eval(problem[:-1]) == int(solution) + + +@given(maxRes=st.integers(min_value=1), maxMulti=st.integers(min_value=1)) +def test_multiplication(maxRes, maxMulti): + assume(maxRes > maxMulti) + problem, solution = multiplication.func(maxRes, maxMulti) + assert eval(problem[:-1]) == int(solution) + + +@given(maxRes=st.integers(min_value=1), maxDivid=st.integers(min_value=1)) +def test_division(maxRes, maxDivid): + assume(maxRes > maxDivid) + problem, solution = division.func(maxRes, maxDivid) + assert eval(problem[:-1]) == float(solution) + + +@given(maxRes=st.integers(min_value=1), maxModulo=st.integers(min_value=1)) +def test_moduloDivision(maxRes, maxModulo): + assume(maxRes > maxModulo) + problem, solution = moduloDivision.func(maxRes, maxModulo) + assert eval(problem[:-1]) == int(solution) + + +@given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) +def test_squareRoot(minNo, maxNo): + assume(maxNo > minNo) + problem, solution = squareRoot.func(minNo, maxNo) + assert eval(problem[:-1]) == float(solution) From 8c326f827842044c719b7883aec392c58d144660 Mon Sep 17 00:00:00 2001 From: Ritu Raj <68614399+Ritu1611@users.noreply.github.com> Date: Sat, 17 Oct 2020 22:58:11 +0530 Subject: [PATCH 18/79] Update mathgen.py --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index e7da9a6..2515683 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -715,7 +715,7 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): return problem, solution def confidenceIntervalFunc(): n=random.randint(20,40) - j=random.randint(1,4) + j=random.randint(0,3) lst=random.sample(range(200,300),n) lst_per=[80 ,90, 95, 99] lst_t = [1.282, 1.645, 1.960, 2.576] From ec10674a7923354579f0d26beb922c1b90ef224f Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 13:38:09 -0400 Subject: [PATCH 19/79] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 621b2a4..dfc7d41 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,3 @@ problem, solution = mathgen.genById(0) | 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | | 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | -| 50 | Surd Comparison | 25^(1/3) _ 37^(1/2) | < | surdsComparisonGen | From 801ac79b00f757f2e66650f133463ef98a70917b Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 13:54:51 -0400 Subject: [PATCH 20/79] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d39ce06..dfc7d41 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,3 @@ problem, solution = mathgen.genById(0) | 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | | 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | -| 50 | Sum of Angles of Polygon | Sum of angles of polygon with 4 sides = | 360 | sumOfAnglesOfPolygon | \ No newline at end of file From 74c3cab7db1d040d6975e6dcbc8a08029c55f6be Mon Sep 17 00:00:00 2001 From: MaxwellJpg <70202524+MaxwellJpg@users.noreply.github.com> Date: Sat, 17 Oct 2020 19:00:21 +0100 Subject: [PATCH 21/79] Update README.md corrected line 81, function id 48. Integrated denominator should be power + 1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f3ab03..a8c09dc 100644 --- a/README.md +++ b/README.md @@ -78,5 +78,5 @@ problem, solution = mathgen.genById(0) | 45 | Simple Interest | Simple interest for a principle amount of 6128 dollars, 5% rate of interest and for a time period of 5 years is = | 1532.0 | simpleInterest | | 46 | Multiplication of two matrices | Multiply [[-20, -14, -88, -62, 39, 94, 21, 75, 26], [89, -67, -80, -60, 32, -23, -79, 11, -69], [13, -75, -66, 3, 67, -79, -49, 6, 36], [-44, -84, 68, -27, -86, -95, -71, -77, -62], [45, 58, 89, 82, 30, -83, -23, 51, 95], [11, 46, 100, -15, 60, -34, 85, 50, -44], [93, -100, -62, 63, -73, -64, 90, -15, 23], [-8, 91, -22, 53, -42, 25, 32, -26, 31], [-60, 90, 75, -42, 19, 33, -30, 74, 13]] and [[-80, 54, -39, 37, -99], [31, -28, -31, 64, 73], [-21, -34, -28, -21, -76], [-94, 55, 66, 0, 17], [-28, 25, -65, -74, 100], [76, 74, -96, -98, -5], [-90, -70, -66, -71, -35], [65, 49, -100, 72, -23], [-95, -97, -31, -84, -86]] | [[15409, 6508, -21665, -10161, 5326], [9859, 17962, 3267, 12768, 3119], [-8761, 1272, 8611, 738, 3881], [4489, -5790, 29652, 11947, -5940], [-22167, -8208, -1142, 6747, -10714], [-4628, -5167, -15527, 1404, 243], [-29240, -2432, 11103, 615, -22487], [-5498, -5038, 1462, -100, 2495], [18214, -3238, -15548, 3691, 6061]] | matrixMultiplication | | 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | -| 48 | Power Rule Integration | 3x^1 | (3/1)x^2 + c | powerRuleIntegration | +| 48 | Power Rule Integration | 3x^1 | (3/2)x^2 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | From 49ed99a3f9d042352ba8fb2b738e0c3da56a817f Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 14:06:00 -0400 Subject: [PATCH 22/79] Fixed createFibList indentation error --- mathgenerator/mathgen.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 3c91834..02b4c1d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -713,16 +713,16 @@ def fourthAngleOfQuadriFunc(maxAngle = 180): problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" solution = angle4 return problem, solution - + def quadraticEquation(maxVal=100): a = random.randint(1,maxVal) c = random.randint(1,maxVal) b = random.randint(round(math.sqrt(4*a*c))+1,round(math.sqrt(4*maxVal*maxVal))) - + problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a,b,c) D = math.sqrt(b*b-4*a*c) - + solution = str([round((-b+D)/(2*a), 2),round((-b-D)/(2*a), 2)]) return problem,solution @@ -797,18 +797,18 @@ def surdsComparisonFunc(maxValue = 100, maxRoot = 10): elif first < second: solution = "<" return problem, solution - + def fibonacciSeriesFunc(minNo=1): n = random.randint(minNo,20) def createFibList(n): - l=[] - for i in range(n): - if i<2: - l.append(i) - else: - val = l[i-1]+l[i-2] - l.append(val) - return l + l=[] + for i in range(n): + if i<2: + l.append(i) + else: + val = l[i-1]+l[i-2] + l.append(val) + return l fibList=createFibList(n) problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" solution = fibList @@ -821,7 +821,7 @@ def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): problem=f"What is {function}({angle})?" expression='math.'+function+'(math.radians(angle))' result_fraction_map={0.0:"0",0.5:"1/2",0.71:"1/√2",0.87:"√3/2",1.0:"1",0.58:"1/√3",1.73:"√3"} - + solution=result_fraction_map[round(eval(expression),2)] if round(eval(expression),2)<=99999 else "∞" #for handling the ∞ condition return problem,solution @@ -895,4 +895,4 @@ confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) -sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) \ No newline at end of file +sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) From f323be51ae5281ad142095782177bc9d08ff52cc Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 14:14:57 -0400 Subject: [PATCH 23/79] remove pycache --- .../__pycache__/__init__.cpython-37.pyc | Bin 164 -> 0 bytes .../__pycache__/mathgen.cpython-37.pyc | Bin 29724 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mathgenerator/__pycache__/__init__.cpython-37.pyc delete mode 100644 mathgenerator/__pycache__/mathgen.cpython-37.pyc diff --git a/mathgenerator/__pycache__/__init__.cpython-37.pyc b/mathgenerator/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 893336fc37f23c5d8be2b5e049b532e5ed6e2ea6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 164 zcmZ?b<>g{vU|`t!q%$5wKL!yn%*epN;K0DZP|U)>z>vZa%%I8Wx00a<B#a<_`8r$0 zgche36~_cP$GD^xXP4v`!~_)OXQd{W6vqS<B_@|-Ca1>aCYEHRr{<*=C6?qDq4DD5 dGxIV_;^XxSDsOSv<mRW8=A_zztoaOb3ILz#EKdLc diff --git a/mathgenerator/__pycache__/mathgen.cpython-37.pyc b/mathgenerator/__pycache__/mathgen.cpython-37.pyc deleted file mode 100644 index 82bcec4b454f2a62c9cf0b2088c33baea54dfaef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29724 zcmZ?b<>g{vU|`sPyes~HDFee}5C?|Y7#J8F7#J9e<JcG&QW#Pga~Pr^G-DJan9mf& zl+F;v?9PzFl)~J?kiy)|6vdLllET`;5XG9pmcrh`5XCluF~uT<D}}p-F^YWxV~S-8 zPYQ1fV-&{(#uTd*z7+lz#wgASj49SB0x5zmj8R+@7*lLggi}OX7^Ao+Fs9h1h^C0O zFh=oA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zQ$V6($fD4u9!Q)Qy4o44nIF!D>Jx+tAZbCdG(Qh)Da;rc7iB?Ylo+^bhBj;v3vq7o zAh$=NxRDkCM1l5h6(klRCY+=AQ0FhBM8Fkk1zN~)fND-~A{D_l+#Mx_Wr!9!LL4Os zPO3<C8S;uE(5Mh(@f(K?IBTTZftDf^-(g^20F9M%FtIT632?A*u<~#~ArB7+4?7PZ z4?7PR4-bzp4+jq?4?7Phj|2}F4;K#~4=0Z_4+oDf4;K#yk2sGYk2nuIj}Q+(4?9=~ zC)gAaDZ*pI!_LFOBf-PTqrkz<!_FhX!zITLI?IE23_5BbyJ|7;8Vd*sT5SPhK`@8} E0A7mq+5i9m From c0a213b90c45bb321aa25c1c2690c62743b20963 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 00:05:05 +0530 Subject: [PATCH 24/79] data_mean function --- .../__pycache__/__init__.cpython-37.pyc | Bin 164 -> 160 bytes .../__pycache__/mathgen.cpython-37.pyc | Bin 29724 -> 33916 bytes mathgenerator/mathgen.py | 56 +++++++++++++----- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/mathgenerator/__pycache__/__init__.cpython-37.pyc b/mathgenerator/__pycache__/__init__.cpython-37.pyc index 893336fc37f23c5d8be2b5e049b532e5ed6e2ea6..8b0d08300961a9cf36125e988780744bcb4225b9 100644 GIT binary patch delta 57 zcmZ3&xPXz{iI<m)fq{YHsY&-lZVM$(XRDad;?$zz7>|G$m(=3ylKg@gkHqBclKiC9 MqO{cFl8Kqt0L~v0h5!Hn delta 61 zcmZ3$xP+10iI<m)fq{Wx=abHf+!kuS&Q>v@#i>QbF#*moE~&-YCHVz00Y&*)smUe9 QF#$!1$t9V|sS{JJ0W}X4lK=n! diff --git a/mathgenerator/__pycache__/mathgen.cpython-37.pyc b/mathgenerator/__pycache__/mathgen.cpython-37.pyc index 82bcec4b454f2a62c9cf0b2088c33baea54dfaef..26c552d300e0698bcd1b325c1363a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nn_m<xV`X}&v3Ww-7A966jXeF_$=;O-29FsS7^*}<iZavl z^YU|3ONug+6~OI|;wpZa<AXEvG$J(ZtC$n@lP2G)_O=3rgC=v40Vtrrgaasc8H+ry zQ6L4HOhrK;#le%~Ym9Y3%D`&DgeGH=G?G3hgt3~8MHQ3x)ri-FHS{7WVg|Pkz}mrt zCR33S$owS`HON+i^lHMLwhp9#39JX4jx~v4*E2&jfSd`@MTP)lQ5wi@wxYuzhk{&) z!~#1W>^7)NnTkN(1zW4h$O#S-P3EF&lke2ZXx#^ygC+FARbn0_Wr0h!Q<D?wbW|)s z_F01ndk_I?ju&}?SiT^_A4CLB-cYArp9f+VgNSkvQ3oP=Ktvyim;fRcgNS7yVmXLd z2_n{l2vCJtv<1Z43L>_Fi0vR^4~W<cBKCub10doMh&T%(&Vh*YAmS>65(7igbrACo zh`0eFKt%*3kAgB{(fi4>>*q6uY_@LjWMo{mxwSEfQA98)u{bjsDg9O!af9+WKZi|j zeoARhsvRS!NVzk)vALW{j(@U1i`ry`7LLhgEkYn#PK;54QGyXd!dM`l7+4GdMGitH diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index fc1fc53..4e6c751 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -798,21 +798,21 @@ def surdsComparisonFunc(maxValue = 100, maxRoot = 10): solution = "<" return problem, solution -def fibonacciSeriesFunc(minNo=1): - n = random.randint(minNo,20) - def createFibList(n): - l=[] - for i in range(n): - if i<2: - l.append(i) - else: - val = l[i-1]+l[i-2] - l.append(val) - return l - fibList=createFibList(n) - problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" - solution = fibList - return problem,solution +# def fibonacciSeriesFunc(minNo=1): +# n = random.randint(minNo,20) +# def createFibList(n): +# l=[] +# for i in range(n): +# if i<2: +# l.append(i) +# else: +# val = l[i-1]+l[i-2] +# l.append(val) +# return l +# fibList=createFibList(n) +# problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" +# solution = fibList +# return problem,solution def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): #Handles degrees in quadrant one angle=random.choice(angles) @@ -826,6 +826,29 @@ def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): return problem,solution + +def data_desc(number_values=15,minval=5,maxval=50): + random_list=[] + for i in range(number_values): + n=random.randint(minval,maxval) + random_list.append(n) + a=sum(random_list) + mean=a/number_values + var=0 + for i in range(number_values): + var+=(random_list[i]-mean)**2 + print(random_list) + print(mean) + print(var/number_values) + print((var/number_values)**0.5) + problem="Find the mean,standard deviation and variance for the data"+str(random_list) + solution="The Mean is {} , Standard Deviation is {}, Variance is {}".format(mean,var/number_values,(var/number_values)**0.5) + return problem,solution + + + + + # || Class Instances #Format is: @@ -887,5 +910,6 @@ diceSumProbability=Generator("Probability of a certain sum appearing on faces of exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc) confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) +# fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) +data_summary=Generator("Mean,Standard Deviation,Variance",58,"a,b,c","Mean:a+b+c/3,Std,Var",data_desc) \ No newline at end of file From 6b63ecf292390b4ba7fb9b23fc8e0f6f18494eda Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 00:08:30 +0530 Subject: [PATCH 25/79] Fibinocci uncommented --- mathgenerator/mathgen.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4e6c751..a12331f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -798,21 +798,21 @@ def surdsComparisonFunc(maxValue = 100, maxRoot = 10): solution = "<" return problem, solution -# def fibonacciSeriesFunc(minNo=1): -# n = random.randint(minNo,20) -# def createFibList(n): -# l=[] -# for i in range(n): -# if i<2: -# l.append(i) -# else: -# val = l[i-1]+l[i-2] -# l.append(val) -# return l -# fibList=createFibList(n) -# problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" -# solution = fibList -# return problem,solution +def fibonacciSeriesFunc(minNo=1): + n = random.randint(minNo,20) + def createFibList(n): + l=[] + for i in range(n): + if i<2: + l.append(i) + else: + val = l[i-1]+l[i-2] + l.append(val) + return l + fibList=createFibList(n) + problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" + solution = fibList + return problem,solution def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): #Handles degrees in quadrant one angle=random.choice(angles) @@ -910,6 +910,6 @@ diceSumProbability=Generator("Probability of a certain sum appearing on faces of exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc) confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -# fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) +fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) data_summary=Generator("Mean,Standard Deviation,Variance",58,"a,b,c","Mean:a+b+c/3,Std,Var",data_desc) \ No newline at end of file From c6e3d8a8fdccad2283e3d3f2c1bf505f45884955 Mon Sep 17 00:00:00 2001 From: Priyadarshan Mohanty <priyadarshan.mohanty@loginradius.com> Date: Sun, 18 Oct 2020 00:19:23 +0530 Subject: [PATCH 26/79] Surface Area of Sphere added --- mathgenerator/mathgen.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 02b4c1d..e3f8995 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -476,6 +476,14 @@ def surfaceAreaCuboid(maxSide = 20, unit = 'm'): solution = f"{ans} {unit}^2" return problem, solution +def surfaceAreaSphere(maxSide = 20, unit = 'm'): + r = random.randint(1, maxSide) + + problem = f"Surface area of Sphere with radius = {r}{unit} is" + ans = 4 * math.pi * r * r + solution = f"{ans} {unit}^2" + return problem, solution + def volumeCuboid(maxSide = 20, unit = 'm'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) @@ -896,3 +904,4 @@ surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) +surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) \ No newline at end of file From a798e9e3e54bb56a33b9ce63ad2073ca405c21a5 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 00:20:36 +0530 Subject: [PATCH 27/79] Removed Pycache --- .../__pycache__/__init__.cpython-37.pyc | Bin 160 -> 0 bytes .../__pycache__/mathgen.cpython-37.pyc | Bin 33916 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mathgenerator/__pycache__/__init__.cpython-37.pyc delete mode 100644 mathgenerator/__pycache__/mathgen.cpython-37.pyc diff --git a/mathgenerator/__pycache__/__init__.cpython-37.pyc b/mathgenerator/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 8b0d08300961a9cf36125e988780744bcb4225b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 160 zcmZ?b<>g{vU|@J^(j5<?AA<-OW@KPsaA06yC}v?`U`SyIX3%8xTggxa5=IceJe{p# zLW@(2ieo$iVq8*-vrF;|VmuO)vrF=mQj5}3i%Vj16H7AEQ}a@b5=-)n(0K9jnR%Hd Z@$q^EmA5!-a`RJ4b5iX<R(u9I0|1=bDnbAN diff --git a/mathgenerator/__pycache__/mathgen.cpython-37.pyc b/mathgenerator/__pycache__/mathgen.cpython-37.pyc deleted file mode 100644 index 26c552d300e0698bcd1b325c1363a3d7fbd2a03c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33916 zcmZ?b<>g{vU|{%e(H)=I$-wX!#DQTp1_lNP1_p-W0(J(56owSW9EK<e%^1Z9<}*bx zr87h^yECLPr7*WJq%b!#MX{u?q_DOyM6sr@rLea!M6pd^Oi4)LO5tu{jAEa_n39;n zlfv7=7{xJxF(oO5FNME_F^Y2nV@h(0K#E`sV-(i}#*~y4;S`Y;#whLyj47!pqA6l6 zj8Qxj7*o<xBvYhX7^8S6Fs7uZ$fU@&Fh=oBU`)wKkxx-*VT|IRz?hPmqL`x8!Wbnm zfiWd3ML9*Kg)vHS0%J;cifW2l3uBbf1jdw{6wMT^7RD&y35+SZDLN^-EsRkj6BtwS zQuI>vTNtB6Corburx>IdwlGGCO<+tZNHIz=ZeffPpTL+>m|~h@*1{MiF@Z6qD8)R* zqJ=R^asp#Yaf)S%RSRR3)C9(qk`(I{n-<0>=?RP}r75;4b}fuiG7}h6%2FIs99tNp zWG67Dl&3hQIJYoH$xUEPsYr26acg0WlApksQkmkO;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Ns*hXWes1g~_w#bE=^j;VH_)fL5{ zk!H~9G7csdW<CK977kV(4k+Z|;oxEC;p1WF;o{-p5$56G;pAcG;pCCv;o{-q;p5@t zk>=sx(dFUd;ouSH5#$l)VdoLz;pbro>)-^N0wP6tOnBINICvy@IC&H}xOv!l1i&V8 w@rd%UbBOZD%JK3@gQnJq$Dr%#P*sCYc?9iHK*wT?5{wXxOiD0HFi9{10I=@v{r~^~ From c76357186b74cc2ffdb9d8841628415dc8177985 Mon Sep 17 00:00:00 2001 From: Priyadarshan Mohanty <priyadarshan.mohanty@loginradius.com> Date: Sun, 18 Oct 2020 00:22:13 +0530 Subject: [PATCH 28/79] Function path changed --- mathgenerator/mathgen.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index e3f8995..784d0b3 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -476,14 +476,6 @@ def surfaceAreaCuboid(maxSide = 20, unit = 'm'): solution = f"{ans} {unit}^2" return problem, solution -def surfaceAreaSphere(maxSide = 20, unit = 'm'): - r = random.randint(1, maxSide) - - problem = f"Surface area of Sphere with radius = {r}{unit} is" - ans = 4 * math.pi * r * r - solution = f"{ans} {unit}^2" - return problem, solution - def volumeCuboid(maxSide = 20, unit = 'm'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) @@ -841,6 +833,14 @@ def sumOfAnglesOfPolygonFunc(maxSides = 12): solution = sum return problem, solution +def surfaceAreaSphere(maxSide = 20, unit = 'm'): + r = random.randint(1, maxSide) + + problem = f"Surface area of Sphere with radius = {r}{unit} is" + ans = 4 * math.pi * r * r + solution = f"{ans} {unit}^2" + return problem, solution + # || Class Instances #Format is: From 954b47fecdae7366802af7b6a4a5c7a1edce2ba1 Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Sat, 17 Oct 2020 22:53:55 +0400 Subject: [PATCH 29/79] added 4 test and an "=" in binaryComplement1sFunc --- mathgenerator/mathgen.py | 2 +- tests/test_mathgen.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 02b4c1d..b1ce210 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -70,7 +70,7 @@ def binaryComplement1sFunc(maxDigits = 10): question += temp answer += "0" if temp == "1" else "1" - problem = question + problem = question+"=" solution = answer return problem, solution diff --git a/tests/test_mathgen.py b/tests/test_mathgen.py index ace72a5..2d6e590 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -39,8 +39,42 @@ def test_moduloFunc(maxRes, maxModulo): assert eval(problem[:-1]) == int(solution) +@given(maxDigits=st.integers(min_value=1, max_value=16)) +def test_binaryComplement1sFunc(maxDigits): + assume(maxDigits > 1) + problem, solution = binaryComplement1sFunc(maxDigits) + assert "".join('1' if i == '0' else '0' for i in problem[:-1]) == solution + + @given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) def test_squareRootFunc(minNo, maxNo): assume(maxNo > minNo) problem, solution = squareRootFunc(minNo, maxNo) assert eval(problem[:-1]) == float(solution) + + +@given(maxSquareNum=st.integers(min_value=1)) +def test_squareFunc(maxSquareNum): + assume(maxSquareNum > 1) + problem, solution = squareFunc(maxSquareNum) + assert pow(int(problem[:-3]), 2) == int(solution) + + +@given(maxVal=st.integers(min_value=1)) +def test_lcmFunc(maxVal): + assume(maxVal > 1) + problem, solution = lcmFunc(maxVal) + split_arr = problem.split(' ') + mult = int(split_arr[2])*int(split_arr[4]) + assert mult if mult != pow(int(split_arr[2]), 2) else int( + split_arr[2]) == int(solution) + + +@given(maxVal=st.integers(min_value=1)) +def test_gcdFunc(maxVal): + assume(maxVal > 1) + problem, solution = gcdFunc(maxVal) + split_arr = problem.split(' ') + mult = int(split_arr[2])*int(split_arr[4]) + assert mult if mult != pow(int(split_arr[2]), 2) else int( + split_arr[2]) == int(solution) \ No newline at end of file From e416d597fa2c8e287fe562f99c454e7eb3cd5925 Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Sat, 17 Oct 2020 22:55:04 +0400 Subject: [PATCH 30/79] fixed whitespaces --- mathgenerator/mathgen.py | 4 ++-- tests/test_mathgen.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index b1ce210..390bc96 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -116,7 +116,7 @@ def gcdFunc(maxVal=20): x, y = a, b while(y): x, y = y, x % y - problem = f"GCD of {a} and {b} = " + problem = f"GCD of {a} and {b} =" solution = str(x) return problem, solution @@ -128,7 +128,7 @@ def lcmFunc(maxVal=20): while(y): x, y = y, x % y d = c // x - problem = f"LCM of {a} and {b} = " + problem = f"LCM of {a} and {b} =" solution = str(d) return problem, solution diff --git a/tests/test_mathgen.py b/tests/test_mathgen.py index 2d6e590..a6aa078 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -77,4 +77,4 @@ def test_gcdFunc(maxVal): split_arr = problem.split(' ') mult = int(split_arr[2])*int(split_arr[4]) assert mult if mult != pow(int(split_arr[2]), 2) else int( - split_arr[2]) == int(solution) \ No newline at end of file + split_arr[2]) == int(solution) From 95178d8b46b2ea7e04069ad74c78ca916298c7ad Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 17:22:11 -0400 Subject: [PATCH 31/79] Version Number change --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e07aa01..4a578ab 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='mathgenerator', - version='1.1.1', + version='1.1.2', description='An open source solution for generating math problems', url='https://github.com/todarith/mathgenerator', author='Luke Weiler', From c9db6ff74776f78a0c88635f68ea2aa7007929e2 Mon Sep 17 00:00:00 2001 From: Swayam Gupta <guptaswayam075@gmail.com> Date: Sun, 18 Oct 2020 03:32:08 +0530 Subject: [PATCH 32/79] added volumeSphereFunc and updated README.md --- README.md | 137 +++++++++++++++++++++++++-------------- mathgenerator/mathgen.py | 15 +++-- 2 files changed, 96 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index a8c09dc..7643a53 100644 --- a/README.md +++ b/README.md @@ -30,53 +30,90 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| -| 0 | Addition | 29+33= | 62 | addition | -| 1 | Subtraction | 62-7= | 55 | subtraction | -| 2 | Multiplication | 93*1= | 93 | multiplication | -| 3 | Division | 59/47= | 1.2553191489361701 | division | -| 4 | Binary Complement 1s | 001110000 | 110001111 | binaryComplement1s | -| 5 | Modulo Division | 89%34= | 21 | moduloDivision | -| 6 | Square Root | sqrt(16)= | 4 | squareRoot | -| 7 | Power Rule Differentiation | 4x^3 | 12x^2 | powerRuleDifferentiation | -| 8 | Square | 12^2= | 144 | square | -| 9 | LCM (Least Common Multiple) | LCM of 10 and 1 = | 10 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 12 and 5 = | 1 | gcd | -| 11 | Basic Algebra | 8x + 7 = 10 | 3/8 | basicAlgebra | -| 12 | Logarithm | log3(729) | 6 | log | -| 13 | Easy Division | 378/21 = | 18 | intDivision | -| 14 | Decimal to Binary | Binary of 4= | 100 | decimalToBinary | -| 15 | Binary to Decimal | 10011 | 19 | binaryToDecimal | -| 16 | Fraction Division | (1/2)/(4/3) | 3/8 | fractionDivision | -| 17 | Integer Multiplication with 2x2 Matrix | 2 * [[0, 7], [7, 7]] = | [[0,14],[14,14]] | intMatrix22Multiplication | -| 18 | Area of Triangle | Area of triangle with side lengths: 9 14 15 = | 61.644140029689765 | areaOfTriangle | -| 19 | Triangle exists check | Does triangle with sides 33, 6 and 43 exist? | No | doesTriangleExist | -| 20 | Midpoint of the two point | (-15,-10),(-5,2)= | (-10.0,-4.0) | midPointOfTwoPoint | -| 21 | Factoring Quadratic | x^2-17x+72 | (x-9)(x-8) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 4 and 31 = | 145 | thirdAngleOfTriangle | -| 23 | Solve a System of Equations in R^2 | 4x - 8y = 48, 3x - 8y = 40 | x = 8, y = -2 | systemOfEquations | -| 24 | Distance between 2 points | Find the distance between (-9, -20) and (18, -19) | sqrt(730) | distance2Point | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 18 and 13 = | 22.20 | pythagoreanTheorem | -| 26 | Linear Equations | -11x + -16y = -302 , 1x + 20y = 250 | x = 10, y = 12 | linearEquations | -| 27 | Prime Factorisation | Find prime factors of 55 | [5, 11] | primeFactors | -| 28 | Fraction Multiplication | (4/9)*(8/10) | 16/45 | fractionMultiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 15 sides | 156.0 | angleRegularPolygon | -| 30 | Combinations of Objects | Number of combinations from 13 objects picked 1 at a time | 13 | combinations | -| 31 | Factorial | 2! = | 2 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 13m is | 1014 m^2 | surfaceAreaCubeGen | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 5m, 3m, 7m is | 142 m^2 | surfaceAreaCuboidGen | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 15m and radius = 7m is | 967 m^2 | surfaceAreaCylinderGen | -| 35 | Volum of Cube | Volume of cube with side = 11m is | 1331 m^3 | volumeCubeGen | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 6m, 1m, 10m is | 60 m^3 | volumeCuboidGen | -| 37 | Volume of cylinder | Volume of cylinder with height = 26m and radius = 15m is | 18378 m^3 | volumeCylinderGen | -| 38 | Surface Area of cone | Surface area of cone with height = 46m and radius = 14m is | 2730 m^2 | surfaceAreaConeGen | -| 39 | Volume of cone | Volume of cone with height = 7m and radius = 11m is | 886 m^3 | volumeConeGen | -| 40 | Common Factors | Common Factors of 91 and 51 = | [1] | commonFactors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 6/4x + 5 and y = -7/2x + 3 | (-2/5, 22/5) | intersectionOfTwoLines | -| 42 | Permutations | Number of Permutations from 13 objects picked 4 at a time = | 17160 | permutations | -| 43 | Cross Product of 2 Vectors | [-14, 13, 20] X [-5, -18, 19] = | [607, 166, 317] | vectorCross | -| 44 | Compare Fractions | Which symbol represents the comparison between 8/3 and 6/7? | > | compareFractions | -| 45 | Simple Interest | Simple interest for a principle amount of 6128 dollars, 5% rate of interest and for a time period of 5 years is = | 1532.0 | simpleInterest | -| 46 | Multiplication of two matrices | Multiply [[-20, -14, -88, -62, 39, 94, 21, 75, 26], [89, -67, -80, -60, 32, -23, -79, 11, -69], [13, -75, -66, 3, 67, -79, -49, 6, 36], [-44, -84, 68, -27, -86, -95, -71, -77, -62], [45, 58, 89, 82, 30, -83, -23, 51, 95], [11, 46, 100, -15, 60, -34, 85, 50, -44], [93, -100, -62, 63, -73, -64, 90, -15, 23], [-8, 91, -22, 53, -42, 25, 32, -26, 31], [-60, 90, 75, -42, 19, 33, -30, 74, 13]] and [[-80, 54, -39, 37, -99], [31, -28, -31, 64, 73], [-21, -34, -28, -21, -76], [-94, 55, 66, 0, 17], [-28, 25, -65, -74, 100], [76, 74, -96, -98, -5], [-90, -70, -66, -71, -35], [65, 49, -100, 72, -23], [-95, -97, -31, -84, -86]] | [[15409, 6508, -21665, -10161, 5326], [9859, 17962, 3267, 12768, 3119], [-8761, 1272, 8611, 738, 3881], [4489, -5790, 29652, 11947, -5940], [-22167, -8208, -1142, 6747, -10714], [-4628, -5167, -15527, 1404, 243], [-29240, -2432, 11103, 615, -22487], [-5498, -5038, 1462, -100, 2495], [18214, -3238, -15548, 3691, 6061]] | matrixMultiplication | -| 47 | Cube Root | cuberoot of 711 upto 2 decimal places is: | 8.93 | CubeRoot | -| 48 | Power Rule Integration | 3x^1 | (3/2)x^2 + c | powerRuleIntegration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 94 , 101, 102 = | 63 | fourthAngleOfQuadrilateral | +| 0 | Addition | 42+2= | 44 | addition | +| 1 | Subtraction | 32-26= | 6 | subtraction | +| 2 | Multiplication | 77*1= | 77 | multiplication | +| 3 | Division | 66/9= | 7.333333333333333 | division | +| 4 | Binary Complement 1s | 1010000 | 0101111 | binaryComplement1s | +| 5 | Modulo Division | 61%35= | 26 | moduloDivision | +| 6 | Square Root | sqrt(1)= | 1 | squareRoot | +| 7 | Power Rule Differentiation | 5x^5 | 25x^4 | powerRuleDifferentiation | +| 8 | Square | 20^2= | 400 | square | +| 9 | LCM (Least Common Multiple) | LCM of 19 and 5 = | 95 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 10 and 11 = | 1 | gcd | +| 11 | Basic Algebra | 3x + 7 = 8 | 1/3 | basicAlgebra | +| 12 | Logarithm | log2(128) | 7 | log | +| 13 | Easy Division | 306/18 = | 17 | intDivision | +| 14 | Decimal to Binary | Binary of 28= | 11100 | decimalToBinary | +| 15 | Binary to Decimal | 10001101 | 141 | binaryToDecimal | +| 16 | Fraction Division | (4/1)/(6/3) | 2 | fractionDivision | +| 17 | Integer Multiplication with 2x2 Matrix | 5 * [[10, 3], [0, 1]] = | [[50,15],[0,5]] | intMatrix22Multiplication | +| 18 | Area of Triangle | Area of triangle with side lengths: 13 2 14 = | 11.659223816361019 | areaOfTriangle | +| 19 | Triangle exists check | Does triangle with sides 3, 4 and 25 exist? | No | doesTriangleExist | +| 20 | Midpoint of the two point | (4,-11),(17,-5)= | (10.5,-8.0) | midPointOfTwoPoint | +| 21 | Factoring Quadratic | x^2-12x+35 | (x-7)(x-5) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 20 and 62 = | 98 | thirdAngleOfTriangle | +| 23 | Solve a System of Equations in R^2 | 5x - 7y = -84, 4x + 5y = 7 | x = -7, y = 7 | systemOfEquations | +| 24 | Distance between 2 points | Find the distance between (5, -18) and (1, 19) | sqrt(1385) | distance2Point | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 15 and 5 = | 15.81 | pythagoreanTheorem | +| 26 | Linear Equations | -6x + -17y = -220 +-13x + -19y = -120 | x = -20, y = 20 | linearEquations | +| 27 | Prime Factorisation | Find prime factors of 62 | [2, 31] | primeFactors | +| 28 | Fraction Multiplication | (8/4)*(1/2) | 1 | fractionMultiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 19 sides | 161.05 | angleRegularPolygon | +| 30 | Combinations of Objects | Number of combinations from 12 objects picked 1 at a time | 12 | combinations | +| 31 | Factorial | 0! = | 1 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 8m is | 384 m^2 | surfaceAreaCubeGen | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 18m, 17m, 1m is | 682 m^2 | surfaceAreaCuboidGen | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 31m and radius = 1m is | 201 m^2 | surfaceAreaCylinderGen | +| 35 | Volum of Cube | Volume of cube with side = 9m is | 729 m^3 | volumeCubeGen | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 20m, 1m, 10m is | 200 m^3 | volumeCuboidGen | +| 37 | Volume of cylinder | Volume of cylinder with height = 7m and radius = 7m is | 1077 m^3 | volumeCylinderGen | +| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 13m is | 2522 m^2 | surfaceAreaConeGen | +| 39 | Volume of cone | Volume of cone with height = 4m and radius = 4m is | 67 m^3 | volumeConeGen | +| 40 | Common Factors | Common Factors of 20 and 90 = | [1, 2, 5, 10] | commonFactors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -3/6x + 1 and y = 0/2x + 6 | (-10, 6) | intersectionOfTwoLines | +| 42 | Permutations | Number of Permutations from 11 objects picked 2 at a time = | 110 | permutations | +| 43 | Cross Product of 2 Vectors | [-19, -3, 2] X [-15, -12, 7] = | [3, 103, 183] | vectorCross | +| 44 | Compare Fractions | Which symbol represents the comparison between 8/6 and 3/1? | < | compareFractions | +| 45 | Simple Interest | Simple interest for a principle amount of 9862 dollars, 4% rate of interest and for a time period of 1 years is = | 394.48 | simpleInterest | +| 46 | Multiplication of two matrices | Multiply + -50 36 7 -26 -2 63 + 88 -37 60 -19 61 -56 + 48 -5 69 -87 -64 -92 + -84 -50 -79 -19 86 -13 + 0 28 12 -14 73 -49 + 94 -90 2 26 -38 19 + 2 -11 79 -77 98 -77 + -87 70 72 -32 64 -99 + + and + + 34 32 -6 -32 46 -23 78 -81 -18 + -17 24 49 -62 -50 77 38 -98 -64 + -23 -78 43 5 -83 -5 4 -92 -16 + 46 -47 -92 52 -25 -37 44 51 -7 + 20 26 70 37 96 -73 49 84 42 + -72 -15 -80 -24 58 -47 -41 45 -69 | -8245 -1057 -423 -3535 -569 2034 -6329 1219 -5765 + 6619 567 10737 2391 4001 -6291 10147 -7387 6383 + 1472 -161 13318 -5565 -12574 10381 638 -23699 2621 + 1593 5598 3465 7899 13170 -6487 -4857 24642 10618 + 3592 3027 12206 1473 2120 -412 6082 -635 4561 + 3748 -1803 -11460 2072 5462 -8183 2423 11 947 + 2400 960 22950 2483 952 -1974 4625 -5512 9372 + 1132 -2067 22392 1884 -12276 8196 1949 -7148 5677 | matrixMultiplication | +| 47 | Cube Root | cuberoot of 771 upto 2 decimal places is: | 9.17 | CubeRoot | +| 48 | Power Rule Integration | 1x^3 + 8x^8 + 10x^10 | (1/3)x^4 + (8/8)x^9 + (10/10)x^11 + c | powerRuleIntegration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 52 , 84, 154 = | 70 | fourthAngleOfQuadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 51x^2+152x+80=0 | [-0.68, -2.3] | quadraticEquationSolve | +| 51 | HCF (Highest Common Factor) | HCF of 11 and 7 = | 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 11 = | 2/36 | diceSumProbability | +| 53 | Exponentiation | 9^9 = | 387420489 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [291, 254, 274, 207, 253, 289, 268, 280, 225, 240, 278, 270, 247, 252, 211, 212, 295, 241, 290, 206, 222, 263, 264, 228, 229, 256, 209, 292] with 99% confidence is | (265.560249263099, 237.72546502261523) | confidenceInterval | +| 55 | Comparing surds | Fill in the blanks 16^(1/7) _ 67^(1/6) | < | surdsComparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 11 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | fibonacciSeries | +| 57 | Trigonometric Values | What is cos(60)? | 1/2 | basicTrigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | +| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | +| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 28971a8..610e821 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -914,13 +914,16 @@ def surfaceAreaSphere(maxSide = 20, unit = 'm'): ans = 4 * math.pi * r * r solution = f"{ans} {unit}^2" return problem, solution - +def volumeSphereFunc(maxRadius = 100): + r=random.randint(1,maxRadius) + problem=f"Volume of sphere with radius {r} m = " + ans=(4*math.pi/3)*r*r*r + solution = f"{ans} m^3" + return problem,solution # || Class Instances # Format is: # <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) - - addition = Generator("Addition", 0, "a+b=", "c", additionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc) multiplication = Generator("Multiplication", 2, "a*b=", "c", multiplicationFunc) @@ -944,8 +947,7 @@ doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with s midPointOfTwoPoint = Generator("Midpoint of the two point", 20, "((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) -systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", - systemOfEquationsFunc) +systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3",systemOfEquationsFunc) distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) # This has multiple variables whereas #23 has only x and y @@ -982,4 +984,5 @@ fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a n basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) -surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) \ No newline at end of file +surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) +volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) From f8318be9776731db46be03fe86347b9184462e13 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 19:16:29 -0400 Subject: [PATCH 33/79] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4a578ab..0b546c2 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='mathgenerator', - version='1.1.2', + version='1.1.3', description='An open source solution for generating math problems', url='https://github.com/todarith/mathgenerator', author='Luke Weiler', From 07314e280d4dc336edf206567629d8c4504c3641 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 21:15:10 -0400 Subject: [PATCH 34/79] Update issue templates --- .github/ISSUE_TEMPLATE/new-generator-idea.md | 16 ++++++++++++++++ .../request-changes-to-a-generator.md | 12 ++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/new-generator-idea.md create mode 100644 .github/ISSUE_TEMPLATE/request-changes-to-a-generator.md diff --git a/.github/ISSUE_TEMPLATE/new-generator-idea.md b/.github/ISSUE_TEMPLATE/new-generator-idea.md new file mode 100644 index 0000000..b986c9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-generator-idea.md @@ -0,0 +1,16 @@ +--- +name: New Generator Idea +about: Use this template if you have an idea for a new generator. +title: '' +labels: New generator, hacktoberfest +assignees: '' + +--- + +**Example Problem:** + +**Example Solution:** + +**Further explanation:** + +**Would you like to be assigned to this:** diff --git a/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md b/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md new file mode 100644 index 0000000..9fa48e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md @@ -0,0 +1,12 @@ +--- +name: Request changes to a generator +about: If you find a faulty generator that needs a fix, use this template. +title: '' +labels: bug, hacktoberfest +assignees: '' + +--- + +**Name or Id of generator:** + +**Issue:** From 83e31cdce738ec7b52dd52d29b961529d89306a2 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 21:16:44 -0400 Subject: [PATCH 35/79] Update issue templates --- .github/ISSUE_TEMPLATE/custom-issue.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/custom-issue.md diff --git a/.github/ISSUE_TEMPLATE/custom-issue.md b/.github/ISSUE_TEMPLATE/custom-issue.md new file mode 100644 index 0000000..77fd3e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom-issue.md @@ -0,0 +1,10 @@ +--- +name: Custom Issue +about: If your issue lies outside of the other templates +title: '' +labels: '' +assignees: '' + +--- + + From 7802bdbdb428e24d3d73c213992c496df332cfb6 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 21:18:08 -0400 Subject: [PATCH 36/79] Update issue templates --- .github/ISSUE_TEMPLATE/other-issue.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/other-issue.md diff --git a/.github/ISSUE_TEMPLATE/other-issue.md b/.github/ISSUE_TEMPLATE/other-issue.md new file mode 100644 index 0000000..7b37378 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other-issue.md @@ -0,0 +1,10 @@ +--- +name: Other Issue +about: If your issue lies outside of the other templates +title: '' +labels: '' +assignees: '' + +--- + + From 4331db74d0010319fa50707798700f2d1a3fef35 Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Sat, 17 Oct 2020 21:20:20 -0400 Subject: [PATCH 37/79] Remove custom issue template --- .github/ISSUE_TEMPLATE/custom-issue.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/custom-issue.md diff --git a/.github/ISSUE_TEMPLATE/custom-issue.md b/.github/ISSUE_TEMPLATE/custom-issue.md deleted file mode 100644 index 77fd3e9..0000000 --- a/.github/ISSUE_TEMPLATE/custom-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Custom Issue -about: If your issue lies outside of the other templates -title: '' -labels: '' -assignees: '' - ---- - - From 39d9040da26095bca5632b31e25d245c868f8a71 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 08:43:41 +0530 Subject: [PATCH 38/79] Added function geometric progression --- mathgenerator/mathgen.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..f149213 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -899,10 +899,6 @@ def dataSummaryFunc(number_values=15,minval=5,maxval=50): var=0 for i in range(number_values): var+=(random_list[i]-mean)**2 - print(random_list) - print(mean) - print(var/number_values) - print((var/number_values)**0.5) problem="Find the mean,standard deviation and variance for the data"+str(random_list) solution="The Mean is {} , Standard Deviation is {}, Variance is {}".format(mean,var/number_values,(var/number_values)**0.5) return problem,solution @@ -920,6 +916,30 @@ def volumeSphereFunc(maxRadius = 100): ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" return problem,solution + + +def GeomProgrFunc(number_values=6,min_value=2,max_value=12,n_term=7,sum_term=5): + r=random.randint(min_value,max_value) + a=random.randint(min_value,max_value) + n_term=random.randint(number_values,number_values+5) + sum_term=random.randint(number_values,number_values+5) + GP=[] + for i in range(number_values): + GP.append(a*(r**i)) + problem="For the given GP "+str(GP)+" ,Find the value of a,common ratio,"+str(n_term)+"th term value, sum upto "+str(sum_term)+"th term" + value_nth_term=a*(r**(n_term-1)) + sum_till_nth_term=a*((r**sum_term-1)/(r-1)) + 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) + return problem,solution + + + + + + + + + # || Class Instances # Format is: @@ -986,3 +1006,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +geometricprogression=Generator("Geometric Progression",61,"Initial value,Common Ratio,nth Term,Sum till nth term =","a,r,ar^n-1,sum(ar^n-1",GeomProgrFunc) \ No newline at end of file From 48a376ebe883886cb1ef66b8e6a8af0dd9c51d5a Mon Sep 17 00:00:00 2001 From: Swayam Gupta <guptaswayam075@gmail.com> Date: Sun, 18 Oct 2020 09:02:12 +0530 Subject: [PATCH 39/79] added geometricMeanFunc and updated README.md --- README.md | 167 ++++++++++++++++++++------------------- mathgenerator/mathgen.py | 29 ++++++- 2 files changed, 113 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 7643a53..9d38701 100644 --- a/README.md +++ b/README.md @@ -30,90 +30,93 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| -| 0 | Addition | 42+2= | 44 | addition | -| 1 | Subtraction | 32-26= | 6 | subtraction | -| 2 | Multiplication | 77*1= | 77 | multiplication | -| 3 | Division | 66/9= | 7.333333333333333 | division | -| 4 | Binary Complement 1s | 1010000 | 0101111 | binaryComplement1s | -| 5 | Modulo Division | 61%35= | 26 | moduloDivision | -| 6 | Square Root | sqrt(1)= | 1 | squareRoot | -| 7 | Power Rule Differentiation | 5x^5 | 25x^4 | powerRuleDifferentiation | -| 8 | Square | 20^2= | 400 | square | -| 9 | LCM (Least Common Multiple) | LCM of 19 and 5 = | 95 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 10 and 11 = | 1 | gcd | -| 11 | Basic Algebra | 3x + 7 = 8 | 1/3 | basicAlgebra | -| 12 | Logarithm | log2(128) | 7 | log | -| 13 | Easy Division | 306/18 = | 17 | intDivision | -| 14 | Decimal to Binary | Binary of 28= | 11100 | decimalToBinary | -| 15 | Binary to Decimal | 10001101 | 141 | binaryToDecimal | -| 16 | Fraction Division | (4/1)/(6/3) | 2 | fractionDivision | -| 17 | Integer Multiplication with 2x2 Matrix | 5 * [[10, 3], [0, 1]] = | [[50,15],[0,5]] | intMatrix22Multiplication | -| 18 | Area of Triangle | Area of triangle with side lengths: 13 2 14 = | 11.659223816361019 | areaOfTriangle | -| 19 | Triangle exists check | Does triangle with sides 3, 4 and 25 exist? | No | doesTriangleExist | -| 20 | Midpoint of the two point | (4,-11),(17,-5)= | (10.5,-8.0) | midPointOfTwoPoint | -| 21 | Factoring Quadratic | x^2-12x+35 | (x-7)(x-5) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 20 and 62 = | 98 | thirdAngleOfTriangle | -| 23 | Solve a System of Equations in R^2 | 5x - 7y = -84, 4x + 5y = 7 | x = -7, y = 7 | systemOfEquations | -| 24 | Distance between 2 points | Find the distance between (5, -18) and (1, 19) | sqrt(1385) | distance2Point | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 15 and 5 = | 15.81 | pythagoreanTheorem | -| 26 | Linear Equations | -6x + -17y = -220 --13x + -19y = -120 | x = -20, y = 20 | linearEquations | -| 27 | Prime Factorisation | Find prime factors of 62 | [2, 31] | primeFactors | -| 28 | Fraction Multiplication | (8/4)*(1/2) | 1 | fractionMultiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 19 sides | 161.05 | angleRegularPolygon | -| 30 | Combinations of Objects | Number of combinations from 12 objects picked 1 at a time | 12 | combinations | -| 31 | Factorial | 0! = | 1 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 8m is | 384 m^2 | surfaceAreaCubeGen | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 18m, 17m, 1m is | 682 m^2 | surfaceAreaCuboidGen | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 31m and radius = 1m is | 201 m^2 | surfaceAreaCylinderGen | -| 35 | Volum of Cube | Volume of cube with side = 9m is | 729 m^3 | volumeCubeGen | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 20m, 1m, 10m is | 200 m^3 | volumeCuboidGen | -| 37 | Volume of cylinder | Volume of cylinder with height = 7m and radius = 7m is | 1077 m^3 | volumeCylinderGen | -| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 13m is | 2522 m^2 | surfaceAreaConeGen | -| 39 | Volume of cone | Volume of cone with height = 4m and radius = 4m is | 67 m^3 | volumeConeGen | -| 40 | Common Factors | Common Factors of 20 and 90 = | [1, 2, 5, 10] | commonFactors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -3/6x + 1 and y = 0/2x + 6 | (-10, 6) | intersectionOfTwoLines | -| 42 | Permutations | Number of Permutations from 11 objects picked 2 at a time = | 110 | permutations | -| 43 | Cross Product of 2 Vectors | [-19, -3, 2] X [-15, -12, 7] = | [3, 103, 183] | vectorCross | -| 44 | Compare Fractions | Which symbol represents the comparison between 8/6 and 3/1? | < | compareFractions | -| 45 | Simple Interest | Simple interest for a principle amount of 9862 dollars, 4% rate of interest and for a time period of 1 years is = | 394.48 | simpleInterest | +| 0 | Addition | 37+40= | 77 | addition | +| 1 | Subtraction | 69-59= | 10 | subtraction | +| 2 | Multiplication | 18*0= | 0 | multiplication | +| 3 | Division | 66/25= | 2.64 | division | +| 4 | Binary Complement 1s | 00 | 11 | binaryComplement1s | +| 5 | Modulo Division | 37%68= | 37 | moduloDivision | +| 6 | Square Root | sqrt(4)= | 2 | squareRoot | +| 7 | Power Rule Differentiation | 6x^3 + 7x^5 + 6x^4 | 18x^2 + 35x^4 + 24x^3 | powerRuleDifferentiation | +| 8 | Square | 19^2= | 361 | square | +| 9 | LCM (Least Common Multiple) | LCM of 8 and 4 = | 8 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 20 and 1 = | 1 | gcd | +| 11 | Basic Algebra | 9x + 7 = 10 | 1/3 | basicAlgebra | +| 12 | Logarithm | log3(9) | 2 | log | +| 13 | Easy Division | 48/24 = | 2 | intDivision | +| 14 | Decimal to Binary | Binary of 69= | 1000101 | decimalToBinary | +| 15 | Binary to Decimal | 0010101100 | 172 | binaryToDecimal | +| 16 | Fraction Division | (8/2)/(7/5) | 20/7 | fractionDivision | +| 17 | Integer Multiplication with 2x2 Matrix | 10 * [[0, 3], [10, 5]] = | [[0,30],[100,50]] | intMatrix22Multiplication | +| 18 | Area of Triangle | Area of triangle with side lengths: 16 1 19 = | (1.5148044320877339e-15+24.73863375370596j) | areaOfTriangle | +| 19 | Triangle exists check | Does triangle with sides 24, 25 and 24 exist? | Yes | doesTriangleExist | +| 20 | Midpoint of the two point | (-15,2),(12,-5)= | (-1.5,-1.5) | midPointOfTwoPoint | +| 21 | Factoring Quadratic | x^2-2x-3 | (x+1)(x-3) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 65 and 78 = | 37 | thirdAngleOfTriangle | +| 23 | Solve a System of Equations in R^2 | 2x - 8y = -58, 3x - 4y = -31 | x = -1, y = 7 | systemOfEquations | +| 24 | Distance between 2 points | Find the distance between (21, 15) and (7, -4) | sqrt(557) | distance2Point | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 20 and 20 = | 28.28 | pythagoreanTheorem | +| 26 | Linear Equations | -19x + -4y = 231 +13x + 18y = -387 | x = -9, y = -15 | linearEquations | +| 27 | Prime Factorisation | Find prime factors of 185 | [5, 37] | primeFactors | +| 28 | Fraction Multiplication | (4/10)*(4/9) | 8/45 | fractionMultiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 17 sides | 158.82 | angleRegularPolygon | +| 30 | Combinations of Objects | Number of combinations from 10 objects picked 1 at a time | 10 | combinations | +| 31 | Factorial | 3! = | 6 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 16m is | 1536 m^2 | surfaceAreaCubeGen | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 6m, 7m, 17m is | 526 m^2 | surfaceAreaCuboidGen | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 19m and radius = 4m is | 578 m^2 | surfaceAreaCylinderGen | +| 35 | Volum of Cube | Volume of cube with side = 7m is | 343 m^3 | volumeCubeGen | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 1m, 17m, 18m is | 306 m^3 | volumeCuboidGen | +| 37 | Volume of cylinder | Volume of cylinder with height = 16m and radius = 10m is | 5026 m^3 | volumeCylinderGen | +| 38 | Surface Area of cone | Surface area of cone with height = 36m and radius = 3m is | 368 m^2 | surfaceAreaConeGen | +| 39 | Volume of cone | Volume of cone with height = 21m and radius = 6m is | 791 m^3 | volumeConeGen | +| 40 | Common Factors | Common Factors of 31 and 79 = | [1] | commonFactors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 5x and y = -8/3x - 7 | (-21/23, -105/23) | intersectionOfTwoLines | +| 42 | Permutations | Number of Permutations from 13 objects picked 3 at a time = | 1716 | permutations | +| 43 | Cross Product of 2 Vectors | [10, 11, -18] X [-2, 13, -2] = | [212, 56, 152] | vectorCross | +| 44 | Compare Fractions | Which symbol represents the comparison between 4/2 and 4/1? | < | compareFractions | +| 45 | Simple Interest | Simple interest for a principle amount of 5369 dollars, 1% rate of interest and for a time period of 9 years is = | 483.21 | simpleInterest | | 46 | Multiplication of two matrices | Multiply - -50 36 7 -26 -2 63 - 88 -37 60 -19 61 -56 - 48 -5 69 -87 -64 -92 - -84 -50 -79 -19 86 -13 - 0 28 12 -14 73 -49 - 94 -90 2 26 -38 19 - 2 -11 79 -77 98 -77 - -87 70 72 -32 64 -99 + -16 87 100 -5 -69 97 -75 19 + 90 -83 -16 81 -30 64 -3 -96 + -74 -66 48 99 35 6 -14 70 + -24 67 -4 -95 4 51 31 -17 + 61 46 -72 66 -31 15 61 -31 + 84 63 78 -51 -11 -38 -68 -50 + 82 83 16 -100 17 2 8 -83 + 28 71 -68 -66 37 -84 79 32 and - 34 32 -6 -32 46 -23 78 -81 -18 - -17 24 49 -62 -50 77 38 -98 -64 - -23 -78 43 5 -83 -5 4 -92 -16 - 46 -47 -92 52 -25 -37 44 51 -7 - 20 26 70 37 96 -73 49 84 42 - -72 -15 -80 -24 58 -47 -41 45 -69 | -8245 -1057 -423 -3535 -569 2034 -6329 1219 -5765 - 6619 567 10737 2391 4001 -6291 10147 -7387 6383 - 1472 -161 13318 -5565 -12574 10381 638 -23699 2621 - 1593 5598 3465 7899 13170 -6487 -4857 24642 10618 - 3592 3027 12206 1473 2120 -412 6082 -635 4561 - 3748 -1803 -11460 2072 5462 -8183 2423 11 947 - 2400 960 22950 2483 952 -1974 4625 -5512 9372 - 1132 -2067 22392 1884 -12276 8196 1949 -7148 5677 | matrixMultiplication | -| 47 | Cube Root | cuberoot of 771 upto 2 decimal places is: | 9.17 | CubeRoot | -| 48 | Power Rule Integration | 1x^3 + 8x^8 + 10x^10 | (1/3)x^4 + (8/8)x^9 + (10/10)x^11 + c | powerRuleIntegration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 52 , 84, 154 = | 70 | fourthAngleOfQuadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 51x^2+152x+80=0 | [-0.68, -2.3] | quadraticEquationSolve | -| 51 | HCF (Highest Common Factor) | HCF of 11 and 7 = | 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 11 = | 2/36 | diceSumProbability | -| 53 | Exponentiation | 9^9 = | 387420489 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [291, 254, 274, 207, 253, 289, 268, 280, 225, 240, 278, 270, 247, 252, 211, 212, 295, 241, 290, 206, 222, 263, 264, 228, 229, 256, 209, 292] with 99% confidence is | (265.560249263099, 237.72546502261523) | confidenceInterval | -| 55 | Comparing surds | Fill in the blanks 16^(1/7) _ 67^(1/6) | < | surdsComparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 11 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | fibonacciSeries | -| 57 | Trigonometric Values | What is cos(60)? | 1/2 | basicTrigonometry | + 50 -78 66 -8 -33 -61 -75 -18 -50 + -98 10 -66 -53 -24 -36 62 -39 -35 + 86 -52 -49 47 62 0 -12 96 55 + 61 41 -77 -89 46 -44 50 4 -81 + -12 -88 -88 9 83 62 60 -22 15 + 26 -3 44 -60 83 100 -35 97 26 + -17 -93 -5 79 55 78 32 0 -45 + -17 -54 -92 -48 -88 46 82 -22 12 | 3271 8443 -2346 -12616 937 -1490 -3233 16984 8750 + 19906 4214 20268 -4021 12861 -6176 -19662 9385 -8839 + 11719 1099 -19689 -6976 8029 7432 13014 7182 2782 +-12865 -3615 4806 5149 2332 10216 -695 2288 6117 + -3372 836 5371 -7056 210 -5371 -534 -6721 -17158 + 2773 -1963 5727 3403 -5201 -17234 -11486 971 3323 + -7635 -8262 13038 9246 1015 -5530 -11796 -1931 926 +-19947 -12723 -4715 8769 -12252 168 10130 -19731 -7079 | matrixMultiplication | +| 47 | Cube Root | cuberoot of 136 upto 2 decimal places is: | 5.14 | CubeRoot | +| 48 | Power Rule Integration | 9x^4 + 8x^6 + 2x^5 + 3x^10 + 2x^9 | (9/4)x^5 + (8/6)x^7 + (2/5)x^6 + (3/10)x^11 + (2/9)x^10 + c | powerRuleIntegration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 69 , 87, 120 = | 84 | fourthAngleOfQuadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 71x^2+188x+17=0 | [-0.09, -2.55] | quadraticEquationSolve | +| 51 | HCF (Highest Common Factor) | HCF of 3 and 16 = | 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 8 = | 21/216 | diceSumProbability | +| 53 | Exponentiation | 9^3 = | 729 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [203, 266, 261, 263, 262, 251, 267, 248, 208, 228, 215, 221, 282, 242, 272, 281, 289, 290, 285, 217, 213, 200, 292, 256, 232, 273, 295, 271, 211, 250, 231, 246, 277, 259, 283, 233] with 90% confidence is | (259.72847423786504, 244.32708131769053) | confidenceInterval | +| 55 | Comparing surds | Fill in the blanks 50^(1/7) _ 86^(1/5) | < | surdsComparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 3 numbers is ? | [0, 1, 1] | fibonacciSeries | +| 57 | Trigonometric Values | What is tan(45)? | 1 | basicTrigonometry | | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | -| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[10, 25, 12, 26, 15, 13, 41, 25, 50, 13, 20, 22, 42, 36, 22] | The Mean is 24.8 , Standard Deviation is 141.09333333333333, Variance is 11.87827147918978 | dataSummary | +| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 5m is | 314.1592653589793 m^2 | surfaceAreaSphereGen | +| 60 | Volume of Sphere | Volume of sphere with radius 70 m = | 1436755.0402417318 m^3 | volumeSphere | +| 61 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 9 and 5 = | (9*5)^(1/2) = 6.708203932499369 | geometricMean | diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 610e821..402b513 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -919,7 +919,33 @@ def volumeSphereFunc(maxRadius = 100): problem=f"Volume of sphere with radius {r} m = " ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" - return problem,solution + return problem,solution +def geometricMeanFunc(maxValue=100, maxNum=4): + + a=random.randint(1,maxValue) + b=random.randint(1,maxValue) + c=random.randint(1,maxValue) + d=random.randint(1,maxValue) + num=random.randint(2,4) + if num==2: + product=a*b + elif num==3: + product=a*b*c + elif num==4: + product=a*b*c*d + + ans=product**(1/num) + if num==2: + problem=f"Geometric mean of {num} numbers {a} and {b} = " + solution = f"({a}*{b})^(1/{num}) = {ans}" + elif num==3: + problem=f"Geometric mean of {num} numbers {a} , {b} and {c} = " + solution = f"({a}*{b}*{c})^(1/{num}) = {ans}" + elif num==4: + problem=f"Geometric mean of {num} numbers {a} , {b} , {c} , {d} = " + solution = f"({a}*{b}*{c}*{d})^(1/{num}) = {ans}" + return problem,solution + # || Class Instances # Format is: @@ -986,3 +1012,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +geometricMean=Generator("Geometric Mean of N Numbers",61,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) \ No newline at end of file From 7ae1e3cc1413c26f2dd4a8ac6674967766c935b5 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 09:03:00 +0530 Subject: [PATCH 40/79] pylint for GP and Generators part --- mathgenerator/mathgen.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index f149213..67dfa48 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1000,10 +1000,10 @@ diceSumProbability=Generator("Probability of a certain sum appearing on faces of exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc) confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) -basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) +fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers", "prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc) +basicTrigonometry=Generator("Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc) sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) -surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) -volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) -geometricprogression=Generator("Geometric Progression",61,"Initial value,Common Ratio,nth Term,Sum till nth term =","a,r,ar^n-1,sum(ar^n-1",GeomProgrFunc) \ No newline at end of file +surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) +volumeSphere=Generator("Volume of Sphere", 60, "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) +geometricprogression=Generator("Geometric Progression", 61, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", GeomProgrFunc) \ No newline at end of file From 3ac7236ea652b456bac9919254dda11c0531d909 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 09:06:03 +0530 Subject: [PATCH 41/79] trying out lint --- mathgenerator/mathgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 67dfa48..647c1df 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,3 +1,4 @@ +# for lint import random import math import fractions @@ -918,7 +919,7 @@ def volumeSphereFunc(maxRadius = 100): return problem,solution -def GeomProgrFunc(number_values=6,min_value=2,max_value=12,n_term=7,sum_term=5): +def GeomProgrFunc(number_values=6, min_value=2, max_value=12, n_term=7, sum_term=5): r=random.randint(min_value,max_value) a=random.randint(min_value,max_value) n_term=random.randint(number_values,number_values+5) From 63de4180dc512d10dc90a4e2d311373f776ade44 Mon Sep 17 00:00:00 2001 From: Swayam Gupta <guptaswayam075@gmail.com> Date: Sun, 18 Oct 2020 09:07:43 +0530 Subject: [PATCH 42/79] added geometricMeanFunc and updated README.md --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 12a3f16..8bf09dd 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1012,4 +1012,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) -geometricMean=Generator("Geometric Mean of N Numbers",61,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) \ No newline at end of file +geometricMean=Generator("Geometric Mean of N Numbers",61,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) From c94a59604220b660f22da5e248d15dd1e23fdcd0 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 09:09:16 +0530 Subject: [PATCH 43/79] flake8 comments --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 647c1df..e4d5e3a 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,4 +1,4 @@ -# for lint + # for lint import random import math import fractions From 716c3666f157c89ea6869087d71140b1cd3cb66f Mon Sep 17 00:00:00 2001 From: NarayanAdithya <narayanadithya1234@gmail.com> Date: Sun, 18 Oct 2020 09:15:21 +0530 Subject: [PATCH 44/79] Flake for 797+ lines --- mathgenerator/mathgen.py | 41 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index e4d5e3a..b2d7837 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,4 +1,3 @@ - # for lint import random import math import fractions @@ -79,7 +78,7 @@ def binaryComplement1sFunc(maxDigits=10): question += temp answer += "0" if temp == "1" else "1" - problem = question+"=" + problem = question + "=" solution = answer return problem, solution @@ -783,6 +782,7 @@ def quadraticEquation(maxVal=100): solution = str([round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]) return problem, solution + def hcfFunc(maxVal=20): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -793,25 +793,26 @@ def hcfFunc(maxVal=20): solution = str(x) return problem, solution + def DiceSumProbFunc(maxDice=3): - a = random.randint(1,maxDice) - b = random.randint(a,6*a) - count=0 - for i in [1,2,3,4,5,6]: - if a==1: - if i==b: - count=count+1 - elif a==2: - for j in [1,2,3,4,5,6]: - if i+j==b: - count=count+1 - elif a==3: - for j in [1,2,3,4,5,6]: - for k in [1,2,3,4,5,6]: - if i+j+k==b: - count=count+1 - problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a,b) - solution="{}/{}".format(count, 6**a) + a = random.randint(1, maxDice) + b = random.randint(a, 6 * a) + count = 0 + for i in [1, 2, 3, 4, 5, 6]: + if a == 1: + if i == b: + count = count + 1 + elif a == 2 : + for j in [1, 2, 3, 4, 5, 6]: + if i + j == b: + count= count + 1 + elif a == 3: + for j in [1, 2, 3, 4, 5, 6]: + for k in [1, 2, 3, 4, 5, 6]: + if i + j + k == b: + count= count + 1 + problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a, b) + solution="{}/{}".format(count, 6 ** a) return problem, solution def exponentiationFunc(maxBase = 20,maxExpo = 10): From 26173e3dc9a3396e7849f1612155465e27a7d570 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <57533346+NarayanAdithya@users.noreply.github.com> Date: Sun, 18 Oct 2020 09:24:47 +0530 Subject: [PATCH 45/79] Update Readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7643a53..7034023 100644 --- a/README.md +++ b/README.md @@ -117,3 +117,4 @@ problem, solution = mathgen.genById(0) | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | | 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | | 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | +| 61 | Geometric Progression | Given [2,4,8] find a,r,4th term, sum to 3rd term| 2,2,16,14 | GeomProgrFunc From 0d4387c7cda7251e4e027eebc49ca5949e55a277 Mon Sep 17 00:00:00 2001 From: NarayanAdithya <57533346+NarayanAdithya@users.noreply.github.com> Date: Sun, 18 Oct 2020 09:25:12 +0530 Subject: [PATCH 46/79] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7034023..342105f 100644 --- a/README.md +++ b/README.md @@ -117,4 +117,4 @@ problem, solution = mathgen.genById(0) | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | | 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | | 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | -| 61 | Geometric Progression | Given [2,4,8] find a,r,4th term, sum to 3rd term| 2,2,16,14 | GeomProgrFunc +| 61 | Geometric Progression | Given [2,4,8] find a,r,4th term, sum to 3rd term| 2,2,16,14 | GeomProgrFunc | From bbe80963ef75b03e82bf24a2ae8eb51a18db4482 Mon Sep 17 00:00:00 2001 From: Sajag Swami <65067354+SunTzunami@users.noreply.github.com> Date: Sun, 18 Oct 2020 11:47:10 +0530 Subject: [PATCH 47/79] Rectified the "fourthAngleOfQuadriFunc" function. The previous version of this function generated angles for convex quadrilaterals only. The new version generates angles for concave quadrilateral as well. --- mathgenerator/mathgen.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..1ee6bb5 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -758,18 +758,23 @@ def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): solution = solution + " + c" return problem, solution - -def fourthAngleOfQuadriFunc(maxAngle=180): - angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, 240 - angle1) - angle3 = random.randint(1, 340 - (angle1 + angle2)) - sum_ = angle1 + angle2 + angle3 - angle4 = 360 - sum_ - problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" - solution = angle4 +def fourthAngleOfQuadriFunc(total=360): + def rand_anglesquad(): + a=180 + b=0 + c=0 + d=0 + while(c==0 or d==0): + a=random.randint(1, total-20) + b=random.randint(1, total-a-10) + c=random.randint(1, total-a-b) + d=total-a-b-c + return a, b, c, d + a, b, c, d=rand_anglesquad() + problem="Fourth angle of a quadrilateral with three angles {}, {}, {} (in degrees)".format(a, b, c) + solution=d return problem, solution - def quadraticEquation(maxVal=100): a = random.randint(1, maxVal) c = random.randint(1, maxVal) @@ -909,11 +914,11 @@ def dataSummaryFunc(number_values=15,minval=5,maxval=50): def surfaceAreaSphere(maxSide = 20, unit = 'm'): r = random.randint(1, maxSide) - problem = f"Surface area of Sphere with radius = {r}{unit} is" ans = 4 * math.pi * r * r solution = f"{ans} {unit}^2" return problem, solution + def volumeSphereFunc(maxRadius = 100): r=random.randint(1,maxRadius) problem=f"Volume of sphere with radius {r} m = " @@ -973,7 +978,7 @@ simpleInterest = Generator("Simple Interest", 45, "Simple interest for a princip matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) -fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) +fourthAngleOfQuadrilateral = Generator("Fourth angle of a quadrilateral", 49, "Fourth angle of a uadrilateral with angles 100, 50, 80 (in degrees)=", "130", fourthAngleOfQuadriFunc) quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc) diceSumProbability=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) From dcd2d1e89e917b26fe1f4d69b17353cf1896c60d Mon Sep 17 00:00:00 2001 From: Sajag Swami <65067354+SunTzunami@users.noreply.github.com> Date: Sun, 18 Oct 2020 11:48:17 +0530 Subject: [PATCH 48/79] rectified a typo --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1ee6bb5..18a508c 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -978,7 +978,7 @@ simpleInterest = Generator("Simple Interest", 45, "Simple interest for a princip matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) -fourthAngleOfQuadrilateral = Generator("Fourth angle of a quadrilateral", 49, "Fourth angle of a uadrilateral with angles 100, 50, 80 (in degrees)=", "130", fourthAngleOfQuadriFunc) +fourthAngleOfQuadrilateral = Generator("Fourth angle of a quadrilateral", 49, "Fourth angle of a quadrilateral with angles 100, 50, 80 (in degrees)=", "130", fourthAngleOfQuadriFunc) quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc) diceSumProbability=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) From 0ab9edf57bffa4092940d8126434d612ce75bd46 Mon Sep 17 00:00:00 2001 From: Yuval Goldberg <yuvigoldi@hotmail.com> Date: Sun, 18 Oct 2020 11:16:48 +0300 Subject: [PATCH 49/79] Fix lint errors, adding a formatter --- Makefile | 8 +- dev-requirements.txt | 3 +- makeReadme.py | 12 +- mathgenerator/mathgen.py | 377 ++++++++++++++++++++++++--------------- 4 files changed, 247 insertions(+), 153 deletions(-) diff --git a/Makefile b/Makefile index bd04e35..9414a0b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,11 @@ -FLAKE_FLAGS = --ignore=E501,F401,F403,F405 +IGNORE_ERRORS = E501,F401,F403,F405 +PKG = mathgenerator + +format: + python -m autopep8 --ignore=$(IGNORE_ERRORS) -i $(PKG)/* lint: - python -m flake8 $(FLAKE_FLAGS) + python -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) test: python -m pytest --verbose -s tests diff --git a/dev-requirements.txt b/dev-requirements.txt index 6e46af4..c29cf4e 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,3 +1,4 @@ pytest hypothesis -flake8 \ No newline at end of file +flake8 +autopep8 \ No newline at end of file diff --git a/makeReadme.py b/makeReadme.py index 7ca8f2c..64f7989 100644 --- a/makeReadme.py +++ b/makeReadme.py @@ -1,10 +1,10 @@ -#To use, paste at bottom of mathgen.py code, change line variable and remove all table rows in README.md except for the top 2 and run mathgen.py +# To use, paste at bottom of mathgen.py code, change line variable and remove all table rows in README.md except for the top 2 and run mathgen.py wList = getGenList() allRows = [] -f=open('mathgen.py') -lines=f.readlines() -line = 720 #This has to be changed depending on which line the first generator appears on +f = open('mathgen.py') +lines = f.readlines() +line = 720 # This has to be changed depending on which line the first generator appears on for item in wList: myGen = item[2] prob, sol = myGen() @@ -13,10 +13,10 @@ for item in wList: instName = lines[line] def_name = instName[:instName.find('=')].strip() row = [myGen.id, myGen.title, prob, sol, def_name] - line+=1 + line += 1 allRows.append(row) -g=open('../README.md', "a") +g = open('../README.md', "a") for row in allRows: tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n" g.write(tableLine) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..6f37443 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -36,7 +36,8 @@ def getGenList(): def additionFunc(maxSum=99, maxAddend=50): a = random.randint(0, maxAddend) - b = random.randint(0, min((maxSum - a), maxAddend)) # The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well + # The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well + b = random.randint(0, min((maxSum - a), maxAddend)) c = a + b problem = str(a) + "+" + str(b) + "=" solution = str(c) @@ -78,7 +79,7 @@ def binaryComplement1sFunc(maxDigits=10): question += temp answer += "0" if temp == "1" else "1" - problem = question+"=" + problem = question + "=" solution = answer return problem, solution @@ -248,7 +249,8 @@ def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): c = random.randint(1, maxC) s = (a + b + c) / 2 area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 - problem = "Area of triangle with side lengths: " + str(a) + " " + str(b) + " " + str(c) + " = " + problem = "Area of triangle with side lengths: " + \ + str(a) + " " + str(b) + " " + str(c) + " = " solution = area return problem, solution @@ -259,7 +261,8 @@ def isTriangleValidFunc(maxSideLength=50): sideC = random.randint(1, maxSideLength) sideSums = [sideA + sideB, sideB + sideC, sideC + sideA] sides = [sideC, sideA, sideB] - exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) + exists = True & (sides[0] < sideSums[0]) & ( + sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" if exists: solution = "Yes" @@ -352,7 +355,8 @@ def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10): # No redundant 1s y_coeff = abs(coeffs[1]) if abs(coeffs[1]) != 1 else '' # Don't include if 0, unless x is also 0 (probably never happens) - y_str = f'{y_coeff}y' if coeffs[1] != 0 else ('' if x_str != '' else '0') + y_str = f'{y_coeff}y' if coeffs[1] != 0 else ( + '' if x_str != '' else '0') return f'{x_str}{op}{y_str} = {coeffs[2]}' problem = f"{coeffToFuncString(new_c1)}, {coeffToFuncString(new_c2)}" @@ -391,7 +395,8 @@ def linearEquationsFunc(n=2, varRange=20, coeffRange=20): soln = [random.randint(-varRange, varRange) for i in range(n)] problem = list() - solution = ", ".join(["{} = {}".format(vars[i], soln[i]) for i in range(n)]) + solution = ", ".join(["{} = {}".format(vars[i], soln[i]) + for i in range(n)]) for _ in range(n): coeff = [random.randint(-coeffRange, coeffRange) for i in range(n)] res = sum([coeff[i] * soln[i] for i in range(n)]) @@ -469,7 +474,8 @@ def combinationsFunc(maxlength=20): b = random.randint(0, 9) solution = int(factorial(a) / (factorial(b) * factorial(a - b))) - problem = "Number of combinations from {} objects picked {} at a time ".format(a, b) + problem = "Number of combinations from {} objects picked {} at a time ".format( + a, b) return problem, solution @@ -615,8 +621,10 @@ def intersectionOfTwoLinesFunc( x = f"{x.numerator}/{x.denominator}" return x - m1 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) - m2 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) + m1 = (random.randint(minM, maxM), random.randint( + minDenominator, maxDenominator)) + m2 = (random.randint(minM, maxM), random.randint( + minDenominator, maxDenominator)) b1 = random.randint(minB, maxB) b2 = random.randint(minB, maxB) equation1 = generateEquationString(m1, b1) @@ -642,7 +650,8 @@ def permutationFunc(maxlength=20): a = random.randint(10, maxlength) b = random.randint(0, 9) solution = int(math.factorial(a) / (math.factorial(a - b))) - problem = "Number of Permutations from {} objects picked {} at a time = ".format(a, b) + problem = "Number of Permutations from {} objects picked {} at a time = ".format( + a, b) return problem, solution @@ -685,7 +694,8 @@ def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): b = random.randint(1, maxRate) c = random.randint(1, maxTime) d = (a * b * c) / 100 - problem = "Simple interest for a principle amount of " + str(a) + " dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " + problem = "Simple interest for a principle amount of " + str(a) + " dollars, " + str( + b) + "% rate of interest and for a time period of " + str(c) + " years is = " solution = round(d, 2) return problem, solution @@ -718,7 +728,8 @@ def matrixMultiplicationFunc(maxVal=100): for t in range(n): temp += a[r][t] * b[t][c] res[r].append(temp) - problem = f"Multiply \n{a_string}\n and \n\n{b_string}" # consider using a, b instead of a_string, b_string if the problem doesn't look right + # consider using a, b instead of a_string, b_string if the problem doesn't look right + problem = f"Multiply \n{a_string}\n and \n\n{b_string}" solution = matrixMultiplicationFuncHelper(res) return problem, solution @@ -754,7 +765,8 @@ def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): coefficient = random.randint(1, maxCoef) exponent = random.randint(1, maxExp) problem += str(coefficient) + "x^" + str(exponent) - solution += "(" + str(coefficient) + "/" + str(exponent) + ")x^" + str(exponent + 1) + solution += "(" + str(coefficient) + "/" + \ + str(exponent) + ")x^" + str(exponent + 1) solution = solution + " + c" return problem, solution @@ -773,15 +785,18 @@ def fourthAngleOfQuadriFunc(maxAngle=180): def quadraticEquation(maxVal=100): a = random.randint(1, maxVal) c = random.randint(1, maxVal) - b = random.randint(round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal))) + b = random.randint(round(math.sqrt(4 * a * c)) + 1, + round(math.sqrt(4 * maxVal * maxVal))) problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c) D = math.sqrt(b * b - 4 * a * c) - solution = str([round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]) + solution = str([round((-b + D) / (2 * a), 2), + round((-b - D) / (2 * a), 2)]) return problem, solution + def hcfFunc(maxVal=20): a = random.randint(1, maxVal) b = random.randint(1, maxVal) @@ -792,61 +807,67 @@ def hcfFunc(maxVal=20): solution = str(x) return problem, solution + def DiceSumProbFunc(maxDice=3): - a = random.randint(1,maxDice) - b = random.randint(a,6*a) - count=0 - for i in [1,2,3,4,5,6]: - if a==1: - if i==b: - count=count+1 - elif a==2: - for j in [1,2,3,4,5,6]: - if i+j==b: - count=count+1 - elif a==3: - for j in [1,2,3,4,5,6]: - for k in [1,2,3,4,5,6]: - if i+j+k==b: - count=count+1 - problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a,b) - solution="{}/{}".format(count, 6**a) + a = random.randint(1, maxDice) + b = random.randint(a, 6 * a) + count = 0 + for i in [1, 2, 3, 4, 5, 6]: + if a == 1: + if i == b: + count = count + 1 + elif a == 2: + for j in [1, 2, 3, 4, 5, 6]: + if i + j == b: + count = count + 1 + elif a == 3: + for j in [1, 2, 3, 4, 5, 6]: + for k in [1, 2, 3, 4, 5, 6]: + if i + j + k == b: + count = count + 1 + problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format( + a, b) + solution = "{}/{}".format(count, 6**a) return problem, solution -def exponentiationFunc(maxBase = 20,maxExpo = 10): + +def exponentiationFunc(maxBase=20, maxExpo=10): base = random.randint(1, maxBase) expo = random.randint(1, maxExpo) problem = f"{base}^{expo} =" solution = str(base ** expo) return problem, solution + def confidenceIntervalFunc(): - n=random.randint(20,40) - j=random.randint(0,3) - lst=random.sample(range(200,300),n) - lst_per=[80 ,90, 95, 99] + n = random.randint(20, 40) + j = random.randint(0, 3) + lst = random.sample(range(200, 300), n) + lst_per = [80, 90, 95, 99] lst_t = [1.282, 1.645, 1.960, 2.576] - mean=0 - sd=0 + mean = 0 + sd = 0 for i in lst: - count= i + mean - mean=count - mean = mean/n + count = i + mean + mean = count + mean = mean / n for i in lst: - x=(i-mean)**2+sd - sd=x - sd=sd/n - standard_error = lst_t[j]*math.sqrt(sd/n) - problem= 'The confidence interval for sample {} with {}% confidence is'.format([x for x in lst], lst_per[j]) - solution= '({}, {})'.format(mean+standard_error, mean-standard_error) + x = (i - mean)**2 + sd + sd = x + sd = sd / n + standard_error = lst_t[j] * math.sqrt(sd / n) + problem = 'The confidence interval for sample {} with {}% confidence is'.format( + [x for x in lst], lst_per[j]) + solution = '({}, {})'.format(mean + standard_error, mean - standard_error) return problem, solution -def surdsComparisonFunc(maxValue = 100, maxRoot = 10): - radicand1,radicand2 = tuple(random.sample(range(1,maxValue),2)) - degree1, degree2 = tuple(random.sample(range(1,maxRoot),2)) + +def surdsComparisonFunc(maxValue=100, maxRoot=10): + radicand1, radicand2 = tuple(random.sample(range(1, maxValue), 2)) + degree1, degree2 = tuple(random.sample(range(1, maxRoot), 2)) problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})" - first = math.pow(radicand1, 1/degree1) - second = math.pow(radicand2, 1/degree2) + first = math.pow(radicand1, 1 / degree1) + second = math.pow(radicand2, 1 / degree2) solution = "=" if first > second: solution = ">" @@ -854,135 +875,203 @@ def surdsComparisonFunc(maxValue = 100, maxRoot = 10): solution = "<" return problem, solution + def fibonacciSeriesFunc(minNo=1): - n = random.randint(minNo,20) + n = random.randint(minNo, 20) + def createFibList(n): - l=[] + fibList = [] for i in range(n): - if i<2: - l.append(i) + if i < 2: + fibList.append(i) else: - val = l[i-1]+l[i-2] - l.append(val) - return l - fibList=createFibList(n) - problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" + val = fibList[i - 1] + fibList[i - 2] + fibList.append(val) + return fibList + fibList = createFibList(n) + problem = "The Fibonacci Series of the first " + str(n) + " numbers is ?" solution = fibList - return problem,solution + return problem, solution -def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): #Handles degrees in quadrant one - angle=random.choice(angles) - function=random.choice(functions) - problem=f"What is {function}({angle})?" - expression='math.'+function+'(math.radians(angle))' - result_fraction_map={0.0:"0",0.5:"1/2",0.71:"1/√2",0.87:"√3/2",1.0:"1",0.58:"1/√3",1.73:"√3"} +# Handles degrees in quadrant one +def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90], functions=["sin", "cos", "tan"]): + angle = random.choice(angles) + function = random.choice(functions) - solution=result_fraction_map[round(eval(expression),2)] if round(eval(expression),2)<=99999 else "∞" #for handling the ∞ condition + problem = f"What is {function}({angle})?" + expression = 'math.' + function + '(math.radians(angle))' + result_fraction_map = {0.0: "0", 0.5: "1/2", 0.71: "1/√2", + 0.87: "√3/2", 1.0: "1", 0.58: "1/√3", 1.73: "√3"} - return problem,solution + solution = result_fraction_map[round(eval(expression), 2)] if round( + eval(expression), 2) <= 99999 else "∞" # for handling the ∞ condition -def sumOfAnglesOfPolygonFunc(maxSides = 12): + return problem, solution + + +def sumOfAnglesOfPolygonFunc(maxSides=12): side = random.randint(3, maxSides) sum = (side - 2) * 180 problem = f"Sum of angles of polygon with {side} sides = " solution = sum return problem, solution -def dataSummaryFunc(number_values=15,minval=5,maxval=50): - random_list=[] + +def dataSummaryFunc(number_values=15, minval=5, maxval=50): + random_list = [] for i in range(number_values): - n=random.randint(minval,maxval) + n = random.randint(minval, maxval) random_list.append(n) - a=sum(random_list) - mean=a/number_values - var=0 + a = sum(random_list) + mean = a / number_values + var = 0 for i in range(number_values): - var+=(random_list[i]-mean)**2 + var += (random_list[i] - mean)**2 print(random_list) print(mean) - print(var/number_values) - print((var/number_values)**0.5) - problem="Find the mean,standard deviation and variance for the data"+str(random_list) - solution="The Mean is {} , Standard Deviation is {}, Variance is {}".format(mean,var/number_values,(var/number_values)**0.5) - return problem,solution + print(var / number_values) + print((var / number_values)**0.5) + problem = "Find the mean,standard deviation and variance for the data" + \ + str(random_list) + solution = "The Mean is {} , Standard Deviation is {}, Variance is {}".format( + mean, var / number_values, (var / number_values)**0.5) + return problem, solution -def surfaceAreaSphere(maxSide = 20, unit = 'm'): + +def surfaceAreaSphere(maxSide=20, unit='m'): r = random.randint(1, maxSide) problem = f"Surface area of Sphere with radius = {r}{unit} is" ans = 4 * math.pi * r * r solution = f"{ans} {unit}^2" return problem, solution -def volumeSphereFunc(maxRadius = 100): - r=random.randint(1,maxRadius) - problem=f"Volume of sphere with radius {r} m = " - ans=(4*math.pi/3)*r*r*r + + +def volumeSphereFunc(maxRadius=100): + r = random.randint(1, maxRadius) + problem = f"Volume of sphere with radius {r} m = " + ans = (4 * math.pi / 3) * r * r * r solution = f"{ans} m^3" - return problem,solution + return problem, solution # || Class Instances + # Format is: # <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) addition = Generator("Addition", 0, "a+b=", "c", additionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc) -multiplication = Generator("Multiplication", 2, "a*b=", "c", multiplicationFunc) +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) +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) +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 (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) +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 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) -intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) -areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) -doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?", "Yes/No", isTriangleValidFunc) -midPointOfTwoPoint = Generator("Midpoint of the two point", 20, "((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) -factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) -thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) -systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3",systemOfEquationsFunc) -distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) -pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) -linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) # This has multiple variables whereas #23 has only x and y -primeFactors = Generator("Prime Factorisation", 27, "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) -fractionMultiplication = Generator("Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) -angleRegularPolygon = Generator("Angle of a Regular Polygon", 29, "Find the angle of a regular polygon with 6 sides", "120", regularPolygonAngleFunc) -combinations = Generator("Combinations of Objects", 30, "Combinations available for picking 4 objects at a time from 6 distinct objects =", " 15", combinationsFunc) +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) +intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", + 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) +areaOfTriangle = Generator( + "Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) +doesTriangleExist = Generator("Triangle exists check", 19, + "Does triangle with sides a, b and c exist?", "Yes/No", isTriangleValidFunc) +midPointOfTwoPoint = Generator("Midpoint of the two point", 20, + "((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) +factoring = Generator("Factoring Quadratic", 21, + "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) +thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, + "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) +systemOfEquations = Generator("Solve a System of Equations in R^2", 23, + "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) +distance2Point = Generator("Distance between 2 points", 24, + "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) +pythagoreanTheorem = Generator( + "Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) +# This has multiple variables whereas #23 has only x and y +linearEquations = Generator( + "Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) +primeFactors = Generator("Prime Factorisation", 27, + "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) +fractionMultiplication = Generator( + "Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) +angleRegularPolygon = Generator("Angle of a Regular Polygon", 29, + "Find the angle of a regular polygon with 6 sides", "120", regularPolygonAngleFunc) +combinations = Generator("Combinations of Objects", 30, + "Combinations available for picking 4 objects at a time from 6 distinct objects =", " 15", combinationsFunc) factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc) -surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube with side a units is", "b units^2", surfaceAreaCube) -surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid) -surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder) -volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube) -volumeCuboidGen = Generator("Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid) -volumeCylinderGen = Generator("Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder) -surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone) -volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone) -commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc) -intersectionOfTwoLines = 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) -permutations = Generator("Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc) -vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc) -compareFractions = Generator("Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc) -simpleInterest = 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) -matrixMultiplication = Generator("Multiplication of two matrices", 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) -CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) -powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) -fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) -quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) -hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc) -diceSumProbability=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) -exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc) -confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) -surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) -basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) -sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) -dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) -surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) -volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +surfaceAreaCubeGen = Generator( + "Surface Area of Cube", 32, "Surface area of cube with side a units is", "b units^2", surfaceAreaCube) +surfaceAreaCuboidGen = Generator( + "Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid) +surfaceAreaCylinderGen = Generator( + "Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder) +volumeCubeGen = Generator( + "Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube) +volumeCuboidGen = Generator( + "Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid) +volumeCylinderGen = Generator( + "Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder) +surfaceAreaConeGen = Generator( + "Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone) +volumeConeGen = Generator( + "Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone) +commonFactors = Generator( + "Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc) +intersectionOfTwoLines = 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) +permutations = Generator( + "Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc) +vectorCross = Generator("Cross Product of 2 Vectors", + 43, "a X b = ", "c", vectorCrossFunc) +compareFractions = Generator( + "Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc) +simpleInterest = 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) +matrixMultiplication = Generator("Multiplication of two matrices", + 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) +CubeRoot = Generator( + "Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) +powerRuleIntegration = Generator( + "Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) +fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, + "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) +quadraticEquationSolve = Generator( + "Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) +hcf = Generator("HCF (Highest Common Factor)", 51, + "HCF of a and b = ", "c", hcfFunc) +diceSumProbability = 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) +exponentiation = Generator( + "Exponentiation", 53, "a^b = ", "c", exponentiationFunc) +confidenceInterval = Generator("Confidence interval For sample S", + 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) +surdsComparison = Generator( + "Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) +fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers", + "prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc) +basicTrigonometry = Generator( + "Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc) +sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, + "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) +dataSummary = Generator("Mean,Standard Deviation,Variance", + 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) +surfaceAreaSphereGen = Generator( + "Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) +volumeSphere = Generator("Volume of Sphere", 60, + "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) From e1c50c5fd68caa11ab452d590ede0d1a791da815 Mon Sep 17 00:00:00 2001 From: ieshaan12 <ieshaan1999@gmail.com> Date: Sun, 18 Oct 2020 14:26:13 +0530 Subject: [PATCH 50/79] nth Fibonacci number --- mathgenerator/mathgen.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..d632bef 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -3,7 +3,7 @@ import math import fractions genList = [] - +GOLDEN_RATIO = (1 + math.sqrt(5))/2 # || Generator class class Generator: @@ -920,6 +920,16 @@ def volumeSphereFunc(maxRadius = 100): ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" return problem,solution + +def nthFibonacciNumber(maxN = 100): + 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))) + solution = f"{ans}" + return problem, solution + + + # || Class Instances # Format is: @@ -986,3 +996,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumber) \ No newline at end of file From 629e23c94196aa90a4f61ab1cd336dce95d39ddd Mon Sep 17 00:00:00 2001 From: Swayam Gupta <guptaswayam075@gmail.com> Date: Sun, 18 Oct 2020 16:11:38 +0530 Subject: [PATCH 51/79] added harmonicMeanFunc --- README.md | 161 ++++++++++++++++++--------------------- mathgenerator/mathgen.py | 24 +++--- 2 files changed, 88 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index 9d38701..a3c7db3 100644 --- a/README.md +++ b/README.md @@ -30,93 +30,84 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| -| 0 | Addition | 37+40= | 77 | addition | -| 1 | Subtraction | 69-59= | 10 | subtraction | -| 2 | Multiplication | 18*0= | 0 | multiplication | -| 3 | Division | 66/25= | 2.64 | division | -| 4 | Binary Complement 1s | 00 | 11 | binaryComplement1s | -| 5 | Modulo Division | 37%68= | 37 | moduloDivision | -| 6 | Square Root | sqrt(4)= | 2 | squareRoot | -| 7 | Power Rule Differentiation | 6x^3 + 7x^5 + 6x^4 | 18x^2 + 35x^4 + 24x^3 | powerRuleDifferentiation | -| 8 | Square | 19^2= | 361 | square | -| 9 | LCM (Least Common Multiple) | LCM of 8 and 4 = | 8 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 20 and 1 = | 1 | gcd | -| 11 | Basic Algebra | 9x + 7 = 10 | 1/3 | basicAlgebra | -| 12 | Logarithm | log3(9) | 2 | log | -| 13 | Easy Division | 48/24 = | 2 | intDivision | -| 14 | Decimal to Binary | Binary of 69= | 1000101 | decimalToBinary | -| 15 | Binary to Decimal | 0010101100 | 172 | binaryToDecimal | -| 16 | Fraction Division | (8/2)/(7/5) | 20/7 | fractionDivision | -| 17 | Integer Multiplication with 2x2 Matrix | 10 * [[0, 3], [10, 5]] = | [[0,30],[100,50]] | intMatrix22Multiplication | -| 18 | Area of Triangle | Area of triangle with side lengths: 16 1 19 = | (1.5148044320877339e-15+24.73863375370596j) | areaOfTriangle | -| 19 | Triangle exists check | Does triangle with sides 24, 25 and 24 exist? | Yes | doesTriangleExist | -| 20 | Midpoint of the two point | (-15,2),(12,-5)= | (-1.5,-1.5) | midPointOfTwoPoint | -| 21 | Factoring Quadratic | x^2-2x-3 | (x+1)(x-3) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 65 and 78 = | 37 | thirdAngleOfTriangle | -| 23 | Solve a System of Equations in R^2 | 2x - 8y = -58, 3x - 4y = -31 | x = -1, y = 7 | systemOfEquations | -| 24 | Distance between 2 points | Find the distance between (21, 15) and (7, -4) | sqrt(557) | distance2Point | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 20 and 20 = | 28.28 | pythagoreanTheorem | -| 26 | Linear Equations | -19x + -4y = 231 -13x + 18y = -387 | x = -9, y = -15 | linearEquations | -| 27 | Prime Factorisation | Find prime factors of 185 | [5, 37] | primeFactors | -| 28 | Fraction Multiplication | (4/10)*(4/9) | 8/45 | fractionMultiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 17 sides | 158.82 | angleRegularPolygon | -| 30 | Combinations of Objects | Number of combinations from 10 objects picked 1 at a time | 10 | combinations | -| 31 | Factorial | 3! = | 6 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 16m is | 1536 m^2 | surfaceAreaCubeGen | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 6m, 7m, 17m is | 526 m^2 | surfaceAreaCuboidGen | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 19m and radius = 4m is | 578 m^2 | surfaceAreaCylinderGen | + +| 0 | Addition | 5+49= | 54 | addition | +| 1 | Subtraction | 63-53= | 10 | subtraction | +| 2 | Multiplication | 21*2= | 42 | multiplication | +| 3 | Division | 87/60= | 1.45 | division | +| 4 | Binary Complement 1s | 11011111= | 00100000 | binaryComplement1s | +| 5 | Modulo Division | 10%10= | 0 | moduloDivision | +| 6 | Square Root | sqrt(16)= | 4 | squareRoot | +| 7 | Power Rule Differentiation | 9x^6 + 8x^6 + 5x^9 + 1x^6 + 10x^1 | 54x^5 + 48x^5 + 45x^8 + 6x^5 + 10x^0 | powerRuleDifferentiation | +| 8 | Square | 6^2= | 36 | square | +| 9 | LCM (Least Common Multiple) | LCM of 9 and 6 = | 18 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 3 and 15 = | 3 | gcd | +| 11 | Basic Algebra | 2x + 2 = 9 | 7/2 | basicAlgebra | +| 12 | Logarithm | log2(4) | 2 | log | +| 13 | Easy Division | 180/15 = | 12 | intDivision | +| 14 | Decimal to Binary | Binary of 53= | 110101 | decimalToBinary | +| 15 | Binary to Decimal | 1000110111 | 567 | binaryToDecimal | +| 16 | Fraction Division | (10/4)/(1/10) | 25 | fractionDivision | +| 17 | Integer Multiplication with 2x2 Matrix | 1 * [[0, 4], [6, 2]] = | [[0,4],[6,2]] | intMatrix22Multiplication | +| 18 | Area of Triangle | Area of triangle with side lengths: 8 3 19 = | (4.3470649019239876e-15+70.9929573971954j) | areaOfTriangle | +| 19 | Triangle exists check | Does triangle with sides 8, 12 and 39 exist? | No | doesTriangleExist | +| 20 | Midpoint of the two point | (-17,-16),(-6,9)= | (-11.5,-3.5) | midPointOfTwoPoint | +| 21 | Factoring Quadratic | x^2-15x+56 | (x-8)(x-7) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 17 and 81 = | 82 | thirdAngleOfTriangle | +| 23 | Solve a System of Equations in R^2 | -7x - 5y = 22, 5x - 4y = 7 | x = -1, y = -3 | systemOfEquations | +| 24 | Distance between 2 points | Find the distance between (-4, -13) and (15, 10) | sqrt(890) | distance2Point | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 11 and 2 = | 11.18 | pythagoreanTheorem | +| 26 | Linear Equations | -9x + 15y = 171 +-9x + 9y = 135 | x = -9, y = 6 | linearEquations | +| 27 | Prime Factorisation | Find prime factors of 61 | [61] | primeFactors | +| 28 | Fraction Multiplication | (8/7)*(9/10) | 36/35 | fractionMultiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 20 sides | 162.0 | angleRegularPolygon | +| 30 | Combinations of Objects | Number of combinations from 13 objects picked 8 at a time | 1287 | combinations | +| 31 | Factorial | 6! = | 720 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 17m is | 1734 m^2 | surfaceAreaCubeGen | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 3m, 18m, 1m is | 150 m^2 | surfaceAreaCuboidGen | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 20m and radius = 15m is | 3298 m^2 | surfaceAreaCylinderGen | | 35 | Volum of Cube | Volume of cube with side = 7m is | 343 m^3 | volumeCubeGen | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 1m, 17m, 18m is | 306 m^3 | volumeCuboidGen | -| 37 | Volume of cylinder | Volume of cylinder with height = 16m and radius = 10m is | 5026 m^3 | volumeCylinderGen | -| 38 | Surface Area of cone | Surface area of cone with height = 36m and radius = 3m is | 368 m^2 | surfaceAreaConeGen | -| 39 | Volume of cone | Volume of cone with height = 21m and radius = 6m is | 791 m^3 | volumeConeGen | -| 40 | Common Factors | Common Factors of 31 and 79 = | [1] | commonFactors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 5x and y = -8/3x - 7 | (-21/23, -105/23) | intersectionOfTwoLines | -| 42 | Permutations | Number of Permutations from 13 objects picked 3 at a time = | 1716 | permutations | -| 43 | Cross Product of 2 Vectors | [10, 11, -18] X [-2, 13, -2] = | [212, 56, 152] | vectorCross | -| 44 | Compare Fractions | Which symbol represents the comparison between 4/2 and 4/1? | < | compareFractions | -| 45 | Simple Interest | Simple interest for a principle amount of 5369 dollars, 1% rate of interest and for a time period of 9 years is = | 483.21 | simpleInterest | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 16m, 5m, 11m is | 880 m^3 | volumeCuboidGen | +| 37 | Volume of cylinder | Volume of cylinder with height = 28m and radius = 12m is | 12666 m^3 | volumeCylinderGen | +| 38 | Surface Area of cone | Surface area of cone with height = 29m and radius = 1m is | 94 m^2 | surfaceAreaConeGen | +| 39 | Volume of cone | Volume of cone with height = 2m and radius = 15m is | 471 m^3 | volumeConeGen | +| 40 | Common Factors | Common Factors of 52 and 53 = | [1] | commonFactors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -8/4x + 3 and y = -6x - 4 | (-7/4, 13/2) | intersectionOfTwoLines | +| 42 | Permutations | Number of Permutations from 13 objects picked 1 at a time = | 13 | permutations | +| 43 | Cross Product of 2 Vectors | [-6, -20, -15] X [-17, 14, 18] = | [-150, 363, -424] | vectorCross | +| 44 | Compare Fractions | Which symbol represents the comparison between 7/4 and 5/6? | > | compareFractions | +| 45 | Simple Interest | Simple interest for a principle amount of 4813 dollars, 2% rate of interest and for a time period of 4 years is = | 385.04 | simpleInterest | | 46 | Multiplication of two matrices | Multiply - -16 87 100 -5 -69 97 -75 19 - 90 -83 -16 81 -30 64 -3 -96 - -74 -66 48 99 35 6 -14 70 - -24 67 -4 -95 4 51 31 -17 - 61 46 -72 66 -31 15 61 -31 - 84 63 78 -51 -11 -38 -68 -50 - 82 83 16 -100 17 2 8 -83 - 28 71 -68 -66 37 -84 79 32 + -11 -69 54 67 + 54 -24 52 35 + 9 -76 82 65 + 37 -40 87 -85 + 42 45 74 75 and - 50 -78 66 -8 -33 -61 -75 -18 -50 - -98 10 -66 -53 -24 -36 62 -39 -35 - 86 -52 -49 47 62 0 -12 96 55 - 61 41 -77 -89 46 -44 50 4 -81 - -12 -88 -88 9 83 62 60 -22 15 - 26 -3 44 -60 83 100 -35 97 26 - -17 -93 -5 79 55 78 32 0 -45 - -17 -54 -92 -48 -88 46 82 -22 12 | 3271 8443 -2346 -12616 937 -1490 -3233 16984 8750 - 19906 4214 20268 -4021 12861 -6176 -19662 9385 -8839 - 11719 1099 -19689 -6976 8029 7432 13014 7182 2782 --12865 -3615 4806 5149 2332 10216 -695 2288 6117 - -3372 836 5371 -7056 210 -5371 -534 -6721 -17158 - 2773 -1963 5727 3403 -5201 -17234 -11486 971 3323 - -7635 -8262 13038 9246 1015 -5530 -11796 -1931 926 --19947 -12723 -4715 8769 -12252 168 10130 -19731 -7079 | matrixMultiplication | -| 47 | Cube Root | cuberoot of 136 upto 2 decimal places is: | 5.14 | CubeRoot | -| 48 | Power Rule Integration | 9x^4 + 8x^6 + 2x^5 + 3x^10 + 2x^9 | (9/4)x^5 + (8/6)x^7 + (2/5)x^6 + (3/10)x^11 + (2/9)x^10 + c | powerRuleIntegration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 69 , 87, 120 = | 84 | fourthAngleOfQuadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 71x^2+188x+17=0 | [-0.09, -2.55] | quadraticEquationSolve | -| 51 | HCF (Highest Common Factor) | HCF of 3 and 16 = | 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 8 = | 21/216 | diceSumProbability | -| 53 | Exponentiation | 9^3 = | 729 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [203, 266, 261, 263, 262, 251, 267, 248, 208, 228, 215, 221, 282, 242, 272, 281, 289, 290, 285, 217, 213, 200, 292, 256, 232, 273, 295, 271, 211, 250, 231, 246, 277, 259, 283, 233] with 90% confidence is | (259.72847423786504, 244.32708131769053) | confidenceInterval | -| 55 | Comparing surds | Fill in the blanks 50^(1/7) _ 86^(1/5) | < | surdsComparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 3 numbers is ? | [0, 1, 1] | fibonacciSeries | -| 57 | Trigonometric Values | What is tan(45)? | 1 | basicTrigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[10, 25, 12, 26, 15, 13, 41, 25, 50, 13, 20, 22, 42, 36, 22] | The Mean is 24.8 , Standard Deviation is 141.09333333333333, Variance is 11.87827147918978 | dataSummary | -| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 5m is | 314.1592653589793 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 70 m = | 1436755.0402417318 m^3 | volumeSphere | -| 61 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 9 and 5 = | (9*5)^(1/2) = 6.708203932499369 | geometricMean | + 62 -96 -68 97 -88 71 69 + -38 48 -31 8 53 18 100 + 57 -41 54 81 -74 -80 47 + -63 -10 86 -6 77 31 -12 | 797 -5140 11565 2353 -1526 -4266 -5925 + 5019 -8818 2890 9048 -7177 327 3350 + 4025 -8524 11762 6517 -5883 -5274 -3905 + 14128 -8189 -3888 10826 -18359 -7688 3662 + 387 -5656 6195 9978 -1012 197 9976 | matrixMultiplication | +| 47 | Cube Root | cuberoot of 566 upto 2 decimal places is: | 8.27 | CubeRoot | +| 48 | Power Rule Integration | 6x^3 + 6x^4 + 5x^2 + 10x^9 | (6/3)x^4 + (6/4)x^5 + (5/2)x^3 + (10/9)x^10 + c | powerRuleIntegration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 6 , 199, 42 = | 113 | fourthAngleOfQuadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 63x^2+118x+19=0 | [-0.18, -1.7] | quadraticEquationSolve | +| 51 | HCF (Highest Common Factor) | HCF of 20 and 14 = | 2 | 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 5 = | 6/216 | diceSumProbability | +| 53 | Exponentiation | 1^3 = | 1 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [289, 284, 269, 211, 272, 298, 290, 220, 206, 224, 230, 222, 227, 209, 262, 255, 282, 253, 274, 265, 258, 248, 277, 279, 223, 221, 219, 286, 259, 297, 234, 201, 232, 203, 294, 252, 207, 278, 202] with 80% confidence is | (255.4031906501125, 242.64809140116955) | confidenceInterval | +| 55 | Comparing surds | Fill in the blanks 50^(1/9) _ 61^(1/7) | < | surdsComparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 1 numbers is ? | [0] | fibonacciSeries | +| 57 | Trigonometric Values | What is sin(30)? | 1/2 | basicTrigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 8 sides = | 1080 | sumOfAnglesOfPolygon | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[11, 17, 17, 20, 25, 38, 45, 19, 38, 31, 23, 16, 42, 28, 16] | The Mean is 25.733333333333334 , Standard Deviation is 107.66222222222224, Variance is 10.376040777783318 | dataSummary | +| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | +| 60 | Volume of Sphere | Volume of sphere with radius 100 m = | 4188790.2047863905 m^3 | volumeSphere | +| 61 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 6 and 66 = | 2/((1/6) + (1/66)) = 11.0 | harmonicMean | diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 8bf09dd..a164434 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -920,7 +920,7 @@ def volumeSphereFunc(maxRadius = 100): ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" return problem,solution -def geometricMeanFunc(maxValue=100, maxNum=4): +def harmonicMeanFunc(maxValue=100, maxNum=4): a=random.randint(1,maxValue) b=random.randint(1,maxValue) @@ -928,22 +928,22 @@ def geometricMeanFunc(maxValue=100, maxNum=4): d=random.randint(1,maxValue) num=random.randint(2,4) if num==2: - product=a*b + sum=(1/a)+(1/b) elif num==3: - product=a*b*c + sum=(1/a)+(1/b)+(1/c) elif num==4: - product=a*b*c*d + sum=(1/a)+(1/b)+(1/c)+(1/d) - ans=product**(1/num) + ans=num/sum if num==2: - problem=f"Geometric mean of {num} numbers {a} and {b} = " - solution = f"({a}*{b})^(1/{num}) = {ans}" + problem=f"Harmonic mean of {num} numbers {a} and {b} = " + solution = f" {num}/((1/{a}) + (1/{b})) = {ans}" elif num==3: - problem=f"Geometric mean of {num} numbers {a} , {b} and {c} = " - solution = f"({a}*{b}*{c})^(1/{num}) = {ans}" + problem=f"Harmonic mean of {num} numbers {a} , {b} and {c} = " + solution = f" {num}/((1/{a}) + (1/{b}) + (1/{c})) = {ans}" elif num==4: - problem=f"Geometric mean of {num} numbers {a} , {b} , {c} , {d} = " - solution = f"({a}*{b}*{c}*{d})^(1/{num}) = {ans}" + problem=f"Harmonic mean of {num} numbers {a} , {b} , {c} , {d} = " + solution = f" {num}/((1/{a}) + (1/{b}) + (1/{c}) + (1/{d})) = {ans}" return problem,solution # || Class Instances @@ -1012,4 +1012,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) -geometricMean=Generator("Geometric Mean of N Numbers",61,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +harmonicMean=Generator("Harmonic Mean of N Numbers",61,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) \ No newline at end of file From 3c1b02787fa0cff72fa403d420572bdb2ecbfd93 Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Sun, 18 Oct 2020 19:03:56 +0400 Subject: [PATCH 52/79] complete restructure of the project. minor tweaks --- Makefile | 4 +- mathgenerator/funcs/BinaryToDecimalFunc.py | 12 + mathgenerator/funcs/DecimalToBinaryFunc.py | 11 + mathgenerator/funcs/DiceSumProbFunc.py | 25 + mathgenerator/funcs/MidPointOfTwoPointFunc.py | 12 + mathgenerator/funcs/__init__.py | 61 ++ mathgenerator/funcs/additionFunc.py | 10 + mathgenerator/funcs/areaOfTriangleFunc.py | 14 + mathgenerator/funcs/basicAlgebraFunc.py | 25 + mathgenerator/funcs/basicTrigonometryFunc.py | 14 + mathgenerator/funcs/binaryComplement1sFunc.py | 15 + mathgenerator/funcs/combinationsFunc.py | 19 + mathgenerator/funcs/commonFactorsFunc.py | 24 + mathgenerator/funcs/compareFractionsFunc.py | 26 + mathgenerator/funcs/confidenceIntervalFunc.py | 30 + mathgenerator/funcs/cubeRootFunc.py | 10 + mathgenerator/funcs/dataSummaryFunc.py | 26 + mathgenerator/funcs/distanceTwoPointsFunc.py | 14 + mathgenerator/funcs/divideFractionsFunc.py | 32 + mathgenerator/funcs/divisionFunc.py | 11 + mathgenerator/funcs/divisionToIntFunc.py | 13 + mathgenerator/funcs/exponentiationFunc.py | 10 + mathgenerator/funcs/factorialFunc.py | 15 + mathgenerator/funcs/factoringFunc.py | 29 + mathgenerator/funcs/fibonacciSeriesFunc.py | 21 + .../funcs/fourthAngleOfQuadriFunc.py | 14 + mathgenerator/funcs/gcdFunc.py | 12 + .../funcs/intersectionOfTwoLinesFunc.py | 62 ++ mathgenerator/funcs/isTriangleValidFunc.py | 19 + mathgenerator/funcs/lcmFunc.py | 17 + mathgenerator/funcs/linearEquationsFunc.py | 25 + mathgenerator/funcs/logFunc.py | 12 + .../funcs/matrixMultiplicationFunc.py | 50 + mathgenerator/funcs/moduloFunc.py | 11 + mathgenerator/funcs/multiplicationFunc.py | 11 + mathgenerator/funcs/multiplyFractionsFunc.py | 32 + mathgenerator/funcs/multiplyIntToMatrix22.py | 13 + mathgenerator/funcs/permutationFunc.py | 10 + .../funcs/powerRuleDifferentiationFunc.py | 18 + .../funcs/powerRuleIntegrationFunc.py | 20 + mathgenerator/funcs/primeFactorsFunc.py | 22 + mathgenerator/funcs/pythagoreanTheoremFunc.py | 11 + mathgenerator/funcs/quadraticEquation.py | 12 + .../funcs/regularPolygonAngleFunc.py | 10 + mathgenerator/funcs/simpleInterestFunc.py | 12 + mathgenerator/funcs/squareFunc.py | 10 + mathgenerator/funcs/squareRootFunc.py | 10 + mathgenerator/funcs/subtractionFunc.py | 11 + .../funcs/sumOfAnglesOfPolygonFunc.py | 10 + mathgenerator/funcs/surdsComparisonFunc.py | 17 + mathgenerator/funcs/surfaceAreaCone.py | 13 + mathgenerator/funcs/surfaceAreaCube.py | 9 + mathgenerator/funcs/surfaceAreaCuboid.py | 12 + mathgenerator/funcs/surfaceAreaCylinder.py | 11 + mathgenerator/funcs/surfaceAreaSphere.py | 10 + mathgenerator/funcs/systemOfEquationsFunc.py | 45 + .../funcs/thirdAngleOfTriangleFunc.py | 11 + mathgenerator/funcs/vectorCrossFunc.py | 13 + mathgenerator/funcs/volumeCone.py | 11 + mathgenerator/funcs/volumeCube.py | 10 + mathgenerator/funcs/volumeCuboid.py | 12 + mathgenerator/funcs/volumeCylinder.py | 11 + mathgenerator/funcs/volumeSphereFunc.py | 10 + mathgenerator/mathgen.py | 908 +----------------- mathgenerator/separate_funcs.py | 25 + 65 files changed, 1145 insertions(+), 900 deletions(-) create mode 100644 mathgenerator/funcs/BinaryToDecimalFunc.py create mode 100644 mathgenerator/funcs/DecimalToBinaryFunc.py create mode 100644 mathgenerator/funcs/DiceSumProbFunc.py create mode 100644 mathgenerator/funcs/MidPointOfTwoPointFunc.py create mode 100644 mathgenerator/funcs/__init__.py create mode 100644 mathgenerator/funcs/additionFunc.py create mode 100644 mathgenerator/funcs/areaOfTriangleFunc.py create mode 100644 mathgenerator/funcs/basicAlgebraFunc.py create mode 100644 mathgenerator/funcs/basicTrigonometryFunc.py create mode 100644 mathgenerator/funcs/binaryComplement1sFunc.py create mode 100644 mathgenerator/funcs/combinationsFunc.py create mode 100644 mathgenerator/funcs/commonFactorsFunc.py create mode 100644 mathgenerator/funcs/compareFractionsFunc.py create mode 100644 mathgenerator/funcs/confidenceIntervalFunc.py create mode 100644 mathgenerator/funcs/cubeRootFunc.py create mode 100644 mathgenerator/funcs/dataSummaryFunc.py create mode 100644 mathgenerator/funcs/distanceTwoPointsFunc.py create mode 100644 mathgenerator/funcs/divideFractionsFunc.py create mode 100644 mathgenerator/funcs/divisionFunc.py create mode 100644 mathgenerator/funcs/divisionToIntFunc.py create mode 100644 mathgenerator/funcs/exponentiationFunc.py create mode 100644 mathgenerator/funcs/factorialFunc.py create mode 100644 mathgenerator/funcs/factoringFunc.py create mode 100644 mathgenerator/funcs/fibonacciSeriesFunc.py create mode 100644 mathgenerator/funcs/fourthAngleOfQuadriFunc.py create mode 100644 mathgenerator/funcs/gcdFunc.py create mode 100644 mathgenerator/funcs/intersectionOfTwoLinesFunc.py create mode 100644 mathgenerator/funcs/isTriangleValidFunc.py create mode 100644 mathgenerator/funcs/lcmFunc.py create mode 100644 mathgenerator/funcs/linearEquationsFunc.py create mode 100644 mathgenerator/funcs/logFunc.py create mode 100644 mathgenerator/funcs/matrixMultiplicationFunc.py create mode 100644 mathgenerator/funcs/moduloFunc.py create mode 100644 mathgenerator/funcs/multiplicationFunc.py create mode 100644 mathgenerator/funcs/multiplyFractionsFunc.py create mode 100644 mathgenerator/funcs/multiplyIntToMatrix22.py create mode 100644 mathgenerator/funcs/permutationFunc.py create mode 100644 mathgenerator/funcs/powerRuleDifferentiationFunc.py create mode 100644 mathgenerator/funcs/powerRuleIntegrationFunc.py create mode 100644 mathgenerator/funcs/primeFactorsFunc.py create mode 100644 mathgenerator/funcs/pythagoreanTheoremFunc.py create mode 100644 mathgenerator/funcs/quadraticEquation.py create mode 100644 mathgenerator/funcs/regularPolygonAngleFunc.py create mode 100644 mathgenerator/funcs/simpleInterestFunc.py create mode 100644 mathgenerator/funcs/squareFunc.py create mode 100644 mathgenerator/funcs/squareRootFunc.py create mode 100644 mathgenerator/funcs/subtractionFunc.py create mode 100644 mathgenerator/funcs/sumOfAnglesOfPolygonFunc.py create mode 100644 mathgenerator/funcs/surdsComparisonFunc.py create mode 100644 mathgenerator/funcs/surfaceAreaCone.py create mode 100644 mathgenerator/funcs/surfaceAreaCube.py create mode 100644 mathgenerator/funcs/surfaceAreaCuboid.py create mode 100644 mathgenerator/funcs/surfaceAreaCylinder.py create mode 100644 mathgenerator/funcs/surfaceAreaSphere.py create mode 100644 mathgenerator/funcs/systemOfEquationsFunc.py create mode 100644 mathgenerator/funcs/thirdAngleOfTriangleFunc.py create mode 100644 mathgenerator/funcs/vectorCrossFunc.py create mode 100644 mathgenerator/funcs/volumeCone.py create mode 100644 mathgenerator/funcs/volumeCube.py create mode 100644 mathgenerator/funcs/volumeCuboid.py create mode 100644 mathgenerator/funcs/volumeCylinder.py create mode 100644 mathgenerator/funcs/volumeSphereFunc.py create mode 100644 mathgenerator/separate_funcs.py diff --git a/Makefile b/Makefile index bd04e35..ff3b0ac 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ FLAKE_FLAGS = --ignore=E501,F401,F403,F405 lint: - python -m flake8 $(FLAKE_FLAGS) + python3 -m flake8 $(FLAKE_FLAGS) test: - python -m pytest --verbose -s tests + python3 -m pytest --verbose -s tests diff --git a/mathgenerator/funcs/BinaryToDecimalFunc.py b/mathgenerator/funcs/BinaryToDecimalFunc.py new file mode 100644 index 0000000..27b165d --- /dev/null +++ b/mathgenerator/funcs/BinaryToDecimalFunc.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def BinaryToDecimalFunc(max_dig=10): + problem = '' + + for i in range(random.randint(1, max_dig)): + temp = str(random.randint(0, 1)) + problem += temp + + solution = int(problem, 2) + return problem, solution diff --git a/mathgenerator/funcs/DecimalToBinaryFunc.py b/mathgenerator/funcs/DecimalToBinaryFunc.py new file mode 100644 index 0000000..8df2d8a --- /dev/null +++ b/mathgenerator/funcs/DecimalToBinaryFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +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 diff --git a/mathgenerator/funcs/DiceSumProbFunc.py b/mathgenerator/funcs/DiceSumProbFunc.py new file mode 100644 index 0000000..2180ee4 --- /dev/null +++ b/mathgenerator/funcs/DiceSumProbFunc.py @@ -0,0 +1,25 @@ +from .__init__ import * + + +def DiceSumProbFunc(maxDice=3): + a = random.randint(1,maxDice) + b = random.randint(a,6*a) + + count=0 + for i in [1,2,3,4,5,6]: + if a==1: + if i==b: + count=count+1 + elif a==2: + for j in [1,2,3,4,5,6]: + if i+j==b: + count=count+1 + elif a==3: + for j in [1,2,3,4,5,6]: + for k in [1,2,3,4,5,6]: + if i+j+k==b: + count=count+1 + + problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a,b) + solution="{}/{}".format(count, 6**a) + return problem, solution diff --git a/mathgenerator/funcs/MidPointOfTwoPointFunc.py b/mathgenerator/funcs/MidPointOfTwoPointFunc.py new file mode 100644 index 0000000..3c9202a --- /dev/null +++ b/mathgenerator/funcs/MidPointOfTwoPointFunc.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def MidPointOfTwoPointFunc(maxValue=20): + x1 = random.randint(-20, maxValue) + y1 = random.randint(-20, maxValue) + x2 = random.randint(-20, maxValue) + y2 = random.randint(-20, maxValue) + + problem = f"({x1},{y1}),({x2},{y2})=" + solution = f"({(x1+x2)/2},{(y1+y2)/2})" + return problem, solution diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py new file mode 100644 index 0000000..fe24eb6 --- /dev/null +++ b/mathgenerator/funcs/__init__.py @@ -0,0 +1,61 @@ +from .additionFunc import * +from .subtractionFunc import * +from .multiplicationFunc import * +from .divisionFunc import * +from .binaryComplement1sFunc import * +from .moduloFunc import * +from .squareRootFunc import * +from .powerRuleDifferentiationFunc import * +from .squareFunc import * +from .gcdFunc import * +from .lcmFunc import * +from .basicAlgebraFunc import * +from .logFunc import * +from .divisionToIntFunc import * +from .DecimalToBinaryFunc import * +from .BinaryToDecimalFunc import * +from .divideFractionsFunc import * +from .multiplyIntToMatrix22 import * +from .areaOfTriangleFunc import * +from .isTriangleValidFunc import * +from .MidPointOfTwoPointFunc import * +from .factoringFunc import * +from .thirdAngleOfTriangleFunc import * +from .systemOfEquationsFunc import * +from .distanceTwoPointsFunc import * +from .pythagoreanTheoremFunc import * +from .linearEquationsFunc import * +from .primeFactorsFunc import * +from .multiplyFractionsFunc import * +from .regularPolygonAngleFunc import * +from .combinationsFunc import * +from .factorialFunc import * +from .surfaceAreaCube import * +from .volumeCube import * +from .surfaceAreaCuboid import * +from .volumeCuboid import * +from .surfaceAreaCylinder import * +from .volumeCylinder import * +from .surfaceAreaCone import * +from .volumeCone import * +from .commonFactorsFunc import * +from .intersectionOfTwoLinesFunc import * +from .permutationFunc import * +from .vectorCrossFunc import * +from .compareFractionsFunc import * +from .simpleInterestFunc import * +from .matrixMultiplicationFunc import * +from .cubeRootFunc import * +from .powerRuleIntegrationFunc import * +from .fourthAngleOfQuadriFunc import * +from .quadraticEquation import * +from .DiceSumProbFunc import * +from .exponentiationFunc import * +from .confidenceIntervalFunc import * +from .surdsComparisonFunc import * +from .fibonacciSeriesFunc import * +from .basicTrigonometryFunc import * +from .sumOfAnglesOfPolygonFunc import * +from .dataSummaryFunc import * +from .surfaceAreaSphere import * +from .volumeSphereFunc import * diff --git a/mathgenerator/funcs/additionFunc.py b/mathgenerator/funcs/additionFunc.py new file mode 100644 index 0000000..30dfefe --- /dev/null +++ b/mathgenerator/funcs/additionFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def additionFunc(maxSum=99, maxAddend=50): + a = random.randint(0, maxAddend) + b = random.randint(0, min((maxSum - a), maxAddend)) # The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well + c = a + b + problem = str(a) + "+" + str(b) + "=" + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/areaOfTriangleFunc.py b/mathgenerator/funcs/areaOfTriangleFunc.py new file mode 100644 index 0000000..a5e1250 --- /dev/null +++ b/mathgenerator/funcs/areaOfTriangleFunc.py @@ -0,0 +1,14 @@ +from .__init__ import * + + +def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): + a = random.randint(1, maxA) + b = random.randint(1, maxB) + c = random.randint(1, maxC) + + s = (a + b + c) / 2 + area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 + + problem = "Area of triangle with side lengths: " + str(a) + " " + str(b) + " " + str(c) + " = " + solution = area + return problem, solution diff --git a/mathgenerator/funcs/basicAlgebraFunc.py b/mathgenerator/funcs/basicAlgebraFunc.py new file mode 100644 index 0000000..939ac5e --- /dev/null +++ b/mathgenerator/funcs/basicAlgebraFunc.py @@ -0,0 +1,25 @@ +from .__init__ import * + + +def basicAlgebraFunc(maxVariable=10): + a = random.randint(1, maxVariable) + b = random.randint(1, maxVariable) + c = random.randint(b, maxVariable) + + # calculate gcd + def calculate_gcd(x, y): + while(y): + x, y = y, x % y + return x + + i = calculate_gcd((c - b), a) + x = f"{(c - b)//i}/{a//i}" + + if (c - b == 0): + x = "0" + elif a == 1 or a == i: + x = f"{c - b}" + + problem = f"{a}x + {b} = {c}" + solution = x + return problem, solution diff --git a/mathgenerator/funcs/basicTrigonometryFunc.py b/mathgenerator/funcs/basicTrigonometryFunc.py new file mode 100644 index 0000000..dd4fe5d --- /dev/null +++ b/mathgenerator/funcs/basicTrigonometryFunc.py @@ -0,0 +1,14 @@ +from .__init__ import * + + +def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): #Handles degrees in quadrant one + angle=random.choice(angles) + function=random.choice(functions) + + problem=f"What is {function}({angle})?" + + expression='math.'+function+'(math.radians(angle))' + result_fraction_map={0.0:"0",0.5:"1/2",0.71:"1/√2",0.87:"√3/2",1.0:"1",0.58:"1/√3",1.73:"√3"} + + solution=result_fraction_map[round(eval(expression),2)] if round(eval(expression),2)<=99999 else "∞" #for handling the ∞ condition + return problem,solution diff --git a/mathgenerator/funcs/binaryComplement1sFunc.py b/mathgenerator/funcs/binaryComplement1sFunc.py new file mode 100644 index 0000000..2568303 --- /dev/null +++ b/mathgenerator/funcs/binaryComplement1sFunc.py @@ -0,0 +1,15 @@ +from .__init__ import * + + +def binaryComplement1sFunc(maxDigits=10): + question = '' + answer = '' + + for i in range(random.randint(1, maxDigits)): + temp = str(random.randint(0, 1)) + question += temp + answer += "0" if temp == "1" else "1" + + problem = question+"=" + solution = answer + return problem, solution diff --git a/mathgenerator/funcs/combinationsFunc.py b/mathgenerator/funcs/combinationsFunc.py new file mode 100644 index 0000000..79390a6 --- /dev/null +++ b/mathgenerator/funcs/combinationsFunc.py @@ -0,0 +1,19 @@ +from .__init__ import * + + +def combinationsFunc(maxlength=20): + + def factorial(a): + d = 1 + for i in range(a): + a = (i + 1) * d + d = a + return d + + a = random.randint(10, maxlength) + b = random.randint(0, 9) + + solution = int(factorial(a) / (factorial(b) * factorial(a - b))) + problem = "Number of combinations from {} objects picked {} at a time ".format(a, b) + + return problem, solution diff --git a/mathgenerator/funcs/commonFactorsFunc.py b/mathgenerator/funcs/commonFactorsFunc.py new file mode 100644 index 0000000..633abb3 --- /dev/null +++ b/mathgenerator/funcs/commonFactorsFunc.py @@ -0,0 +1,24 @@ +from .__init__ import * + + +def commonFactorsFunc(maxVal=100): + a = x = random.randint(1, maxVal) + b = y = random.randint(1, maxVal) + + if (x < y): + min = x + else: + min = y + + count = 0 + arr = [] + + for i in range(1, min + 1): + if (x % i == 0): + if (y % i == 0): + count = count + 1 + arr.append(i) + + problem = f"Common Factors of {a} and {b} = " + solution = arr + return problem, solution diff --git a/mathgenerator/funcs/compareFractionsFunc.py b/mathgenerator/funcs/compareFractionsFunc.py new file mode 100644 index 0000000..d0d08a4 --- /dev/null +++ b/mathgenerator/funcs/compareFractionsFunc.py @@ -0,0 +1,26 @@ +from .__init__ import * + + +def compareFractionsFunc(maxVal=10): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + c = random.randint(1, maxVal) + d = random.randint(1, maxVal) + + while (a == b): + b = random.randint(1, maxVal) + while (c == d): + d = random.randint(1, maxVal) + + first = a / b + second = c / d + + if(first > second): + solution = ">" + elif(first < second): + solution = "<" + else: + solution = "=" + + problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?" + return problem, solution diff --git a/mathgenerator/funcs/confidenceIntervalFunc.py b/mathgenerator/funcs/confidenceIntervalFunc.py new file mode 100644 index 0000000..32bd26a --- /dev/null +++ b/mathgenerator/funcs/confidenceIntervalFunc.py @@ -0,0 +1,30 @@ +from .__init__ import * + + +def confidenceIntervalFunc(): + n=random.randint(20,40) + j=random.randint(0,3) + + lst=random.sample(range(200,300),n) + lst_per=[80 ,90, 95, 99] + lst_t = [1.282, 1.645, 1.960, 2.576] + + mean=0 + sd=0 + + for i in lst: + count= i + mean + mean=count + + mean = mean/n + + for i in lst: + x=(i-mean)**2+sd + sd=x + + sd=sd/n + standard_error = lst_t[j]*math.sqrt(sd/n) + + problem= 'The confidence interval for sample {} with {}% confidence is'.format([x for x in lst], lst_per[j]) + solution= '({}, {})'.format(mean+standard_error, mean-standard_error) + return problem, solution diff --git a/mathgenerator/funcs/cubeRootFunc.py b/mathgenerator/funcs/cubeRootFunc.py new file mode 100644 index 0000000..c9de53c --- /dev/null +++ b/mathgenerator/funcs/cubeRootFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def cubeRootFunc(minNo=1, maxNo=1000): + b = random.randint(minNo, maxNo) + a = b**(1 / 3) + + problem = "cuberoot of " + str(b) + " upto 2 decimal places is:" + solution = str(round(a, 2)) + return problem, solution diff --git a/mathgenerator/funcs/dataSummaryFunc.py b/mathgenerator/funcs/dataSummaryFunc.py new file mode 100644 index 0000000..016737c --- /dev/null +++ b/mathgenerator/funcs/dataSummaryFunc.py @@ -0,0 +1,26 @@ +from .__init__ import * + + +def dataSummaryFunc(number_values=15,minval=5,maxval=50): + random_list=[] + + for i in range(number_values): + n=random.randint(minval,maxval) + random_list.append(n) + + a=sum(random_list) + mean=a/number_values + + var=0 + for i in range(number_values): + var+=(random_list[i]-mean)**2 + + # we're printing stuff here? + print(random_list) + print(mean) + print(var/number_values) + print((var/number_values)**0.5) + + problem="Find the mean,standard deviation and variance for the data"+str(random_list) + solution="The Mean is {} , Standard Deviation is {}, Variance is {}".format(mean,var/number_values,(var/number_values)**0.5) + return problem,solution diff --git a/mathgenerator/funcs/distanceTwoPointsFunc.py b/mathgenerator/funcs/distanceTwoPointsFunc.py new file mode 100644 index 0000000..1f48f90 --- /dev/null +++ b/mathgenerator/funcs/distanceTwoPointsFunc.py @@ -0,0 +1,14 @@ +from .__init__ import * + + +def distanceTwoPointsFunc(maxValXY=20, minValXY=-20): + point1X = random.randint(minValXY, maxValXY + 1) + point1Y = random.randint(minValXY, maxValXY + 1) + point2X = random.randint(minValXY, maxValXY + 1) + point2Y = random.randint(minValXY, maxValXY + 1) + + distanceSq = (point1X - point2X) ** 2 + (point1Y - point2Y) ** 2 + + solution = f"sqrt({distanceSq})" + problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})" + return problem, solution diff --git a/mathgenerator/funcs/divideFractionsFunc.py b/mathgenerator/funcs/divideFractionsFunc.py new file mode 100644 index 0000000..abfbec6 --- /dev/null +++ b/mathgenerator/funcs/divideFractionsFunc.py @@ -0,0 +1,32 @@ +from .__init__ import * + + +def divideFractionsFunc(maxVal=10): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + + while (a == b): + b = random.randint(1, maxVal) + + c = random.randint(1, maxVal) + d = random.randint(1, maxVal) + while (c == d): + d = random.randint(1, maxVal) + + def calculate_gcd(x, y): + while(y): + x, y = y, x % y + return x + + tmp_n = a * d + tmp_d = b * c + + gcd = calculate_gcd(tmp_n, tmp_d) + x = f"{tmp_n//gcd}/{tmp_d//gcd}" + + if (tmp_d == 1 or tmp_d == gcd): + x = f"{tmp_n//gcd}" + # for equal numerator and denominators + problem = f"({a}/{b})/({c}/{d})" + solution = x + return problem, solution diff --git a/mathgenerator/funcs/divisionFunc.py b/mathgenerator/funcs/divisionFunc.py new file mode 100644 index 0000000..60af33d --- /dev/null +++ b/mathgenerator/funcs/divisionFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def divisionFunc(maxRes=99, maxDivid=99): + a = random.randint(0, maxDivid) + b = random.randint(0, min(maxRes, maxDivid)) + c = a / b + + problem = str(a) + "/" + str(b) + "=" + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/divisionToIntFunc.py b/mathgenerator/funcs/divisionToIntFunc.py new file mode 100644 index 0000000..d5f3cfd --- /dev/null +++ b/mathgenerator/funcs/divisionToIntFunc.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def divisionToIntFunc(maxA=25, maxB=25): + a = random.randint(1, maxA) + b = random.randint(1, maxB) + + divisor = a * b + dividend = random.choice([a, b]) + + problem = f"{divisor}/{dividend} = " + solution = int(divisor / dividend) + return problem, solution diff --git a/mathgenerator/funcs/exponentiationFunc.py b/mathgenerator/funcs/exponentiationFunc.py new file mode 100644 index 0000000..4ff1ba1 --- /dev/null +++ b/mathgenerator/funcs/exponentiationFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def exponentiationFunc(maxBase = 20,maxExpo = 10): + base = random.randint(1, maxBase) + expo = random.randint(1, maxExpo) + + problem = f"{base}^{expo} =" + solution = str(base ** expo) + return problem, solution diff --git a/mathgenerator/funcs/factorialFunc.py b/mathgenerator/funcs/factorialFunc.py new file mode 100644 index 0000000..ac4536c --- /dev/null +++ b/mathgenerator/funcs/factorialFunc.py @@ -0,0 +1,15 @@ +from .__init__ import * + + +def factorialFunc(maxInput=6): + a = random.randint(0, maxInput) + n = a + + problem = str(a) + "! = " + b = 1 + + while a != 1 and n > 0: + b *= n + n -= 1 + solution = str(b) + return problem, solution diff --git a/mathgenerator/funcs/factoringFunc.py b/mathgenerator/funcs/factoringFunc.py new file mode 100644 index 0000000..c52482f --- /dev/null +++ b/mathgenerator/funcs/factoringFunc.py @@ -0,0 +1,29 @@ +from .__init__ import * + + +def factoringFunc(range_x1=10, range_x2=10): + x1 = random.randint(-range_x1, range_x1) + x2 = random.randint(-range_x2, range_x2) + + def intParser(z): + if (z == 0): + return "" + if (z > 0): + return "+" + str(z) + if (z < 0): + return "-" + str(abs(z)) + + b = intParser(x1 + x2) + c = intParser(x1 * x2) + + if b == "+1": + b = "+" + if b == "": + problem = f"x^2{c}" + else: + problem = f"x^2{b}x{c}" + + x1 = intParser(x1) + x2 = intParser(x2) + solution = f"(x{x1})(x{x2})" + return problem, solution \ No newline at end of file diff --git a/mathgenerator/funcs/fibonacciSeriesFunc.py b/mathgenerator/funcs/fibonacciSeriesFunc.py new file mode 100644 index 0000000..42de00d --- /dev/null +++ b/mathgenerator/funcs/fibonacciSeriesFunc.py @@ -0,0 +1,21 @@ +from .__init__ import * + + +def fibonacciSeriesFunc(minNo=1): + n = random.randint(minNo,20) + + def createFibList(n): + l=[] + for i in range(n): + if i<2: + l.append(i) + else: + val = l[i-1]+l[i-2] + l.append(val) + return l + + fibList=createFibList(n) + + problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" + solution = fibList + return problem,solution diff --git a/mathgenerator/funcs/fourthAngleOfQuadriFunc.py b/mathgenerator/funcs/fourthAngleOfQuadriFunc.py new file mode 100644 index 0000000..d183e17 --- /dev/null +++ b/mathgenerator/funcs/fourthAngleOfQuadriFunc.py @@ -0,0 +1,14 @@ +from .__init__ import * + + +def fourthAngleOfQuadriFunc(maxAngle=180): + angle1 = random.randint(1, maxAngle) + angle2 = random.randint(1, 240 - angle1) + angle3 = random.randint(1, 340 - (angle1 + angle2)) + + sum_ = angle1 + angle2 + angle3 + angle4 = 360 - sum_ + + problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" + solution = angle4 + return problem, solution diff --git a/mathgenerator/funcs/gcdFunc.py b/mathgenerator/funcs/gcdFunc.py new file mode 100644 index 0000000..505c7fb --- /dev/null +++ b/mathgenerator/funcs/gcdFunc.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def gcdFunc(maxVal=20): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + x, y = a, b + while y: + x, y = y, x % y + problem = f"GCD of {a} and {b} = " + solution = str(x) + return problem, solution diff --git a/mathgenerator/funcs/intersectionOfTwoLinesFunc.py b/mathgenerator/funcs/intersectionOfTwoLinesFunc.py new file mode 100644 index 0000000..96f681d --- /dev/null +++ b/mathgenerator/funcs/intersectionOfTwoLinesFunc.py @@ -0,0 +1,62 @@ +from .__init__ import * + + +def intersectionOfTwoLinesFunc( + minM=-10, maxM=10, minB=-10, maxB=10, minDenominator=1, maxDenominator=6 +): + + def generateEquationString(m, b): + """ + Generates an equation given the slope and intercept. + It handles cases where m is fractional. + It also ensures that we don't have weird signs such as y = mx + -b. + """ + if m[1] == 1: + m = m[0] + else: + m = f"{m[0]}/{m[1]}" + base = f"y = {m}x" + if b > 0: + return f"{base} + {b}" + elif b < 0: + return f"{base} - {b * -1}" + else: + return base + + def fractionToString(x): + """ + Converts the given fractions.Fraction into a string. + """ + if x.denominator == 1: + x = x.numerator + else: + x = f"{x.numerator}/{x.denominator}" + return x + + m1 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) + m2 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) + + b1 = random.randint(minB, maxB) + b2 = random.randint(minB, maxB) + + equation1 = generateEquationString(m1, b1) + equation2 = generateEquationString(m2, b2) + + problem = "Find the point of intersection of the two lines: " + problem += f"{equation1} and {equation2}" + + m1 = fractions.Fraction(*m1) + m2 = fractions.Fraction(*m2) + # if m1 == m2 then the slopes are equal + # This can happen if both line are the same + # Or if they are parallel + # In either case there is no intersection + + if m1 == m2: + solution = "No Solution" + else: + intersection_x = (b1 - b2) / (m2 - m1) + intersection_y = ((m2 * b1) - (m1 * b2)) / (m2 - m1) + solution = f"({fractionToString(intersection_x)}, {fractionToString(intersection_y)})" + + return problem, solution diff --git a/mathgenerator/funcs/isTriangleValidFunc.py b/mathgenerator/funcs/isTriangleValidFunc.py new file mode 100644 index 0000000..a80a05d --- /dev/null +++ b/mathgenerator/funcs/isTriangleValidFunc.py @@ -0,0 +1,19 @@ +from .__init__ import * + + +def isTriangleValidFunc(maxSideLength=50): + sideA = random.randint(1, maxSideLength) + sideB = random.randint(1, maxSideLength) + sideC = random.randint(1, maxSideLength) + + sideSums = [sideA + sideB, sideB + sideC, sideC + sideA] + sides = [sideC, sideA, sideB] + + exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) + problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" + + if exists: + solution = "Yes" + return problem, solution + solution = "No" + return problem, solution diff --git a/mathgenerator/funcs/lcmFunc.py b/mathgenerator/funcs/lcmFunc.py new file mode 100644 index 0000000..af2ee41 --- /dev/null +++ b/mathgenerator/funcs/lcmFunc.py @@ -0,0 +1,17 @@ +from .__init__ import * + + +def lcmFunc(maxVal=20): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + c = a * b + x, y = a, b + + while y: + x, y = y, x % y + d = c // x + + problem = f"LCM of {a} and {b} =" + solution = str(d) + + return problem, solution diff --git a/mathgenerator/funcs/linearEquationsFunc.py b/mathgenerator/funcs/linearEquationsFunc.py new file mode 100644 index 0000000..4aa1fba --- /dev/null +++ b/mathgenerator/funcs/linearEquationsFunc.py @@ -0,0 +1,25 @@ +from .__init__ import * + + +def linearEquationsFunc(n=2, varRange=20, coeffRange=20): + if n > 10: + print("[!] n cannot be greater than 10") + return None, None + + vars = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'][:n] + soln = [random.randint(-varRange, varRange) for i in range(n)] + problem = list() + solution = ", ".join(["{} = {}".format(vars[i], soln[i]) for i in range(n)]) + + for _ in range(n): + coeff = [random.randint(-coeffRange, coeffRange) for i in range(n)] + res = sum([coeff[i] * soln[i] for i in range(n)]) + prob = ["{}{}".format(coeff[i], vars[i]) if coeff[i] != 0 else "" for i in range(n)] + + while "" in prob: + prob.remove("") + prob = " + ".join(prob) + " = " + str(res) + problem.append(prob) + + problem = "\n".join(problem) + return problem, solution diff --git a/mathgenerator/funcs/logFunc.py b/mathgenerator/funcs/logFunc.py new file mode 100644 index 0000000..8d16214 --- /dev/null +++ b/mathgenerator/funcs/logFunc.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def logFunc(maxBase=3, maxVal=8): + a = random.randint(1, maxVal) + b = random.randint(2, maxBase) + c = pow(b, a) + + problem = "log" + str(b) + "(" + str(c) + ")" + solution = str(a) + + return problem, solution diff --git a/mathgenerator/funcs/matrixMultiplicationFunc.py b/mathgenerator/funcs/matrixMultiplicationFunc.py new file mode 100644 index 0000000..de69218 --- /dev/null +++ b/mathgenerator/funcs/matrixMultiplicationFunc.py @@ -0,0 +1,50 @@ +from .__init__ import * + + +def matrixMultiplicationFunc(maxVal=100): + m = random.randint(2, 10) + n = random.randint(2, 10) + k = random.randint(2, 10) + + # generate matrices a and b + a = [] + for r in range(m): + a.append([]) + for c in range(n): + a[r].append(random.randint(-maxVal, maxVal)) + b = [] + for r in range(n): + b.append([]) + for c in range(k): + b[r].append(random.randint(-maxVal, maxVal)) + + res = [] + a_string = matrixMultiplicationFuncHelper(a) + b_string = matrixMultiplicationFuncHelper(b) + + for r in range(m): + res.append([]) + + for c in range(k): + temp = 0 + + for t in range(n): + temp += a[r][t] * b[t][c] + res[r].append(temp) + + problem = f"Multiply \n{a_string}\n and \n\n{b_string}" # consider using a, b instead of a_string, b_string if the problem doesn't look right + solution = matrixMultiplicationFuncHelper(res) + return problem, solution + +def matrixMultiplicationFuncHelper(inp): + m = len(inp) + n = len(inp[0]) + + string = "" + for i in range(m): + for j in range(n): + string += f"{inp[i][j]: 6d}" + string += " " + string += "\n" + + return string \ No newline at end of file diff --git a/mathgenerator/funcs/moduloFunc.py b/mathgenerator/funcs/moduloFunc.py new file mode 100644 index 0000000..5f8d2af --- /dev/null +++ b/mathgenerator/funcs/moduloFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def moduloFunc(maxRes=99, maxModulo=99): + a = random.randint(0, maxModulo) + b = random.randint(0, min(maxRes, maxModulo)) + c = a % b + + problem = str(a) + "%" + str(b) + "=" + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/multiplicationFunc.py b/mathgenerator/funcs/multiplicationFunc.py new file mode 100644 index 0000000..00ebb26 --- /dev/null +++ b/mathgenerator/funcs/multiplicationFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def multiplicationFunc(maxRes=99, maxMulti=99): + a = random.randint(0, maxMulti) + b = random.randint(0, min(int(maxMulti / a), maxRes)) + c = a * b + + problem = str(a) + "*" + str(b) + "=" + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/multiplyFractionsFunc.py b/mathgenerator/funcs/multiplyFractionsFunc.py new file mode 100644 index 0000000..14614d6 --- /dev/null +++ b/mathgenerator/funcs/multiplyFractionsFunc.py @@ -0,0 +1,32 @@ +from .__init__ import * + + +def multiplyFractionsFunc(maxVal=10): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + c = random.randint(1, maxVal) + d = random.randint(1, maxVal) + + while (a == b): + b = random.randint(1, maxVal) + + while (c == d): + d = random.randint(1, maxVal) + + def calculate_gcd(x, y): + while(y): + x, y = y, x % y + return x + + tmp_n = a * c + tmp_d = b * d + + gcd = calculate_gcd(tmp_n, tmp_d) + x = f"{tmp_n//gcd}/{tmp_d//gcd}" + + if (tmp_d == 1 or tmp_d == gcd): + x = f"{tmp_n//gcd}" + + problem = f"({a}/{b})*({c}/{d})" + solution = x + return problem, solution diff --git a/mathgenerator/funcs/multiplyIntToMatrix22.py b/mathgenerator/funcs/multiplyIntToMatrix22.py new file mode 100644 index 0000000..120c202 --- /dev/null +++ b/mathgenerator/funcs/multiplyIntToMatrix22.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100): + a = random.randint(0, maxMatrixVal) + b = random.randint(0, maxMatrixVal) + c = random.randint(0, maxMatrixVal) + d = random.randint(0, maxMatrixVal) + + constant = random.randint(0, int(maxRes / max(a, b, c, d))) + problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = " + solution = f"[[{a*constant},{b*constant}],[{c*constant},{d*constant}]]" + return problem, solution diff --git a/mathgenerator/funcs/permutationFunc.py b/mathgenerator/funcs/permutationFunc.py new file mode 100644 index 0000000..ffae44e --- /dev/null +++ b/mathgenerator/funcs/permutationFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def permutationFunc(maxlength=20): + a = random.randint(10, maxlength) + b = random.randint(0, 9) + + solution = int(math.factorial(a) / (math.factorial(a - b))) + problem = "Number of Permutations from {} objects picked {} at a time = ".format(a, b) + return problem, solution diff --git a/mathgenerator/funcs/powerRuleDifferentiationFunc.py b/mathgenerator/funcs/powerRuleDifferentiationFunc.py new file mode 100644 index 0000000..9dac2db --- /dev/null +++ b/mathgenerator/funcs/powerRuleDifferentiationFunc.py @@ -0,0 +1,18 @@ +from .__init__ import * + + +def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5): + numTerms = random.randint(1, maxTerms) + problem = "" + solution = "" + + for i in range(numTerms): + if i > 0: + problem += " + " + solution += " + " + coefficient = random.randint(1, maxCoef) + exponent = random.randint(1, maxExp) + + problem += str(coefficient) + "x^" + str(exponent) + solution += str(coefficient * exponent) + "x^" + str(exponent - 1) + return problem, solution diff --git a/mathgenerator/funcs/powerRuleIntegrationFunc.py b/mathgenerator/funcs/powerRuleIntegrationFunc.py new file mode 100644 index 0000000..112f5b5 --- /dev/null +++ b/mathgenerator/funcs/powerRuleIntegrationFunc.py @@ -0,0 +1,20 @@ +from .__init__ import * + + +def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): + numTerms = random.randint(1, maxTerms) + problem = "" + solution = "" + + for i in range(numTerms): + if i > 0: + problem += " + " + solution += " + " + coefficient = random.randint(1, maxCoef) + exponent = random.randint(1, maxExp) + + problem += str(coefficient) + "x^" + str(exponent) + solution += "(" + str(coefficient) + "/" + str(exponent) + ")x^" + str(exponent + 1) + + solution += " + c" + return problem, solution diff --git a/mathgenerator/funcs/primeFactorsFunc.py b/mathgenerator/funcs/primeFactorsFunc.py new file mode 100644 index 0000000..5e645d2 --- /dev/null +++ b/mathgenerator/funcs/primeFactorsFunc.py @@ -0,0 +1,22 @@ +from .__init__ import * + + +def primeFactorsFunc(minVal=1, maxVal=200): + a = random.randint(minVal, maxVal) + n = a + i = 2 + factors = [] + + while i * i <= n: + if n % i: + i += 1 + else: + n //= i + factors.append(i) + + if n > 1: + factors.append(n) + + problem = f"Find prime factors of {a}" + solution = f"{factors}" + return problem, solution diff --git a/mathgenerator/funcs/pythagoreanTheoremFunc.py b/mathgenerator/funcs/pythagoreanTheoremFunc.py new file mode 100644 index 0000000..2776592 --- /dev/null +++ b/mathgenerator/funcs/pythagoreanTheoremFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def pythagoreanTheoremFunc(maxLength=20): + a = random.randint(1, maxLength) + b = random.randint(1, maxLength) + c = (a**2 + b**2)**0.5 + + problem = f"The hypotenuse of a right triangle given the other two lengths {a} and {b} = " + solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}" + return problem, solution diff --git a/mathgenerator/funcs/quadraticEquation.py b/mathgenerator/funcs/quadraticEquation.py new file mode 100644 index 0000000..98f895e --- /dev/null +++ b/mathgenerator/funcs/quadraticEquation.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def quadraticEquation(maxVal=100): + a = random.randint(1, maxVal) + c = random.randint(1, maxVal) + b = random.randint(round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal))) + + problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c) + D = math.sqrt(b * b - 4 * a * c) + solution = str([round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]) + return problem, solution diff --git a/mathgenerator/funcs/regularPolygonAngleFunc.py b/mathgenerator/funcs/regularPolygonAngleFunc.py new file mode 100644 index 0000000..569d2d5 --- /dev/null +++ b/mathgenerator/funcs/regularPolygonAngleFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def regularPolygonAngleFunc(minVal=3, maxVal=20): + sideNum = random.randint(minVal, maxVal) + problem = f"Find the angle of a regular polygon with {sideNum} sides" + + exteriorAngle = round((360 / sideNum), 2) + solution = 180 - exteriorAngle + return problem, solution diff --git a/mathgenerator/funcs/simpleInterestFunc.py b/mathgenerator/funcs/simpleInterestFunc.py new file mode 100644 index 0000000..de997d0 --- /dev/null +++ b/mathgenerator/funcs/simpleInterestFunc.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): + a = random.randint(1000, maxPrinciple) + b = random.randint(1, maxRate) + c = random.randint(1, maxTime) + d = (a * b * c) / 100 + + problem = "Simple interest for a principle amount of " + str(a) + " dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " + solution = round(d, 2) + return problem, solution diff --git a/mathgenerator/funcs/squareFunc.py b/mathgenerator/funcs/squareFunc.py new file mode 100644 index 0000000..6384197 --- /dev/null +++ b/mathgenerator/funcs/squareFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def squareFunc(maxSquareNum=20): + a = random.randint(1, maxSquareNum) + b = a * a + + problem = str(a) + "^2" + "=" + solution = str(b) + return problem, solution diff --git a/mathgenerator/funcs/squareRootFunc.py b/mathgenerator/funcs/squareRootFunc.py new file mode 100644 index 0000000..87152c8 --- /dev/null +++ b/mathgenerator/funcs/squareRootFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def squareRootFunc(minNo=1, maxNo=12): + b = random.randint(minNo, maxNo) + a = b * b + + problem = "sqrt(" + str(a) + ")=" + solution = str(b) + return problem, solution diff --git a/mathgenerator/funcs/subtractionFunc.py b/mathgenerator/funcs/subtractionFunc.py new file mode 100644 index 0000000..91c8e74 --- /dev/null +++ b/mathgenerator/funcs/subtractionFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def subtractionFunc(maxMinuend=99, maxDiff=99): + a = random.randint(0, maxMinuend) + b = random.randint(max(0, (a - maxDiff)), a) + c = a - b + + problem = str(a) + "-" + str(b) + "=" + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/sumOfAnglesOfPolygonFunc.py b/mathgenerator/funcs/sumOfAnglesOfPolygonFunc.py new file mode 100644 index 0000000..6181e96 --- /dev/null +++ b/mathgenerator/funcs/sumOfAnglesOfPolygonFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def sumOfAnglesOfPolygonFunc(maxSides = 12): + side = random.randint(3, maxSides) + sum = (side - 2) * 180 + + problem = f"Sum of angles of polygon with {side} sides = " + solution = sum + return problem, solution diff --git a/mathgenerator/funcs/surdsComparisonFunc.py b/mathgenerator/funcs/surdsComparisonFunc.py new file mode 100644 index 0000000..161aac3 --- /dev/null +++ b/mathgenerator/funcs/surdsComparisonFunc.py @@ -0,0 +1,17 @@ +from .__init__ import * + + +def surdsComparisonFunc(maxValue = 100, maxRoot = 10): + radicand1,radicand2 = tuple(random.sample(range(1,maxValue),2)) + degree1, degree2 = tuple(random.sample(range(1,maxRoot),2)) + + problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})" + first = math.pow(radicand1, 1/degree1) + second = math.pow(radicand2, 1/degree2) + + solution = "=" + if first > second: + solution = ">" + elif first < second: + solution = "<" + return problem, solution diff --git a/mathgenerator/funcs/surfaceAreaCone.py b/mathgenerator/funcs/surfaceAreaCone.py new file mode 100644 index 0000000..8132e7d --- /dev/null +++ b/mathgenerator/funcs/surfaceAreaCone.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m'): + a = random.randint(1, maxHeight) + b = random.randint(1, maxRadius) + + slopingHeight = math.sqrt(a**2 + b**2) + problem = f"Surface area of cone with height = {a}{unit} and radius = {b}{unit} is" + ans = int(math.pi * b * slopingHeight + math.pi * b * b) + + solution = f"{ans} {unit}^2" + return problem, solution diff --git a/mathgenerator/funcs/surfaceAreaCube.py b/mathgenerator/funcs/surfaceAreaCube.py new file mode 100644 index 0000000..9f9d07f --- /dev/null +++ b/mathgenerator/funcs/surfaceAreaCube.py @@ -0,0 +1,9 @@ +from .__init__ import * + + +def surfaceAreaCube(maxSide=20, unit='m'): + a = random.randint(1, maxSide) + problem = f"Surface area of cube with side = {a}{unit} is" + ans = 6 * a * a + solution = f"{ans} {unit}^2" + return problem, solution diff --git a/mathgenerator/funcs/surfaceAreaCuboid.py b/mathgenerator/funcs/surfaceAreaCuboid.py new file mode 100644 index 0000000..3630abc --- /dev/null +++ b/mathgenerator/funcs/surfaceAreaCuboid.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def surfaceAreaCuboid(maxSide=20, unit='m'): + a = random.randint(1, maxSide) + b = random.randint(1, maxSide) + c = random.randint(1, maxSide) + + problem = f"Surface area of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" + ans = 2 * (a * b + b * c + c * a) + solution = f"{ans} {unit}^2" + return problem, solution diff --git a/mathgenerator/funcs/surfaceAreaCylinder.py b/mathgenerator/funcs/surfaceAreaCylinder.py new file mode 100644 index 0000000..92035ba --- /dev/null +++ b/mathgenerator/funcs/surfaceAreaCylinder.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def surfaceAreaCylinder(maxRadius=20, maxHeight=50, unit='m'): + a = random.randint(1, maxHeight) + b = random.randint(1, maxRadius) + + problem = f"Surface area of cylinder with height = {a}{unit} and radius = {b}{unit} is" + ans = int(2 * math.pi * a * b + 2 * math.pi * b * b) + solution = f"{ans} {unit}^2" + return problem, solution diff --git a/mathgenerator/funcs/surfaceAreaSphere.py b/mathgenerator/funcs/surfaceAreaSphere.py new file mode 100644 index 0000000..84ce3e1 --- /dev/null +++ b/mathgenerator/funcs/surfaceAreaSphere.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def surfaceAreaSphere(maxSide = 20, unit = 'm'): + r = random.randint(1, maxSide) + + problem = f"Surface area of Sphere with radius = {r}{unit} is" + ans = 4 * math.pi * r * r + solution = f"{ans} {unit}^2" + return problem, solution diff --git a/mathgenerator/funcs/systemOfEquationsFunc.py b/mathgenerator/funcs/systemOfEquationsFunc.py new file mode 100644 index 0000000..fd28eaf --- /dev/null +++ b/mathgenerator/funcs/systemOfEquationsFunc.py @@ -0,0 +1,45 @@ +from .__init__ import * + + +def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10): + # Generate solution point first + x = random.randint(-range_x, range_x) + y = random.randint(-range_y, range_y) + # Start from reduced echelon form (coeffs 1) + c1 = [1, 0, x] + c2 = [0, 1, y] + + def randNonZero(): + return random.choice([i for i in range(-coeff_mult_range, coeff_mult_range) + if i != 0]) + # Add random (non-zero) multiple of equations (rows) to each other + c1_mult = randNonZero() + c2_mult = randNonZero() + new_c1 = [c1[i] + c1_mult * c2[i] for i in range(len(c1))] + new_c2 = [c2[i] + c2_mult * c1[i] for i in range(len(c2))] + # For extra randomness, now add random (non-zero) multiples of original rows + # to themselves + c1_mult = randNonZero() + c2_mult = randNonZero() + new_c1 = [new_c1[i] + c1_mult * c1[i] for i in range(len(c1))] + new_c2 = [new_c2[i] + c2_mult * c2[i] for i in range(len(c2))] + + def coeffToFuncString(coeffs): + # lots of edge cases for perfect formatting! + x_sign = '-' if coeffs[0] < 0 else '' + # No redundant 1s + x_coeff = str(abs(coeffs[0])) if abs(coeffs[0]) != 1 else '' + # If x coeff is 0, dont include x + x_str = f'{x_sign}{x_coeff}x' if coeffs[0] != 0 else '' + # if x isn't included and y is positive, dont include operator + op = ' - ' if coeffs[1] < 0 else (' + ' if x_str != '' else '') + # No redundant 1s + y_coeff = abs(coeffs[1]) if abs(coeffs[1]) != 1 else '' + # Don't include if 0, unless x is also 0 (probably never happens) + y_str = f'{y_coeff}y' if coeffs[1] != 0 else ('' if x_str != '' else '0') + return f'{x_str}{op}{y_str} = {coeffs[2]}' + + problem = f"{coeffToFuncString(new_c1)}, {coeffToFuncString(new_c2)}" + solution = f"x = {x}, y = {y}" + return problem, solution + # Add random (non-zero) multiple of equations to each other diff --git a/mathgenerator/funcs/thirdAngleOfTriangleFunc.py b/mathgenerator/funcs/thirdAngleOfTriangleFunc.py new file mode 100644 index 0000000..688b209 --- /dev/null +++ b/mathgenerator/funcs/thirdAngleOfTriangleFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def thirdAngleOfTriangleFunc(maxAngle=89): + angle1 = random.randint(1, maxAngle) + angle2 = random.randint(1, maxAngle) + angle3 = 180 - (angle1 + angle2) + + problem = f"Third angle of triangle with angles {angle1} and {angle2} = " + solution = angle3 + return problem, solution diff --git a/mathgenerator/funcs/vectorCrossFunc.py b/mathgenerator/funcs/vectorCrossFunc.py new file mode 100644 index 0000000..07ff0b2 --- /dev/null +++ b/mathgenerator/funcs/vectorCrossFunc.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def vectorCrossFunc(minVal=-20, maxVal=20): + a = [random.randint(minVal, maxVal) for i in range(3)] + b = [random.randint(minVal, maxVal) for i in range(3)] + c = [a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0]] + + problem = str(a) + " X " + str(b) + " = " + solution = str(c) + return problem, solution diff --git a/mathgenerator/funcs/volumeCone.py b/mathgenerator/funcs/volumeCone.py new file mode 100644 index 0000000..4cd5512 --- /dev/null +++ b/mathgenerator/funcs/volumeCone.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def volumeCone(maxRadius=20, maxHeight=50, unit='m'): + a = random.randint(1, maxHeight) + b = random.randint(1, maxRadius) + + problem = f"Volume of cone with height = {a}{unit} and radius = {b}{unit} is" + ans = int(math.pi * b * b * a * (1 / 3)) + solution = f"{ans} {unit}^3" + return problem, solution diff --git a/mathgenerator/funcs/volumeCube.py b/mathgenerator/funcs/volumeCube.py new file mode 100644 index 0000000..e487173 --- /dev/null +++ b/mathgenerator/funcs/volumeCube.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def volumeCube(maxSide=20, unit='m'): + a = random.randint(1, maxSide) + + problem = f"Volume of cube with side = {a}{unit} is" + ans = a * a * a + solution = f"{ans} {unit}^3" + return problem, solution diff --git a/mathgenerator/funcs/volumeCuboid.py b/mathgenerator/funcs/volumeCuboid.py new file mode 100644 index 0000000..a435784 --- /dev/null +++ b/mathgenerator/funcs/volumeCuboid.py @@ -0,0 +1,12 @@ +from .__init__ import * + + +def volumeCuboid(maxSide=20, unit='m'): + a = random.randint(1, maxSide) + b = random.randint(1, maxSide) + c = random.randint(1, maxSide) + + problem = f"Volume of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" + ans = a * b * c + solution = f"{ans} {unit}^3" + return problem, solution diff --git a/mathgenerator/funcs/volumeCylinder.py b/mathgenerator/funcs/volumeCylinder.py new file mode 100644 index 0000000..ecd78da --- /dev/null +++ b/mathgenerator/funcs/volumeCylinder.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def volumeCylinder(maxRadius=20, maxHeight=50, unit='m'): + a = random.randint(1, maxHeight) + b = random.randint(1, maxRadius) + + problem = f"Volume of cylinder with height = {a}{unit} and radius = {b}{unit} is" + ans = int(math.pi * b * b * a) + solution = f"{ans} {unit}^3" + return problem, solution diff --git a/mathgenerator/funcs/volumeSphereFunc.py b/mathgenerator/funcs/volumeSphereFunc.py new file mode 100644 index 0000000..618dbd3 --- /dev/null +++ b/mathgenerator/funcs/volumeSphereFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def volumeSphereFunc(maxRadius = 100): + r=random.randint(1,maxRadius) + + problem=f"Volume of sphere with radius {r} m = " + ans=(4*math.pi/3)*r*r*r + solution = f"{ans} m^3" + return problem,solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..59c19d4 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,6 +1,7 @@ import random import math import fractions +from .funcs import * genList = [] @@ -27,901 +28,13 @@ def genById(id): generator = genList[id][2] return(generator()) - +# def getGenList(): return(genList) # || Generator Functions - -def additionFunc(maxSum=99, maxAddend=50): - a = random.randint(0, maxAddend) - b = random.randint(0, min((maxSum - a), maxAddend)) # The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well - c = a + b - problem = str(a) + "+" + str(b) + "=" - solution = str(c) - return problem, solution - - -def subtractionFunc(maxMinuend=99, maxDiff=99): - a = random.randint(0, maxMinuend) - b = random.randint(max(0, (a - maxDiff)), a) - c = a - b - problem = str(a) + "-" + str(b) + "=" - solution = str(c) - return problem, solution - - -def multiplicationFunc(maxRes=99, maxMulti=99): - a = random.randint(0, maxMulti) - b = random.randint(0, min(int(maxMulti / a), maxRes)) - c = a * b - problem = str(a) + "*" + str(b) + "=" - solution = str(c) - return problem, solution - - -def divisionFunc(maxRes=99, maxDivid=99): - a = random.randint(0, maxDivid) - b = random.randint(0, min(maxRes, maxDivid)) - c = a / b - problem = str(a) + "/" + str(b) + "=" - solution = str(c) - return problem, solution - - -def binaryComplement1sFunc(maxDigits=10): - question = '' - answer = '' - for i in range(random.randint(1, maxDigits)): - temp = str(random.randint(0, 1)) - question += temp - answer += "0" if temp == "1" else "1" - - problem = question+"=" - solution = answer - return problem, solution - - -def moduloFunc(maxRes=99, maxModulo=99): - a = random.randint(0, maxModulo) - b = random.randint(0, min(maxRes, maxModulo)) - c = a % b - problem = str(a) + "%" + str(b) + "=" - solution = str(c) - return problem, solution - - -def squareRootFunc(minNo=1, maxNo=12): - b = random.randint(minNo, maxNo) - a = b * b - problem = "sqrt(" + str(a) + ")=" - solution = str(b) - return problem, solution - - -def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5): - numTerms = random.randint(1, maxTerms) - problem = "" - solution = "" - for i in range(numTerms): - if i > 0: - problem += " + " - solution += " + " - coefficient = random.randint(1, maxCoef) - exponent = random.randint(1, maxExp) - problem += str(coefficient) + "x^" + str(exponent) - solution += str(coefficient * exponent) + "x^" + str(exponent - 1) - return problem, solution - - -def squareFunc(maxSquareNum=20): - a = random.randint(1, maxSquareNum) - b = a * a - problem = str(a) + "^2" + "=" - solution = str(b) - return problem, solution - - -def gcdFunc(maxVal=20): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - x, y = a, b - while(y): - x, y = y, x % y - problem = f"GCD of {a} and {b} = " - solution = str(x) - return problem, solution - - -def lcmFunc(maxVal=20): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - x, y = a, b - c = a * b - while(y): - x, y = y, x % y - d = c // x - problem = f"LCM of {a} and {b} =" - solution = str(d) - return problem, solution - - -def basicAlgebraFunc(maxVariable=10): - a = random.randint(1, maxVariable) - b = random.randint(1, maxVariable) - c = random.randint(b, maxVariable) - # calculate gcd - - def calculate_gcd(x, y): - while(y): - x, y = y, x % y - return x - i = calculate_gcd((c - b), a) - x = f"{(c - b)//i}/{a//i}" - if (c - b == 0): - x = "0" - elif a == 1 or a == i: - x = f"{c - b}" - problem = f"{a}x + {b} = {c}" - solution = x - return problem, solution - - -def logFunc(maxBase=3, maxVal=8): - a = random.randint(1, maxVal) - b = random.randint(2, maxBase) - c = pow(b, a) - problem = "log" + str(b) + "(" + str(c) + ")" - solution = str(a) - return problem, solution - - -def divisionToIntFunc(maxA=25, maxB=25): - a = random.randint(1, maxA) - b = random.randint(1, maxB) - divisor = a * b - dividend = random.choice([a, b]) - problem = f"{divisor}/{dividend} = " - solution = int(divisor / dividend) - return problem, solution - - -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 BinaryToDecimalFunc(max_dig=10): - problem = '' - for i in range(random.randint(1, max_dig)): - temp = str(random.randint(0, 1)) - problem += temp - - solution = int(problem, 2) - return problem, solution - - -def divideFractionsFunc(maxVal=10): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - while (a == b): - b = random.randint(1, maxVal) - c = random.randint(1, maxVal) - d = random.randint(1, maxVal) - while (c == d): - d = random.randint(1, maxVal) - - def calculate_gcd(x, y): - while(y): - x, y = y, x % y - return x - tmp_n = a * d - tmp_d = b * c - gcd = calculate_gcd(tmp_n, tmp_d) - x = f"{tmp_n//gcd}/{tmp_d//gcd}" - if (tmp_d == 1 or tmp_d == gcd): - x = f"{tmp_n//gcd}" - # for equal numerator and denominators - problem = f"({a}/{b})/({c}/{d})" - solution = x - return problem, solution - - -def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100): - a = random.randint(0, maxMatrixVal) - b = random.randint(0, maxMatrixVal) - c = random.randint(0, maxMatrixVal) - d = random.randint(0, maxMatrixVal) - constant = random.randint(0, int(maxRes / max(a, b, c, d))) - problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = " - solution = f"[[{a*constant},{b*constant}],[{c*constant},{d*constant}]]" - return problem, solution - - -def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20): - a = random.randint(1, maxA) - b = random.randint(1, maxB) - c = random.randint(1, maxC) - s = (a + b + c) / 2 - area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 - problem = "Area of triangle with side lengths: " + str(a) + " " + str(b) + " " + str(c) + " = " - solution = area - return problem, solution - - -def isTriangleValidFunc(maxSideLength=50): - sideA = random.randint(1, maxSideLength) - sideB = random.randint(1, maxSideLength) - sideC = random.randint(1, maxSideLength) - sideSums = [sideA + sideB, sideB + sideC, sideC + sideA] - sides = [sideC, sideA, sideB] - exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (sides[2] < sideSums[2]) - problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" - if exists: - solution = "Yes" - return problem, solution - solution = "No" - return problem, solution - - -def MidPointOfTwoPointFunc(maxValue=20): - x1 = random.randint(-20, maxValue) - y1 = random.randint(-20, maxValue) - x2 = random.randint(-20, maxValue) - y2 = random.randint(-20, maxValue) - problem = f"({x1},{y1}),({x2},{y2})=" - solution = f"({(x1+x2)/2},{(y1+y2)/2})" - return problem, solution - - -def factoringFunc(range_x1=10, range_x2=10): - x1 = random.randint(-range_x1, range_x1) - x2 = random.randint(-range_x2, range_x2) - - def intParser(z): - if (z == 0): - return "" - if (z > 0): - return "+" + str(z) - if (z < 0): - return "-" + str(abs(z)) - - b = intParser(x1 + x2) - c = intParser(x1 * x2) - - if (b == "+1"): - b = "+" - - if (b == ""): - problem = f"x^2{c}" - else: - problem = f"x^2{b}x{c}" - - x1 = intParser(x1) - x2 = intParser(x2) - solution = f"(x{x1})(x{x2})" - return problem, solution - - -def thirdAngleOfTriangleFunc(maxAngle=89): - angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, maxAngle) - angle3 = 180 - (angle1 + angle2) - problem = f"Third angle of triangle with angles {angle1} and {angle2} = " - solution = angle3 - return problem, solution - - -def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10): - # Generate solution point first - x = random.randint(-range_x, range_x) - y = random.randint(-range_y, range_y) - # Start from reduced echelon form (coeffs 1) - c1 = [1, 0, x] - c2 = [0, 1, y] - - def randNonZero(): - return random.choice([i for i in range(-coeff_mult_range, coeff_mult_range) - if i != 0]) - # Add random (non-zero) multiple of equations (rows) to each other - c1_mult = randNonZero() - c2_mult = randNonZero() - new_c1 = [c1[i] + c1_mult * c2[i] for i in range(len(c1))] - new_c2 = [c2[i] + c2_mult * c1[i] for i in range(len(c2))] - - # For extra randomness, now add random (non-zero) multiples of original rows - # to themselves - c1_mult = randNonZero() - c2_mult = randNonZero() - new_c1 = [new_c1[i] + c1_mult * c1[i] for i in range(len(c1))] - new_c2 = [new_c2[i] + c2_mult * c2[i] for i in range(len(c2))] - - def coeffToFuncString(coeffs): - # lots of edge cases for perfect formatting! - x_sign = '-' if coeffs[0] < 0 else '' - # No redundant 1s - x_coeff = str(abs(coeffs[0])) if abs(coeffs[0]) != 1 else '' - # If x coeff is 0, dont include x - x_str = f'{x_sign}{x_coeff}x' if coeffs[0] != 0 else '' - # if x isn't included and y is positive, dont include operator - op = ' - ' if coeffs[1] < 0 else (' + ' if x_str != '' else '') - # No redundant 1s - y_coeff = abs(coeffs[1]) if abs(coeffs[1]) != 1 else '' - # Don't include if 0, unless x is also 0 (probably never happens) - y_str = f'{y_coeff}y' if coeffs[1] != 0 else ('' if x_str != '' else '0') - return f'{x_str}{op}{y_str} = {coeffs[2]}' - - problem = f"{coeffToFuncString(new_c1)}, {coeffToFuncString(new_c2)}" - solution = f"x = {x}, y = {y}" - return problem, solution - - # Add random (non-zero) multiple of equations to each other - - -def distanceTwoPointsFunc(maxValXY=20, minValXY=-20): - point1X = random.randint(minValXY, maxValXY + 1) - point1Y = random.randint(minValXY, maxValXY + 1) - point2X = random.randint(minValXY, maxValXY + 1) - point2Y = random.randint(minValXY, maxValXY + 1) - distanceSq = (point1X - point2X) ** 2 + (point1Y - point2Y) ** 2 - solution = f"sqrt({distanceSq})" - problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})" - return problem, solution - - -def pythagoreanTheoremFunc(maxLength=20): - a = random.randint(1, maxLength) - b = random.randint(1, maxLength) - c = (a**2 + b**2)**0.5 - problem = f"The hypotenuse of a right triangle given the other two lengths {a} and {b} = " - solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}" - return problem, solution - - -def linearEquationsFunc(n=2, varRange=20, coeffRange=20): - if n > 10: - print("[!] n cannot be greater than 10") - return None, None - - vars = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'][:n] - soln = [random.randint(-varRange, varRange) for i in range(n)] - - problem = list() - solution = ", ".join(["{} = {}".format(vars[i], soln[i]) for i in range(n)]) - for _ in range(n): - coeff = [random.randint(-coeffRange, coeffRange) for i in range(n)] - res = sum([coeff[i] * soln[i] for i in range(n)]) - - prob = ["{}{}".format(coeff[i], vars[i]) if coeff[i] != 0 else "" for i in range(n)] - while "" in prob: - prob.remove("") - prob = " + ".join(prob) + " = " + str(res) - problem.append(prob) - - problem = "\n".join(problem) - return problem, solution - - -def primeFactorsFunc(minVal=1, maxVal=200): - a = random.randint(minVal, maxVal) - n = a - i = 2 - factors = [] - while i * i <= n: - if n % i: - i += 1 - else: - n //= i - factors.append(i) - if n > 1: - factors.append(n) - problem = f"Find prime factors of {a}" - solution = f"{factors}" - return problem, solution - - -def multiplyFractionsFunc(maxVal=10): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - c = random.randint(1, maxVal) - d = random.randint(1, maxVal) - while (a == b): - b = random.randint(1, maxVal) - while (c == d): - d = random.randint(1, maxVal) - - def calculate_gcd(x, y): - while(y): - x, y = y, x % y - return x - tmp_n = a * c - tmp_d = b * d - gcd = calculate_gcd(tmp_n, tmp_d) - x = f"{tmp_n//gcd}/{tmp_d//gcd}" - if (tmp_d == 1 or tmp_d == gcd): - x = f"{tmp_n//gcd}" - problem = f"({a}/{b})*({c}/{d})" - solution = x - return problem, solution - - -def regularPolygonAngleFunc(minVal=3, maxVal=20): - sideNum = random.randint(minVal, maxVal) - problem = f"Find the angle of a regular polygon with {sideNum} sides" - exteriorAngle = round((360 / sideNum), 2) - solution = 180 - exteriorAngle - return problem, solution - - -def combinationsFunc(maxlength=20): - - def factorial(a): - d = 1 - for i in range(a): - a = (i + 1) * d - d = a - return d - a = random.randint(10, maxlength) - b = random.randint(0, 9) - - solution = int(factorial(a) / (factorial(b) * factorial(a - b))) - problem = "Number of combinations from {} objects picked {} at a time ".format(a, b) - - return problem, solution - - -def factorialFunc(maxInput=6): - a = random.randint(0, maxInput) - n = a - problem = str(a) + "! = " - b = 1 - if a == 1: - solution = str(b) - return problem, solution - else: - while n > 0: - b *= n - n = n - 1 - solution = str(b) - return problem, solution - - -def surfaceAreaCube(maxSide=20, unit='m'): - a = random.randint(1, maxSide) - problem = f"Surface area of cube with side = {a}{unit} is" - ans = 6 * a * a - solution = f"{ans} {unit}^2" - return problem, solution - - -def volumeCube(maxSide=20, unit='m'): - a = random.randint(1, maxSide) - problem = f"Volume of cube with side = {a}{unit} is" - ans = a * a * a - solution = f"{ans} {unit}^3" - return problem, solution - - -def surfaceAreaCuboid(maxSide=20, unit='m'): - a = random.randint(1, maxSide) - b = random.randint(1, maxSide) - c = random.randint(1, maxSide) - - problem = f"Surface area of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" - ans = 2 * (a * b + b * c + c * a) - solution = f"{ans} {unit}^2" - return problem, solution - - -def volumeCuboid(maxSide=20, unit='m'): - a = random.randint(1, maxSide) - b = random.randint(1, maxSide) - c = random.randint(1, maxSide) - problem = f"Volume of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" - ans = a * b * c - solution = f"{ans} {unit}^3" - return problem, solution - - -def surfaceAreaCylinder(maxRadius=20, maxHeight=50, unit='m'): - a = random.randint(1, maxHeight) - b = random.randint(1, maxRadius) - problem = f"Surface area of cylinder with height = {a}{unit} and radius = {b}{unit} is" - ans = int(2 * math.pi * a * b + 2 * math.pi * b * b) - solution = f"{ans} {unit}^2" - return problem, solution - - -def volumeCylinder(maxRadius=20, maxHeight=50, unit='m'): - a = random.randint(1, maxHeight) - b = random.randint(1, maxRadius) - problem = f"Volume of cylinder with height = {a}{unit} and radius = {b}{unit} is" - ans = int(math.pi * b * b * a) - solution = f"{ans} {unit}^3" - return problem, solution - - -def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m'): - a = random.randint(1, maxHeight) - b = random.randint(1, maxRadius) - slopingHeight = math.sqrt(a**2 + b**2) - problem = f"Surface area of cone with height = {a}{unit} and radius = {b}{unit} is" - ans = int(math.pi * b * slopingHeight + math.pi * b * b) - solution = f"{ans} {unit}^2" - return problem, solution - - -def volumeCone(maxRadius=20, maxHeight=50, unit='m'): - a = random.randint(1, maxHeight) - b = random.randint(1, maxRadius) - problem = f"Volume of cone with height = {a}{unit} and radius = {b}{unit} is" - ans = int(math.pi * b * b * a * (1 / 3)) - solution = f"{ans} {unit}^3" - return problem, solution - - -def commonFactorsFunc(maxVal=100): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - x, y = a, b - if (x < y): - min = x - else: - min = y - count = 0 - arr = [] - for i in range(1, min + 1): - if (x % i == 0): - if (y % i == 0): - count = count + 1 - arr.append(i) - problem = f"Common Factors of {a} and {b} = " - solution = arr - return problem, solution - - -def intersectionOfTwoLinesFunc( - minM=-10, maxM=10, minB=-10, maxB=10, minDenominator=1, maxDenominator=6 -): - def generateEquationString(m, b): - """ - Generates an equation given the slope and intercept. - It handles cases where m is fractional. - It also ensures that we don't have weird signs such as y = mx + -b. - """ - if m[1] == 1: - m = m[0] - else: - m = f"{m[0]}/{m[1]}" - base = f"y = {m}x" - if b > 0: - return f"{base} + {b}" - elif b < 0: - return f"{base} - {b * -1}" - else: - return base - - def fractionToString(x): - """ - Converts the given fractions.Fraction into a string. - """ - if x.denominator == 1: - x = x.numerator - else: - x = f"{x.numerator}/{x.denominator}" - return x - - m1 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) - m2 = (random.randint(minM, maxM), random.randint(minDenominator, maxDenominator)) - b1 = random.randint(minB, maxB) - b2 = random.randint(minB, maxB) - equation1 = generateEquationString(m1, b1) - equation2 = generateEquationString(m2, b2) - problem = "Find the point of intersection of the two lines: " - problem += f"{equation1} and {equation2}" - m1 = fractions.Fraction(*m1) - m2 = fractions.Fraction(*m2) - # if m1 == m2 then the slopes are equal - # This can happen if both line are the same - # Or if they are parallel - # In either case there is no intersection - if m1 == m2: - solution = "No Solution" - else: - intersection_x = (b1 - b2) / (m2 - m1) - intersection_y = ((m2 * b1) - (m1 * b2)) / (m2 - m1) - solution = f"({fractionToString(intersection_x)}, {fractionToString(intersection_y)})" - return problem, solution - - -def permutationFunc(maxlength=20): - a = random.randint(10, maxlength) - b = random.randint(0, 9) - solution = int(math.factorial(a) / (math.factorial(a - b))) - problem = "Number of Permutations from {} objects picked {} at a time = ".format(a, b) - return problem, solution - - -def vectorCrossFunc(minVal=-20, maxVal=20): - a = [random.randint(minVal, maxVal) for i in range(3)] - b = [random.randint(minVal, maxVal) for i in range(3)] - c = [a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0]] - return str(a) + " X " + str(b) + " = ", str(c) - - -def compareFractionsFunc(maxVal=10): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - c = random.randint(1, maxVal) - d = random.randint(1, maxVal) - - while (a == b): - b = random.randint(1, maxVal) - while (c == d): - d = random.randint(1, maxVal) - - first = a / b - second = c / d - - if(first > second): - solution = ">" - elif(first < second): - solution = "<" - else: - solution = "=" - - problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?" - return problem, solution - - -def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): - a = random.randint(1000, maxPrinciple) - b = random.randint(1, maxRate) - c = random.randint(1, maxTime) - d = (a * b * c) / 100 - problem = "Simple interest for a principle amount of " + str(a) + " dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " - solution = round(d, 2) - return problem, solution - - -def matrixMultiplicationFunc(maxVal=100): - m = random.randint(2, 10) - n = random.randint(2, 10) - k = random.randint(2, 10) - # generate matrices a and b - a = [] - for r in range(m): - a.append([]) - for c in range(n): - a[r].append(random.randint(-maxVal, maxVal)) - - b = [] - for r in range(n): - b.append([]) - for c in range(k): - b[r].append(random.randint(-maxVal, maxVal)) - - res = [] - a_string = matrixMultiplicationFuncHelper(a) - b_string = matrixMultiplicationFuncHelper(b) - - for r in range(m): - res.append([]) - for c in range(k): - temp = 0 - for t in range(n): - temp += a[r][t] * b[t][c] - res[r].append(temp) - problem = f"Multiply \n{a_string}\n and \n\n{b_string}" # consider using a, b instead of a_string, b_string if the problem doesn't look right - solution = matrixMultiplicationFuncHelper(res) - return problem, solution - - -def matrixMultiplicationFuncHelper(inp): - m = len(inp) - n = len(inp[0]) - string = "" - for i in range(m): - for j in range(n): - string += f"{inp[i][j]: 6d}" - string += " " - string += "\n" - return string - - -def cubeRootFunc(minNo=1, maxNo=1000): - b = random.randint(minNo, maxNo) - a = b**(1 / 3) - problem = "cuberoot of " + str(b) + " upto 2 decimal places is:" - solution = str(round(a, 2)) - return problem, solution - - -def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): - numTerms = random.randint(1, maxTerms) - problem = "" - solution = "" - for i in range(numTerms): - if i > 0: - problem += " + " - solution += " + " - coefficient = random.randint(1, maxCoef) - exponent = random.randint(1, maxExp) - problem += str(coefficient) + "x^" + str(exponent) - solution += "(" + str(coefficient) + "/" + str(exponent) + ")x^" + str(exponent + 1) - solution = solution + " + c" - return problem, solution - - -def fourthAngleOfQuadriFunc(maxAngle=180): - angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, 240 - angle1) - angle3 = random.randint(1, 340 - (angle1 + angle2)) - sum_ = angle1 + angle2 + angle3 - angle4 = 360 - sum_ - problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" - solution = angle4 - return problem, solution - - -def quadraticEquation(maxVal=100): - a = random.randint(1, maxVal) - c = random.randint(1, maxVal) - b = random.randint(round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal))) - - problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c) - - D = math.sqrt(b * b - 4 * a * c) - - solution = str([round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]) - return problem, solution - -def hcfFunc(maxVal=20): - a = random.randint(1, maxVal) - b = random.randint(1, maxVal) - x, y = a, b - while(y): - x, y = y, x % y - problem = f"HCF of {a} and {b} = " - solution = str(x) - return problem, solution - -def DiceSumProbFunc(maxDice=3): - a = random.randint(1,maxDice) - b = random.randint(a,6*a) - count=0 - for i in [1,2,3,4,5,6]: - if a==1: - if i==b: - count=count+1 - elif a==2: - for j in [1,2,3,4,5,6]: - if i+j==b: - count=count+1 - elif a==3: - for j in [1,2,3,4,5,6]: - for k in [1,2,3,4,5,6]: - if i+j+k==b: - count=count+1 - problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a,b) - solution="{}/{}".format(count, 6**a) - return problem, solution - -def exponentiationFunc(maxBase = 20,maxExpo = 10): - base = random.randint(1, maxBase) - expo = random.randint(1, maxExpo) - problem = f"{base}^{expo} =" - solution = str(base ** expo) - return problem, solution - -def confidenceIntervalFunc(): - n=random.randint(20,40) - j=random.randint(0,3) - lst=random.sample(range(200,300),n) - lst_per=[80 ,90, 95, 99] - lst_t = [1.282, 1.645, 1.960, 2.576] - mean=0 - sd=0 - for i in lst: - count= i + mean - mean=count - mean = mean/n - for i in lst: - x=(i-mean)**2+sd - sd=x - sd=sd/n - standard_error = lst_t[j]*math.sqrt(sd/n) - problem= 'The confidence interval for sample {} with {}% confidence is'.format([x for x in lst], lst_per[j]) - solution= '({}, {})'.format(mean+standard_error, mean-standard_error) - return problem, solution - -def surdsComparisonFunc(maxValue = 100, maxRoot = 10): - radicand1,radicand2 = tuple(random.sample(range(1,maxValue),2)) - degree1, degree2 = tuple(random.sample(range(1,maxRoot),2)) - problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})" - first = math.pow(radicand1, 1/degree1) - second = math.pow(radicand2, 1/degree2) - solution = "=" - if first > second: - solution = ">" - elif first < second: - solution = "<" - return problem, solution - -def fibonacciSeriesFunc(minNo=1): - n = random.randint(minNo,20) - def createFibList(n): - l=[] - for i in range(n): - if i<2: - l.append(i) - else: - val = l[i-1]+l[i-2] - l.append(val) - return l - fibList=createFibList(n) - problem = "The Fibonacci Series of the first "+str(n)+" numbers is ?" - solution = fibList - return problem,solution - -def basicTrigonometryFunc(angles=[0,30,45,60,90],functions=["sin","cos","tan"]): #Handles degrees in quadrant one - angle=random.choice(angles) - function=random.choice(functions) - - problem=f"What is {function}({angle})?" - expression='math.'+function+'(math.radians(angle))' - result_fraction_map={0.0:"0",0.5:"1/2",0.71:"1/√2",0.87:"√3/2",1.0:"1",0.58:"1/√3",1.73:"√3"} - - solution=result_fraction_map[round(eval(expression),2)] if round(eval(expression),2)<=99999 else "∞" #for handling the ∞ condition - - return problem,solution - -def sumOfAnglesOfPolygonFunc(maxSides = 12): - side = random.randint(3, maxSides) - sum = (side - 2) * 180 - problem = f"Sum of angles of polygon with {side} sides = " - solution = sum - return problem, solution - -def dataSummaryFunc(number_values=15,minval=5,maxval=50): - random_list=[] - for i in range(number_values): - n=random.randint(minval,maxval) - random_list.append(n) - a=sum(random_list) - mean=a/number_values - var=0 - for i in range(number_values): - var+=(random_list[i]-mean)**2 - print(random_list) - print(mean) - print(var/number_values) - print((var/number_values)**0.5) - problem="Find the mean,standard deviation and variance for the data"+str(random_list) - solution="The Mean is {} , Standard Deviation is {}, Variance is {}".format(mean,var/number_values,(var/number_values)**0.5) - return problem,solution - -def surfaceAreaSphere(maxSide = 20, unit = 'm'): - r = random.randint(1, maxSide) - - problem = f"Surface area of Sphere with radius = {r}{unit} is" - ans = 4 * math.pi * r * r - solution = f"{ans} {unit}^2" - return problem, solution -def volumeSphereFunc(maxRadius = 100): - r=random.randint(1,maxRadius) - problem=f"Volume of sphere with radius {r} m = " - ans=(4*math.pi/3)*r*r*r - solution = f"{ans} m^3" - return problem,solution # || Class Instances - # Format is: # <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) addition = Generator("Addition", 0, "a+b=", "c", additionFunc) @@ -975,14 +88,13 @@ CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) -hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc) -diceSumProbability=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) -exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc) -confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) -surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) -basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) -sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) -dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) +diceSumProbability=Generator("Probability of a certain sum appearing on faces of dice", 51,"If n dices are rolled then probabilty of getting sum of x is =","z", DiceSumProbFunc) +exponentiation = Generator("Exponentiation", 52,"a^b = ","c",exponentiationFunc) +confidenceInterval = Generator("Confidence interval For sample S", 53, "With X% confidence", "is (A,B)", confidenceIntervalFunc) +surdsComparison = Generator("Comparing surds", 54, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) +fibonacciSeries = Generator("Fibonacci Series",55,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) +basicTrigonometry=Generator("Trigonometric Values",56,"What is sin(X)?","ans",basicTrigonometryFunc) +sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 57, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) +dataSummary = Generator("Mean,Standard Deviation,Variance", 58, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) diff --git a/mathgenerator/separate_funcs.py b/mathgenerator/separate_funcs.py new file mode 100644 index 0000000..0cdcb9c --- /dev/null +++ b/mathgenerator/separate_funcs.py @@ -0,0 +1,25 @@ +import os + +file = "" +with open("mathgen.py", 'r') as f: + file = f.read() + +file = file.split("\n\n")[8:] + +i=0 + +imports_string = "" +for listing in file: + listing = listing[1:] + if listing[:3] == "def": + name = listing[4:listing.find("(")] + imports_string+="import funcs."+name+"\n" + with open("funcs/"+name+".py", 'w') as f: + f.write("from funcs.imports import *\n\n\n"+listing+"\n") + print("Saved!", i, "-", name) + i+=1 + +with open("funcs/imports.py", 'w') as imports_file: + imports_file.write(imports_string+"\n") + +# print(file) \ No newline at end of file From 27effe52e30634e342478d6784018e1dde1a194a Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Sun, 18 Oct 2020 19:05:59 +0400 Subject: [PATCH 53/79] changed makefile back] --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ff3b0ac..bd04e35 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ FLAKE_FLAGS = --ignore=E501,F401,F403,F405 lint: - python3 -m flake8 $(FLAKE_FLAGS) + python -m flake8 $(FLAKE_FLAGS) test: - python3 -m pytest --verbose -s tests + python -m pytest --verbose -s tests From 0b9932a3a6bafe44f2bb9a95de844c4bf90f36e2 Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Sun, 18 Oct 2020 19:11:25 +0400 Subject: [PATCH 54/79] fixed imports and removed my automation script --- mathgenerator/funcs/__init__.py | 4 ++++ mathgenerator/separate_funcs.py | 25 ------------------------- 2 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 mathgenerator/separate_funcs.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index fe24eb6..73bd406 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -1,3 +1,7 @@ +import random +import math +import fractions + from .additionFunc import * from .subtractionFunc import * from .multiplicationFunc import * diff --git a/mathgenerator/separate_funcs.py b/mathgenerator/separate_funcs.py deleted file mode 100644 index 0cdcb9c..0000000 --- a/mathgenerator/separate_funcs.py +++ /dev/null @@ -1,25 +0,0 @@ -import os - -file = "" -with open("mathgen.py", 'r') as f: - file = f.read() - -file = file.split("\n\n")[8:] - -i=0 - -imports_string = "" -for listing in file: - listing = listing[1:] - if listing[:3] == "def": - name = listing[4:listing.find("(")] - imports_string+="import funcs."+name+"\n" - with open("funcs/"+name+".py", 'w') as f: - f.write("from funcs.imports import *\n\n\n"+listing+"\n") - print("Saved!", i, "-", name) - i+=1 - -with open("funcs/imports.py", 'w') as imports_file: - imports_file.write(imports_string+"\n") - -# print(file) \ No newline at end of file From 5d787161f1a87f47b89de88a8763c41bd84b8604 Mon Sep 17 00:00:00 2001 From: "sakshi.kst" <sakshi.kst@gmail.com> Date: Sun, 18 Oct 2020 22:01:42 +0530 Subject: [PATCH 55/79] Profit/ Loss Percentage calculator function added --- mathgenerator/mathgen.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..4c8fa6d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -914,12 +914,27 @@ def surfaceAreaSphere(maxSide = 20, unit = 'm'): ans = 4 * math.pi * r * r solution = f"{ans} {unit}^2" return problem, solution + def volumeSphereFunc(maxRadius = 100): r=random.randint(1,maxRadius) problem=f"Volume of sphere with radius {r} m = " ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" return problem,solution + +def profitLossPercentFunc(maxCP = 1000, maxSP = 1000): + cP = random.randint(1, maxCP) + sP = random.randint(1, maxSP) + diff = abs(sP-cP) + if (sP-cP >= 0): + profitOrLoss = "Profit" + else: + profitOrLoss = "Loss" + percent = diff/cP * 100 + problem = f"{profitOrLoss} percent when CP = {cP} and SP = {sP} is: " + solution = percent + return problem, solution + # || Class Instances # Format is: @@ -986,3 +1001,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +profitLossPercent = Generator("Profit or Loss Percent", 61, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) From 26c43e9f16589855261e207db21bb5850f46dd2d Mon Sep 17 00:00:00 2001 From: William Welch <wwelch@ctcd.edu> Date: Sun, 18 Oct 2020 18:28:30 -0500 Subject: [PATCH 56/79] Added function binarytoHex() --- driver.py | 12 ++++++++++++ mathgenerator/mathgen.py | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 driver.py diff --git a/driver.py b/driver.py new file mode 100644 index 0000000..2063399 --- /dev/null +++ b/driver.py @@ -0,0 +1,12 @@ +# First test to run mathgenerator +# 19 Oct 2020 + +from mathgenerator import mathgen + +problem, solution = mathgen.addition() +print(problem) +print(solution) + +problem, solution = mathgen.binarytohex() +print(problem) +print(solution) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 44218e6..1736318 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -920,6 +920,16 @@ def volumeSphereFunc(maxRadius = 100): ans=(4*math.pi/3)*r*r*r solution = f"{ans} m^3" return problem,solution + +def BinaryToHexFunc(max_dig=10): + problem = '' + for i in range(random.randint(1, max_dig)): + temp = str(random.randint(0, 1)) + problem += temp + + solution = hex(int(problem, 2)) + return problem, solution + # || Class Instances # Format is: @@ -986,3 +996,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) +binaryToHex = Generator("Binary to Hexidecimal", 61, "Hexidecimal of a=", "b", BinaryToHexFunc) From f17b0e7fd5484b3a99036787584bdec695d43496 Mon Sep 17 00:00:00 2001 From: Thromax <thromax@gmail.com> Date: Mon, 19 Oct 2020 02:27:00 +0200 Subject: [PATCH 57/79] Fixed README.md --- README.md | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 7643a53..6777b5c 100644 --- a/README.md +++ b/README.md @@ -77,31 +77,7 @@ problem, solution = mathgen.genById(0) | 43 | Cross Product of 2 Vectors | [-19, -3, 2] X [-15, -12, 7] = | [3, 103, 183] | vectorCross | | 44 | Compare Fractions | Which symbol represents the comparison between 8/6 and 3/1? | < | compareFractions | | 45 | Simple Interest | Simple interest for a principle amount of 9862 dollars, 4% rate of interest and for a time period of 1 years is = | 394.48 | simpleInterest | -| 46 | Multiplication of two matrices | Multiply - -50 36 7 -26 -2 63 - 88 -37 60 -19 61 -56 - 48 -5 69 -87 -64 -92 - -84 -50 -79 -19 86 -13 - 0 28 12 -14 73 -49 - 94 -90 2 26 -38 19 - 2 -11 79 -77 98 -77 - -87 70 72 -32 64 -99 - - and - - 34 32 -6 -32 46 -23 78 -81 -18 - -17 24 49 -62 -50 77 38 -98 -64 - -23 -78 43 5 -83 -5 4 -92 -16 - 46 -47 -92 52 -25 -37 44 51 -7 - 20 26 70 37 96 -73 49 84 42 - -72 -15 -80 -24 58 -47 -41 45 -69 | -8245 -1057 -423 -3535 -569 2034 -6329 1219 -5765 - 6619 567 10737 2391 4001 -6291 10147 -7387 6383 - 1472 -161 13318 -5565 -12574 10381 638 -23699 2621 - 1593 5598 3465 7899 13170 -6487 -4857 24642 10618 - 3592 3027 12206 1473 2120 -412 6082 -635 4561 - 3748 -1803 -11460 2072 5462 -8183 2423 11 947 - 2400 960 22950 2483 952 -1974 4625 -5512 9372 - 1132 -2067 22392 1884 -12276 8196 1949 -7148 5677 | matrixMultiplication | +| 46 | Multiplication of two matrices | Multiply <table><tr><td>-50</td><td>36</td><td>7</td><td>-26</td><td>-2</td><td>63</td></tr><tr><td>88</td><td>-37</td><td>60</td><td>-19</td><td>61</td><td>-56</td></tr><tr><td>48</td><td>-5</td><td>69</td><td>-87</td><td>-64</td><td>-92</td></tr><tr><td>-84</td><td>-50</td><td>-79</td><td>-19</td><td>86</td><td>-13</td></tr><tr><td>0</td><td>28</td><td>12</td><td>-14</td><td>73</td><td>-49</td></tr><tr><td>94</td><td>-90</td><td>2</td><td>26</td><td>-38</td><td>19</td></tr><tr><td>2</td><td>-11</td><td>79</td><td>-77</td><td>98</td><td>-77</td></tr><tr><td>-87</td><td>70</td><td>72</td><td>-32</td><td>64</td><td>-99</td></tr></table> and <table><tr><td>34</td><td>32</td><td>-6</td><td>-32</td><td>46</td><td>-23</td><td>78</td><td>-81</td><td>-18</td></tr><tr><td>-17</td><td>24</td><td>49</td><td>-62</td><td>-50</td><td>77</td><td>38</td><td>-98</td><td>-64</td></tr><tr><td>-23</td><td>-78</td><td>43</td><td> 5</td><td>-83</td><td>-5</td><td> 4</td><td>-92</td><td>-16</td></tr><tr><td> 46</td><td>-47</td><td>-92</td><td>52</td><td>-25</td><td>-37</td><td>44</td><td>51</td><td>-7</td></tr><tr><td> 20</td><td>26</td><td>70</td><td>37</td><td>96</td><td>-73</td><td>49</td><td>84</td><td>42</td></tr><tr><td>-72</td><td>-15</td><td>-80</td><td>-24</td><td>58</td><td>-47</td><td>-41</td><td>45</td><td>-69</td></tr></table>| <table><tr><td>-8245</td><td>-1057</td><td>-423</td><td>-3535</td><td>-569</td><td>2034</td><td>-6329</td><td>1219</td><td>-5765</td></tr><tr><td>6619</td><td> 567</td><td>10737</td><td>2391</td><td>4001</td><td>-6291</td><td>10147</td><td>-7387</td><td>6383</td></tr><tr><td>1472</td><td>-161</td><td>13318</td><td>-5565<td>-12574</td><td>10381</td><td> 638<td>-23699</td><td>2621</td></tr><tr><td>1593</td><td>5598</td><td>3465</td><td>7899</td><td>13170</td><td>-6487</td><td>-4857</td><td>24642</td><td>10618</td></tr><tr><td>3592</td><td>3027</td><td>12206</td><td>1473</td><td>2120</td><td>-412</td><td>6082</td><td>-635</td><td>4561</td></tr><tr><td>3748</td><td>-1803<td>-11460</td><td>2072</td><td>5462</td><td>-8183</td><td>2423</td><td>11</td><td> 947</td></tr><tr><td>2400</td><td> 960</td><td>22950</td><td>2483</td><td> 952</td><td>-1974</td><td>4625</td><td>-5512</td><td>9372</td></tr><tr><td>1132</td><td>-2067</td><td>22392</td><td>1884<td>-12276</td><td>8196</td><td>1949</td><td>-7148</td><td>5677</td></tr></table> | matrixMultiplication | | 47 | Cube Root | cuberoot of 771 upto 2 decimal places is: | 9.17 | CubeRoot | | 48 | Power Rule Integration | 1x^3 + 8x^8 + 10x^10 | (1/3)x^4 + (8/8)x^9 + (10/10)x^11 + c | powerRuleIntegration | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 52 , 84, 154 = | 70 | fourthAngleOfQuadrilateral | @@ -116,4 +92,4 @@ problem, solution = mathgen.genById(0) | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | | 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | +| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | \ No newline at end of file From de1f4c4c1f2a6eca0e85d1e4416bd49cd4fe4141 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 22:05:47 -0400 Subject: [PATCH 58/79] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 342105f..7643a53 100644 --- a/README.md +++ b/README.md @@ -117,4 +117,3 @@ problem, solution = mathgen.genById(0) | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | | 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | | 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | -| 61 | Geometric Progression | Given [2,4,8] find a,r,4th term, sum to 3rd term| 2,2,16,14 | GeomProgrFunc | From 8472e8d577abb4c1fe1676d8faa6f256675e24c3 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 22:31:01 -0400 Subject: [PATCH 59/79] Delete driver.py --- driver.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 driver.py diff --git a/driver.py b/driver.py deleted file mode 100644 index 2063399..0000000 --- a/driver.py +++ /dev/null @@ -1,12 +0,0 @@ -# First test to run mathgenerator -# 19 Oct 2020 - -from mathgenerator import mathgen - -problem, solution = mathgen.addition() -print(problem) -print(solution) - -problem, solution = mathgen.binarytohex() -print(problem) -print(solution) From 127b73abe86b9b21946006b1d37fa2f6ac7b3233 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 22:38:28 -0400 Subject: [PATCH 60/79] Made GOLDEN_RATIO local --- mathgenerator/mathgen.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index d632bef..282ae41 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -3,7 +3,6 @@ import math import fractions genList = [] -GOLDEN_RATIO = (1 + math.sqrt(5))/2 # || Generator class class Generator: @@ -922,9 +921,10 @@ def volumeSphereFunc(maxRadius = 100): return problem,solution def nthFibonacciNumber(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 @@ -996,4 +996,4 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) volumeSphere=Generator("Volume of Sphere",60,"Volume of sphere with radius r m = ","(4*pi/3)*r*r*r",volumeSphereFunc) -nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumber) \ No newline at end of file +nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumber) From baf44937d85acaa16a4e45f305c59d51f7de2382 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 23:14:56 -0400 Subject: [PATCH 61/79] Update mathgen.py --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 7aec9a0..b7018ce 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1161,4 +1161,4 @@ profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percen binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", BinaryToHexFunc) ComplexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", GeomProgrFunc) -geometricMean=Generator("Geometric Mean of N Numbers",61,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) From 0e63b4ee11e4ec894107d05d3974328ceaac8d08 Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 23:48:13 -0400 Subject: [PATCH 62/79] restructure base --- mathgenerator/funcs/__init__.py | 8 ++++++ mathgenerator/funcs/binaryToHexFunc.py | 11 ++++++++ mathgenerator/funcs/geomProgrFunc.py | 15 ++++++++++ mathgenerator/funcs/geometricMeanFunc.py | 27 ++++++++++++++++++ mathgenerator/funcs/harmonicMeanFunc.py | 28 +++++++++++++++++++ mathgenerator/funcs/hcfFunc.py | 11 ++++++++ .../funcs/multiplyComplexNumbersFunc.py | 9 ++++++ mathgenerator/funcs/nthFibonacciNumberFunc.py | 10 +++++++ mathgenerator/funcs/profitLossPercentFunc.py | 14 ++++++++++ mathgenerator/mathgen.py | 9 +++++- test.py | 1 + 11 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 mathgenerator/funcs/binaryToHexFunc.py create mode 100644 mathgenerator/funcs/geomProgrFunc.py create mode 100644 mathgenerator/funcs/geometricMeanFunc.py create mode 100644 mathgenerator/funcs/harmonicMeanFunc.py create mode 100644 mathgenerator/funcs/hcfFunc.py create mode 100644 mathgenerator/funcs/multiplyComplexNumbersFunc.py create mode 100644 mathgenerator/funcs/nthFibonacciNumberFunc.py create mode 100644 mathgenerator/funcs/profitLossPercentFunc.py create mode 100644 test.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 73bd406..efb1ce7 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -53,6 +53,7 @@ from .cubeRootFunc import * from .powerRuleIntegrationFunc import * from .fourthAngleOfQuadriFunc import * from .quadraticEquation import * +from .hcfFunc import * from .DiceSumProbFunc import * from .exponentiationFunc import * from .confidenceIntervalFunc import * @@ -63,3 +64,10 @@ from .sumOfAnglesOfPolygonFunc import * from .dataSummaryFunc import * from .surfaceAreaSphere import * from .volumeSphereFunc import * +from .nthFibonacciNumberFunc import * +from .profitLossPercentFunc import * +from .binaryToHexFunc import * +from .multiplyComplexNumbersFunc import * +from .geomProgrFunc import * +from .geometricMeanFunc import * +from .harmonicMeanFunc import * diff --git a/mathgenerator/funcs/binaryToHexFunc.py b/mathgenerator/funcs/binaryToHexFunc.py new file mode 100644 index 0000000..0f3e962 --- /dev/null +++ b/mathgenerator/funcs/binaryToHexFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def binaryToHexFunc(max_dig=10): + problem = '' + for i in range(random.randint(1, max_dig)): + temp = str(random.randint(0, 1)) + problem += temp + + solution = hex(int(problem, 2)) + return problem, solution diff --git a/mathgenerator/funcs/geomProgrFunc.py b/mathgenerator/funcs/geomProgrFunc.py new file mode 100644 index 0000000..3e3ad5c --- /dev/null +++ b/mathgenerator/funcs/geomProgrFunc.py @@ -0,0 +1,15 @@ +from .__init__ import * + +def geomProgrFunc(number_values=6, min_value=2, max_value=12, n_term=7, sum_term=5): + r=random.randint(min_value,max_value) + a=random.randint(min_value,max_value) + n_term=random.randint(number_values,number_values+5) + sum_term=random.randint(number_values,number_values+5) + GP=[] + for i in range(number_values): + GP.append(a*(r**i)) + problem="For the given GP "+str(GP)+" ,Find the value of a,common ratio,"+str(n_term)+"th term value, sum upto "+str(sum_term)+"th term" + value_nth_term=a*(r**(n_term-1)) + sum_till_nth_term=a*((r**sum_term-1)/(r-1)) + 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) + return problem,solution diff --git a/mathgenerator/funcs/geometricMeanFunc.py b/mathgenerator/funcs/geometricMeanFunc.py new file mode 100644 index 0000000..05ded2b --- /dev/null +++ b/mathgenerator/funcs/geometricMeanFunc.py @@ -0,0 +1,27 @@ +from .__init__ import * + + +def geometricMeanFunc(maxValue=100, maxNum=4): + a=random.randint(1,maxValue) + b=random.randint(1,maxValue) + c=random.randint(1,maxValue) + d=random.randint(1,maxValue) + num=random.randint(2,4) + if num==2: + product=a*b + elif num==3: + product=a*b*c + elif num==4: + product=a*b*c*d + + ans=product**(1/num) + if num==2: + problem=f"Geometric mean of {num} numbers {a} and {b} = " + solution = f"({a}*{b})^(1/{num}) = {ans}" + elif num==3: + problem=f"Geometric mean of {num} numbers {a} , {b} and {c} = " + solution = f"({a}*{b}*{c})^(1/{num}) = {ans}" + elif num==4: + problem=f"Geometric mean of {num} numbers {a} , {b} , {c} , {d} = " + solution = f"({a}*{b}*{c}*{d})^(1/{num}) = {ans}" + return problem,solution diff --git a/mathgenerator/funcs/harmonicMeanFunc.py b/mathgenerator/funcs/harmonicMeanFunc.py new file mode 100644 index 0000000..035273f --- /dev/null +++ b/mathgenerator/funcs/harmonicMeanFunc.py @@ -0,0 +1,28 @@ +from .__init__ import * + + +def harmonicMeanFunc(maxValue=100, maxNum=4): + + a=random.randint(1,maxValue) + b=random.randint(1,maxValue) + c=random.randint(1,maxValue) + d=random.randint(1,maxValue) + num=random.randint(2,4) + if num==2: + sum=(1/a)+(1/b) + elif num==3: + sum=(1/a)+(1/b)+(1/c) + elif num==4: + sum=(1/a)+(1/b)+(1/c)+(1/d) + + ans=num/sum + if num==2: + problem=f"Harmonic mean of {num} numbers {a} and {b} = " + solution = f" {num}/((1/{a}) + (1/{b})) = {ans}" + elif num==3: + problem=f"Harmonic mean of {num} numbers {a} , {b} and {c} = " + solution = f" {num}/((1/{a}) + (1/{b}) + (1/{c})) = {ans}" + elif num==4: + problem=f"Harmonic mean of {num} numbers {a} , {b} , {c} , {d} = " + solution = f" {num}/((1/{a}) + (1/{b}) + (1/{c}) + (1/{d})) = {ans}" + return problem,solution diff --git a/mathgenerator/funcs/hcfFunc.py b/mathgenerator/funcs/hcfFunc.py new file mode 100644 index 0000000..40be783 --- /dev/null +++ b/mathgenerator/funcs/hcfFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + +def hcfFunc(maxVal=20): + a = random.randint(1, maxVal) + b = random.randint(1, maxVal) + x, y = a, b + while(y): + x, y = y, x % y + problem = f"HCF of {a} and {b} = " + solution = str(x) + return problem, solution diff --git a/mathgenerator/funcs/multiplyComplexNumbersFunc.py b/mathgenerator/funcs/multiplyComplexNumbersFunc.py new file mode 100644 index 0000000..f959d4d --- /dev/null +++ b/mathgenerator/funcs/multiplyComplexNumbersFunc.py @@ -0,0 +1,9 @@ +from .__init__ import * + + +def multiplyComplexNumbersFunc(minRealImaginaryNum = -20, maxRealImaginaryNum = 20): + num1 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum)) + num2 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum)) + problem = f"{num1} * {num2} = " + solution = num1 * num2 + return problem, solution diff --git a/mathgenerator/funcs/nthFibonacciNumberFunc.py b/mathgenerator/funcs/nthFibonacciNumberFunc.py new file mode 100644 index 0000000..023a007 --- /dev/null +++ b/mathgenerator/funcs/nthFibonacciNumberFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +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))) + solution = f"{ans}" + return problem, solution diff --git a/mathgenerator/funcs/profitLossPercentFunc.py b/mathgenerator/funcs/profitLossPercentFunc.py new file mode 100644 index 0000000..533c294 --- /dev/null +++ b/mathgenerator/funcs/profitLossPercentFunc.py @@ -0,0 +1,14 @@ +from .__init__ import * + + +def profitLossPercentFunc(maxCP = 1000, maxSP = 1000): + cP = random.randint(1, maxCP) + sP = random.randint(1, maxSP) + diff = abs(sP-cP) + if (sP-cP >= 0): + profitOrLoss = "Profit" + else: + profitOrLoss = "Loss" + percent = diff/cP * 100 + problem = f"{profitOrLoss} percent when CP = {cP} and SP = {sP} is: " + solution = percent diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 14d5668..a3beac6 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -149,4 +149,11 @@ dataSummary = Generator("Mean,Standard Deviation,Variance", surfaceAreaSphereGen = Generator( "Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) volumeSphere = Generator("Volume of Sphere", 60, - "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) \ No newline at end of file + "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) +nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) +profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) +binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", binaryToHexFunc) +complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) +geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) +geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) diff --git a/test.py b/test.py new file mode 100644 index 0000000..288c5b3 --- /dev/null +++ b/test.py @@ -0,0 +1 @@ +from mathgenerator import mathgen From 9241aef6497e674c848bf757151182cfefd3a559 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Sun, 18 Oct 2020 23:57:05 -0400 Subject: [PATCH 63/79] Update test.py --- test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test.py b/test.py index 288c5b3..925ced3 100644 --- a/test.py +++ b/test.py @@ -1 +1,5 @@ from mathgenerator import mathgen + +#test your generators here + +print(mathgen.addition()) From 3ba50015ef4d9abaa404b5d3b9bb272cfdcf2deb Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 00:06:13 -0400 Subject: [PATCH 64/79] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 556fd76..e7cf0eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,12 @@ def additionFunc(maxSum, maxAddend): Before coding, please check README.md to see if someone has already created the generator you plan to make. Skillid is determined by the next available id as can be determined in the table. +#### Restructure Notes +We currently just underwent a large reconstruction of the repository. Here is how you commit to the repo. +* Place your generator instance at the bottom of mathgen.py +* Create a new file in the funcs directory with the same name as your function +* Place `.__init__ import *` at the top of your file and then write your function in the lines beneath it +* Add `from .<yourfunc> import *` at the bottom of the `__init__.py` file inside the funcs directory ### Provide Ideas If you have an idea for a generator but don't have the time or know-how to create it, you can add it as an issue. If you have a lot of ideas, I would suggest adding them to the table in README.md so that they are easier for our team to manage. From a60525edbc47bde83a15fc593383f6dee3798a44 Mon Sep 17 00:00:00 2001 From: devansh-07 <sonidev0201@gmail.com> Date: Mon, 19 Oct 2020 11:02:25 +0530 Subject: [PATCH 65/79] Added 2's complement --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/binary2sComplement.py | 26 +++++++++++++++++++++++ mathgenerator/mathgen.py | 1 + 3 files changed, 28 insertions(+) create mode 100644 mathgenerator/funcs/binary2sComplement.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..b43d727 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .binary2sComplement import * \ No newline at end of file diff --git a/mathgenerator/funcs/binary2sComplement.py b/mathgenerator/funcs/binary2sComplement.py new file mode 100644 index 0000000..f51b797 --- /dev/null +++ b/mathgenerator/funcs/binary2sComplement.py @@ -0,0 +1,26 @@ +from .__init__ import * + +def binary2sComplementFunc(maxDigits=10): + digits = random.randint(1, maxDigits) + question = ''.join([str(random.randint(0, 1)) for i in range(digits)]).lstrip('0') + + answer = [] + for i in question: + answer.append(str(int(not bool(int(i))))) + + carry = True + j = len(answer) - 1 + while j >= 0: + if answer[j] == '0': + answer[j] = '1' + carry = False + break + answer[j] = '0' + j -= 1 + + if j == 0 and carry == True: + answer.insert(0, '1') + + problem = "2's complement of " + question + " =" + solution = ''.join(answer).lstrip('0') + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..860c89b 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 = ", "101010", binary2sComplementFunc) \ No newline at end of file From 7e50827a75ef5b7f97ec9d17497ce61957712992 Mon Sep 17 00:00:00 2001 From: devansh-07 <sonidev0201@gmail.com> Date: Mon, 19 Oct 2020 11:06:36 +0530 Subject: [PATCH 66/79] Added 2's complement function --- mathgenerator/mathgen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 860c89b..302fa34 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,7 +1,7 @@ import random import math import fractions -from .funcs import * +from funcs import * genList = [] @@ -156,4 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) -binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 = ", "101010", binary2sComplementFunc) \ No newline at end of file +binary2sComplement = Generator("Binary 2's Complement", 68, "2's complement of 11010110 =", "101010", binary2sComplementFunc) From d56f20cf0a2c518460a0fd0f121b114b90ff7b70 Mon Sep 17 00:00:00 2001 From: Jayesh Vasudeva <42416623+0tist@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:15:47 +0530 Subject: [PATCH 67/79] Update mathgen.py --- mathgenerator/mathgen.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..e015c81 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,5 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 68, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNorm) +angleBtwVectors=Generator("Angle between 2 vectors", 69, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", AngleBtwVectors) From 07cae1b56b7da4882d478cdd951909736928c00f Mon Sep 17 00:00:00 2001 From: Jayesh Vasudeva <42416623+0tist@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:17:40 +0530 Subject: [PATCH 68/79] Add files via upload --- mathgenerator/funcs/AngleBtwVectors.py | 16 ++++++++++++++++ mathgenerator/funcs/eucldianNorm.py | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/AngleBtwVectors.py create mode 100644 mathgenerator/funcs/eucldianNorm.py diff --git a/mathgenerator/funcs/AngleBtwVectors.py b/mathgenerator/funcs/AngleBtwVectors.py new file mode 100644 index 0000000..09e0a11 --- /dev/null +++ b/mathgenerator/funcs/AngleBtwVectors.py @@ -0,0 +1,16 @@ +import eucldianNorm +import math +from .__init__ import * + + +def AngleBtwVectors(v1: list, v2: list): + sum = 0 + for i in v1: + for j in v2: + sum += i * j + + mags = euclidianNorm(v1) * euclidianNorm(v2) + problem = f"angle between the vectors {v1} and {v2} is:" + solution = math.acos(sum / mags) + # would return the answer in radians + return problem, solution diff --git a/mathgenerator/funcs/eucldianNorm.py b/mathgenerator/funcs/eucldianNorm.py new file mode 100644 index 0000000..b672add --- /dev/null +++ b/mathgenerator/funcs/eucldianNorm.py @@ -0,0 +1,7 @@ +from .__init__ import * + + +def euclidianNorm(v1: list): + problem = f"Euclidian norm or L2 norm of the vector{v1} is:" + solution = sqrt(sum([i**2 for i in v1])) + return problem, solution From c36d7de7d9c4d1383c3e9dba133b3beee63f081c Mon Sep 17 00:00:00 2001 From: Gourav2000 <gouravsarkar67@gmail.com> Date: Mon, 19 Oct 2020 11:47:50 +0530 Subject: [PATCH 69/79] added matrix Inversion --- dev-requirements.txt | 3 +- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/matrixInversion.py | 68 ++++++++++++++++++++++++++ mathgenerator/mathgen.py | 2 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 mathgenerator/funcs/matrixInversion.py diff --git a/dev-requirements.txt b/dev-requirements.txt index c29cf4e..7b33738 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ pytest hypothesis flake8 -autopep8 \ No newline at end of file +autopep8 +sympy \ No newline at end of file diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..ac2c2a8 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .matrixInversion import * diff --git a/mathgenerator/funcs/matrixInversion.py b/mathgenerator/funcs/matrixInversion.py new file mode 100644 index 0000000..7de9f15 --- /dev/null +++ b/mathgenerator/funcs/matrixInversion.py @@ -0,0 +1,68 @@ +from .__init__ import * + +def matrixInversion(SquareMatrixDimension=3, MaxMatrixElement=99, OnlyIntegerElementsInInvertedMatrix=False): + if OnlyIntegerElementsInInvertedMatrix is True: + isItOk = False + Mat = list() + while (isItOk is False): + Mat = list() + for i in range(0, SquareMatrixDimension): + z = list() + for j in range(0, SquareMatrixDimension): + z.append(0) + z[i] = 1 + Mat.append(z) + MaxAllowedMatrixElement = math.ceil( + pow(MaxMatrixElement, 1 / (SquareMatrixDimension))) + randomlist = random.sample( + range(0, MaxAllowedMatrixElement + 1), SquareMatrixDimension) + + for i in range(0, SquareMatrixDimension): + if i == SquareMatrixDimension - 1: + Mat[0] = [j + (k * randomlist[i]) + for j, k in zip(Mat[0], Mat[i])] + else: + Mat[i + 1] = [j + (k * randomlist[i]) + for j, k in zip(Mat[i + 1], Mat[i])] + + for i in range(1, SquareMatrixDimension - 1): + Mat[i] = [sum(i) + for i in zip(Mat[SquareMatrixDimension - 1], Mat[i])] + + isItOk = True + for i in Mat: + for j in i: + if j > MaxMatrixElement: + isItOk = False + break + if isItOk is False: + break + + random.shuffle(Mat) + Mat = sympy.Matrix(Mat) + Mat = sympy.Matrix.transpose(Mat) + Mat = Mat.tolist() + random.shuffle(Mat) + Mat = sympy.Matrix(Mat) + Mat = sympy.Matrix.transpose(Mat) + + else: + randomlist = list(sympy.primerange(0, MaxMatrixElement + 1)) + plist = random.sample(randomlist, SquareMatrixDimension) + randomlist = random.sample( + range(0, MaxMatrixElement + 1), SquareMatrixDimension * SquareMatrixDimension) + randomlist = list(set(randomlist) - set(plist)) + n_list = random.sample( + randomlist, SquareMatrixDimension * (SquareMatrixDimension - 1)) + Mat = list() + for i in range(0, SquareMatrixDimension): + z = list() + z.append(plist[i]) + for j in range(0, SquareMatrixDimension - 1): + z.append(n_list[(i * SquareMatrixDimension) + j - i]) + random.shuffle(z) + Mat.append(z) + Mat = sympy.Matrix(Mat) + problem = 'Inverse of Matrix ' + str(Mat) + ' is:' + solution = str(sympy.Matrix.inv(Mat)) + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..004fbcc 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,6 +1,7 @@ import random import math import fractions +import sympy from .funcs import * genList = [] @@ -156,3 +157,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +invertmatrix = Generator("Inverse of a Matrix", 68, "Inverse of a matrix A is", "A^(-1)", matrixInversion) \ No newline at end of file From cb2f3e7abe7514e4697d75a9ff0bd5bd2b2453e3 Mon Sep 17 00:00:00 2001 From: himanshu1603 <himanshu30ber@gmail.com> Date: Mon, 19 Oct 2020 12:16:18 +0530 Subject: [PATCH 70/79] added absolute difference --- mathgenerator/funcs/absoluteDifferenceFunc.py | 10 ++++++++++ mathgenerator/mathgen.py | 1 + 2 files changed, 11 insertions(+) create mode 100644 mathgenerator/funcs/absoluteDifferenceFunc.py diff --git a/mathgenerator/funcs/absoluteDifferenceFunc.py b/mathgenerator/funcs/absoluteDifferenceFunc.py new file mode 100644 index 0000000..d578d19 --- /dev/null +++ b/mathgenerator/funcs/absoluteDifferenceFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + +def absoluteDifferenceFunc (maxA = 100, maxB = 100): + a = random.randint(-1*maxA, maxA) + b = random.randint(-1*maxB, maxB) + absDiff = abs(a-b) + + problem = "Absolute difference between numbers " + str(a) + " and " + str(b) + " = " + solution = absDiff + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..ad94464 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +absoluteDifference=Generator("Absolute difference between two numbers", 68, "Absolute difference betweeen two numbers a and b =", "|a-b|", absoluteDifferenceFunc) From 13c19f480fc685f5f168a6e517a89b863714d83c Mon Sep 17 00:00:00 2001 From: Stefano Furin <furins@gmail.com> Date: Mon, 19 Oct 2020 09:13:35 +0200 Subject: [PATCH 71/79] fix generators numbering --- README.md | 10 ++++++++-- mathgenerator/mathgen.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6777b5c..1afacb8 100644 --- a/README.md +++ b/README.md @@ -91,5 +91,11 @@ problem, solution = mathgen.genById(0) | 57 | Trigonometric Values | What is cos(60)? | 1/2 | basicTrigonometry | | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | -| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | \ No newline at end of file +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 12m is | 1809.5573684677208 m^2 | surfaceAreaSphereGen | +| 61 | Volume of Sphere | Volume of sphere with radius 14 m = | 11494.040321933857 m^3 | volumeSphere | +| 62 | nth Fibonacci number | What is the 17th Fibonacci number? | 1597 | nthFibonacciNumberGen | +| 64 | Binary to Hexidecimal | 00 | 0x0 | binaryToHex | +| 65 | Multiplication of 2 complex numbers | (13-8j) * (-7-5j) = | (-131-9j) | complexNumMultiply | +| 66 | Geometric Progression | For the given GP [12, 48, 192, 768, 3072, 12288] ,Find the value of a,common ratio,9th term value, sum upto 11th term | The value of a is 12, common ratio is 4 , 9th term is 786432 , sum upto 11th term is 16777212.0 | geometricprogression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 42 and 40 = | (42*40)^(1/2) = 40.98780306383839 | geometricMean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 53 , 62 , 72 , 35 = | 4/((1/53) + (1/62) + (1/72) + (1/35)) = 51.64137311701554 | harmonicMean | \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..a10660d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -146,13 +146,13 @@ sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, dataSummary = Generator("Mean,Standard Deviation,Variance", 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) surfaceAreaSphereGen = Generator( - "Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) -volumeSphere = Generator("Volume of Sphere", 60, + "Surface Area of Sphere", 60, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) +volumeSphere = Generator("Volume of Sphere", 61, "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) -nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) -profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) -binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", binaryToHexFunc) -complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) -geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) -geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) -harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +nthFibonacciNumberGen = Generator("nth Fibonacci number", 62, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) +profitLossPercent = Generator("Profit or Loss Percent", 63, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) +binaryToHex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=", "b", binaryToHexFunc) +complexNumMultiply = Generator("Multiplication of 2 complex numbers", 65, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) +geometricprogression=Generator("Geometric Progression", 66, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) +geometricMean=Generator("Geometric Mean of N Numbers",67,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +harmonicMean=Generator("Harmonic Mean of N Numbers",68,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) From ab960534f9de120c21282eb657aa47a97052e291 Mon Sep 17 00:00:00 2001 From: midhun varman <midhunvarman2010@gmail.com> Date: Mon, 19 Oct 2020 13:04:44 +0530 Subject: [PATCH 72/79] added vector dot product --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/vectorDotFunc.py | 13 +++++++++++++ mathgenerator/mathgen.py | 1 + 3 files changed, 15 insertions(+) create mode 100644 mathgenerator/funcs/vectorDotFunc.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..99ab6b4 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .vectorDotFunc import * diff --git a/mathgenerator/funcs/vectorDotFunc.py b/mathgenerator/funcs/vectorDotFunc.py new file mode 100644 index 0000000..a15cd75 --- /dev/null +++ b/mathgenerator/funcs/vectorDotFunc.py @@ -0,0 +1,13 @@ +from .__init__ import * + + +def vectorDotFunc(minVal=-20, maxVal=20): + a = [random.randint(minVal, maxVal) for i in range(3)] + b = [random.randint(minVal, maxVal) for i in range(3)] + c = [a[0] * b[0], + a[1] * b[1] , + a[2] * b[2] ] + + problem = str(a) + " . " + str(b) + " = " + solution = str(c) + return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..35c657f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +vectorDot = Generator("Dot Product of 2 Vectors",68, "a . b = ", "c", vectorDotFunc) From e77af6cdef48c660d3a82b80b22d983416da69e7 Mon Sep 17 00:00:00 2001 From: midhun varman <midhunvarman2010@gmail.com> Date: Mon, 19 Oct 2020 15:01:19 +0530 Subject: [PATCH 73/79] added dot product --- mathgenerator/funcs/vectorDotFunc.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mathgenerator/funcs/vectorDotFunc.py b/mathgenerator/funcs/vectorDotFunc.py index a15cd75..0364c65 100644 --- a/mathgenerator/funcs/vectorDotFunc.py +++ b/mathgenerator/funcs/vectorDotFunc.py @@ -4,9 +4,7 @@ from .__init__ import * def vectorDotFunc(minVal=-20, maxVal=20): a = [random.randint(minVal, maxVal) for i in range(3)] b = [random.randint(minVal, maxVal) for i in range(3)] - c = [a[0] * b[0], - a[1] * b[1] , - a[2] * b[2] ] + c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] problem = str(a) + " . " + str(b) + " = " solution = str(c) From fe0c86b33e09ee962c373e3ba01b9c0e1bd77a94 Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 09:28:09 -0400 Subject: [PATCH 74/79] Fix euclidianNorm and angleBtwVectors issues --- mathgenerator/funcs/__init__.py | 2 ++ .../funcs/{AngleBtwVectors.py => angleBtwVectorsFunc.py} | 6 +++--- .../funcs/{eucldianNorm.py => euclidianNormFunc.py} | 2 +- mathgenerator/mathgen.py | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) rename mathgenerator/funcs/{AngleBtwVectors.py => angleBtwVectorsFunc.py} (65%) rename mathgenerator/funcs/{eucldianNorm.py => euclidianNormFunc.py} (83%) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..25fb266 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,5 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .euclidianNormFunc import * +from .angleBtwVectorsFunc import * diff --git a/mathgenerator/funcs/AngleBtwVectors.py b/mathgenerator/funcs/angleBtwVectorsFunc.py similarity index 65% rename from mathgenerator/funcs/AngleBtwVectors.py rename to mathgenerator/funcs/angleBtwVectorsFunc.py index 09e0a11..bd2d0b5 100644 --- a/mathgenerator/funcs/AngleBtwVectors.py +++ b/mathgenerator/funcs/angleBtwVectorsFunc.py @@ -1,15 +1,15 @@ -import eucldianNorm +from .euclidianNormFunc import euclidianNormFunc import math from .__init__ import * -def AngleBtwVectors(v1: list, v2: list): +def angleBtwVectorsFunc(v1: list, v2: list): sum = 0 for i in v1: for j in v2: sum += i * j - mags = euclidianNorm(v1) * euclidianNorm(v2) + mags = euclidianNormFunc(v1) * euclidianNormFunc(v2) problem = f"angle between the vectors {v1} and {v2} is:" solution = math.acos(sum / mags) # would return the answer in radians diff --git a/mathgenerator/funcs/eucldianNorm.py b/mathgenerator/funcs/euclidianNormFunc.py similarity index 83% rename from mathgenerator/funcs/eucldianNorm.py rename to mathgenerator/funcs/euclidianNormFunc.py index b672add..f66329e 100644 --- a/mathgenerator/funcs/eucldianNorm.py +++ b/mathgenerator/funcs/euclidianNormFunc.py @@ -1,7 +1,7 @@ from .__init__ import * -def euclidianNorm(v1: list): +def euclidianNormFunc(v1: list): problem = f"Euclidian norm or L2 norm of the vector{v1} is:" solution = sqrt(sum([i**2 for i in v1])) return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4062a96..fa8fd91 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,5 +156,5 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 65, "(x + geometricprogression=Generator("Geometric Progression", 66, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",67,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",68,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) -eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 69, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNorm) -angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", AngleBtwVectors) +eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 69, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNormFunc) +angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", angleBtwVectorsFunc) From 3208d6d485f38b230d721160d3cbc27ecc426a30 Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 09:30:38 -0400 Subject: [PATCH 75/79] Added to __init__.py --- mathgenerator/funcs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 25fb266..bb75b5c 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -73,3 +73,4 @@ from .geometricMeanFunc import * from .harmonicMeanFunc import * from .euclidianNormFunc import * from .angleBtwVectorsFunc import * +from .absoluteDifferenceFunc import * From 16ebfb777c6b81aec9bed9bee05e9cb3761af28c Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 09:40:13 -0400 Subject: [PATCH 76/79] Update mathgen.py --- mathgenerator/mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0b84297..cdad10d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,7 +1,7 @@ import random import math import fractions -from funcs import * +from .funcs import * genList = [] From 092088f8b1364ad299c1c966a8144d5933f036ea Mon Sep 17 00:00:00 2001 From: D-T-666 <tabatadzedima20@gamil.com> Date: Mon, 19 Oct 2020 17:43:04 +0400 Subject: [PATCH 77/79] =?UTF-8?q?=F0=9F=A4=96=20made=20makeReadme.py=20ful?= =?UTF-8?q?ly=20automated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 136 +++++++------- makeReadme.py | 50 ++++-- .../funcs/matrixMultiplicationFunc.py | 7 +- mathgenerator/funcs/moduloFunc.py | 2 +- mathgenerator/funcs/profitLossPercentFunc.py | 2 + mathgenerator/mathgen.py | 167 ++++++------------ 6 files changed, 177 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index 6777b5c..6c692b0 100644 --- a/README.md +++ b/README.md @@ -30,66 +30,80 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| -| 0 | Addition | 42+2= | 44 | addition | -| 1 | Subtraction | 32-26= | 6 | subtraction | -| 2 | Multiplication | 77*1= | 77 | multiplication | -| 3 | Division | 66/9= | 7.333333333333333 | division | -| 4 | Binary Complement 1s | 1010000 | 0101111 | binaryComplement1s | -| 5 | Modulo Division | 61%35= | 26 | moduloDivision | -| 6 | Square Root | sqrt(1)= | 1 | squareRoot | -| 7 | Power Rule Differentiation | 5x^5 | 25x^4 | powerRuleDifferentiation | -| 8 | Square | 20^2= | 400 | square | -| 9 | LCM (Least Common Multiple) | LCM of 19 and 5 = | 95 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 10 and 11 = | 1 | gcd | -| 11 | Basic Algebra | 3x + 7 = 8 | 1/3 | basicAlgebra | -| 12 | Logarithm | log2(128) | 7 | log | -| 13 | Easy Division | 306/18 = | 17 | intDivision | -| 14 | Decimal to Binary | Binary of 28= | 11100 | decimalToBinary | -| 15 | Binary to Decimal | 10001101 | 141 | binaryToDecimal | -| 16 | Fraction Division | (4/1)/(6/3) | 2 | fractionDivision | -| 17 | Integer Multiplication with 2x2 Matrix | 5 * [[10, 3], [0, 1]] = | [[50,15],[0,5]] | intMatrix22Multiplication | -| 18 | Area of Triangle | Area of triangle with side lengths: 13 2 14 = | 11.659223816361019 | areaOfTriangle | -| 19 | Triangle exists check | Does triangle with sides 3, 4 and 25 exist? | No | doesTriangleExist | -| 20 | Midpoint of the two point | (4,-11),(17,-5)= | (10.5,-8.0) | midPointOfTwoPoint | +[//]: # list start +| 0 | Addition | 33+23= | 56 | addition | +| 1 | Subtraction | 14-1= | 13 | subtraction | +| 2 | Multiplication | 52*1= | 52 | multiplication | +| 3 | Division | 14/26= | 0.5384615384615384 | division | +| 4 | Binary Complement 1s | 0110111= | 1001000 | binaryComplement1s | +| 5 | Modulo Division | 23%70= | 23 | moduloDivision | +| 6 | Square Root | sqrt(121)= | 11 | squareRoot | +| 7 | Power Rule Differentiation | 3x^2 + 3x^5 + 1x^2 + 6x^4 + 6x^3 | 6x^1 + 15x^4 + 2x^1 + 24x^3 + 18x^2 | powerRuleDifferentiation | +| 8 | Square | 18^2= | 324 | square | +| 9 | LCM (Least Common Multiple) | LCM of 17 and 11 = | 187 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 15 and 12 = | 3 | gcd | +| 11 | Basic Algebra | 2x + 3 = 10 | 7/2 | basicAlgebra | +| 12 | Logarithm | log2(32) | 5 | log | +| 13 | Easy Division | 196/14 = | 14 | intDivision | +| 14 | Decimal to Binary | Binary of 61= | 111101 | decimalToBinary | +| 15 | Binary to Decimal | 1 | 1 | binaryToDecimal | +| 16 | Fraction Division | (2/1)/(10/5) | 1 | fractionDivision | +| 17 | Integer Multiplication with 2x2 Matrix | 16 * [[4, 1], [1, 2]] = | [[64,16],[16,32]] | intMatrix22Multiplication | +| 18 | Area of Triangle | Area of triangle with side lengths: 15 13 11 = | 69.62892717829278 | areaOfTriangle | +| 19 | Triangle exists check | Does triangle with sides 35, 14 and 37 exist? | Yes | doesTriangleExist | +| 20 | Midpoint of the two point | (15,5),(9,10)= | (12.0,7.5) | midPointOfTwoPoint | | 21 | Factoring Quadratic | x^2-12x+35 | (x-7)(x-5) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 20 and 62 = | 98 | thirdAngleOfTriangle | -| 23 | Solve a System of Equations in R^2 | 5x - 7y = -84, 4x + 5y = 7 | x = -7, y = 7 | systemOfEquations | -| 24 | Distance between 2 points | Find the distance between (5, -18) and (1, 19) | sqrt(1385) | distance2Point | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 15 and 5 = | 15.81 | pythagoreanTheorem | -| 26 | Linear Equations | -6x + -17y = -220 --13x + -19y = -120 | x = -20, y = 20 | linearEquations | -| 27 | Prime Factorisation | Find prime factors of 62 | [2, 31] | primeFactors | -| 28 | Fraction Multiplication | (8/4)*(1/2) | 1 | fractionMultiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 19 sides | 161.05 | angleRegularPolygon | -| 30 | Combinations of Objects | Number of combinations from 12 objects picked 1 at a time | 12 | combinations | -| 31 | Factorial | 0! = | 1 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 8m is | 384 m^2 | surfaceAreaCubeGen | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 18m, 17m, 1m is | 682 m^2 | surfaceAreaCuboidGen | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 31m and radius = 1m is | 201 m^2 | surfaceAreaCylinderGen | -| 35 | Volum of Cube | Volume of cube with side = 9m is | 729 m^3 | volumeCubeGen | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 20m, 1m, 10m is | 200 m^3 | volumeCuboidGen | -| 37 | Volume of cylinder | Volume of cylinder with height = 7m and radius = 7m is | 1077 m^3 | volumeCylinderGen | -| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 13m is | 2522 m^2 | surfaceAreaConeGen | -| 39 | Volume of cone | Volume of cone with height = 4m and radius = 4m is | 67 m^3 | volumeConeGen | -| 40 | Common Factors | Common Factors of 20 and 90 = | [1, 2, 5, 10] | commonFactors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -3/6x + 1 and y = 0/2x + 6 | (-10, 6) | intersectionOfTwoLines | -| 42 | Permutations | Number of Permutations from 11 objects picked 2 at a time = | 110 | permutations | -| 43 | Cross Product of 2 Vectors | [-19, -3, 2] X [-15, -12, 7] = | [3, 103, 183] | vectorCross | -| 44 | Compare Fractions | Which symbol represents the comparison between 8/6 and 3/1? | < | compareFractions | -| 45 | Simple Interest | Simple interest for a principle amount of 9862 dollars, 4% rate of interest and for a time period of 1 years is = | 394.48 | simpleInterest | -| 46 | Multiplication of two matrices | Multiply <table><tr><td>-50</td><td>36</td><td>7</td><td>-26</td><td>-2</td><td>63</td></tr><tr><td>88</td><td>-37</td><td>60</td><td>-19</td><td>61</td><td>-56</td></tr><tr><td>48</td><td>-5</td><td>69</td><td>-87</td><td>-64</td><td>-92</td></tr><tr><td>-84</td><td>-50</td><td>-79</td><td>-19</td><td>86</td><td>-13</td></tr><tr><td>0</td><td>28</td><td>12</td><td>-14</td><td>73</td><td>-49</td></tr><tr><td>94</td><td>-90</td><td>2</td><td>26</td><td>-38</td><td>19</td></tr><tr><td>2</td><td>-11</td><td>79</td><td>-77</td><td>98</td><td>-77</td></tr><tr><td>-87</td><td>70</td><td>72</td><td>-32</td><td>64</td><td>-99</td></tr></table> and <table><tr><td>34</td><td>32</td><td>-6</td><td>-32</td><td>46</td><td>-23</td><td>78</td><td>-81</td><td>-18</td></tr><tr><td>-17</td><td>24</td><td>49</td><td>-62</td><td>-50</td><td>77</td><td>38</td><td>-98</td><td>-64</td></tr><tr><td>-23</td><td>-78</td><td>43</td><td> 5</td><td>-83</td><td>-5</td><td> 4</td><td>-92</td><td>-16</td></tr><tr><td> 46</td><td>-47</td><td>-92</td><td>52</td><td>-25</td><td>-37</td><td>44</td><td>51</td><td>-7</td></tr><tr><td> 20</td><td>26</td><td>70</td><td>37</td><td>96</td><td>-73</td><td>49</td><td>84</td><td>42</td></tr><tr><td>-72</td><td>-15</td><td>-80</td><td>-24</td><td>58</td><td>-47</td><td>-41</td><td>45</td><td>-69</td></tr></table>| <table><tr><td>-8245</td><td>-1057</td><td>-423</td><td>-3535</td><td>-569</td><td>2034</td><td>-6329</td><td>1219</td><td>-5765</td></tr><tr><td>6619</td><td> 567</td><td>10737</td><td>2391</td><td>4001</td><td>-6291</td><td>10147</td><td>-7387</td><td>6383</td></tr><tr><td>1472</td><td>-161</td><td>13318</td><td>-5565<td>-12574</td><td>10381</td><td> 638<td>-23699</td><td>2621</td></tr><tr><td>1593</td><td>5598</td><td>3465</td><td>7899</td><td>13170</td><td>-6487</td><td>-4857</td><td>24642</td><td>10618</td></tr><tr><td>3592</td><td>3027</td><td>12206</td><td>1473</td><td>2120</td><td>-412</td><td>6082</td><td>-635</td><td>4561</td></tr><tr><td>3748</td><td>-1803<td>-11460</td><td>2072</td><td>5462</td><td>-8183</td><td>2423</td><td>11</td><td> 947</td></tr><tr><td>2400</td><td> 960</td><td>22950</td><td>2483</td><td> 952</td><td>-1974</td><td>4625</td><td>-5512</td><td>9372</td></tr><tr><td>1132</td><td>-2067</td><td>22392</td><td>1884<td>-12276</td><td>8196</td><td>1949</td><td>-7148</td><td>5677</td></tr></table> | matrixMultiplication | -| 47 | Cube Root | cuberoot of 771 upto 2 decimal places is: | 9.17 | CubeRoot | -| 48 | Power Rule Integration | 1x^3 + 8x^8 + 10x^10 | (1/3)x^4 + (8/8)x^9 + (10/10)x^11 + c | powerRuleIntegration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 52 , 84, 154 = | 70 | fourthAngleOfQuadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 51x^2+152x+80=0 | [-0.68, -2.3] | quadraticEquationSolve | -| 51 | HCF (Highest Common Factor) | HCF of 11 and 7 = | 1 | hcf | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 37 and 54 = | 89 | thirdAngleOfTriangle | +| 23 | Solve a System of Equations in R^2 | -4x - 8y = 60, -9x + 10y = 51 | x = -9, y = -3 | systemOfEquations | +| 24 | Distance between 2 points | Find the distance between (16, 7) and (19, 14) | sqrt(58) | distance2Point | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 18 and 8 = | 19.70 | pythagoreanTheorem | +| 26 | Linear Equations | -8x + 15y = -109 +6x + -14y = 90 | x = 8, y = -3 | linearEquations | +| 27 | Prime Factorisation | Find prime factors of 130 | [2, 5, 13] | primeFactors | +| 28 | Fraction Multiplication | (8/9)*(3/2) | 4/3 | fractionMultiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 8 sides | 135.0 | angleRegularPolygon | +| 30 | Combinations of Objects | Number of combinations from 11 objects picked 9 at a time | 55 | combinations | +| 31 | Factorial | 2! = | 2 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 17m is | 1734 m^2 | surfaceAreaCubeGen | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 8m, 4m, 17m is | 472 m^2 | surfaceAreaCuboidGen | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 32m and radius = 18m is | 5654 m^2 | surfaceAreaCylinderGen | +| 35 | Volum of Cube | Volume of cube with side = 11m is | 1331 m^3 | volumeCubeGen | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 14m, 19m, 1m is | 266 m^3 | volumeCuboidGen | +| 37 | Volume of cylinder | Volume of cylinder with height = 16m and radius = 18m is | 16286 m^3 | volumeCylinderGen | +| 38 | Surface Area of cone | Surface area of cone with height = 48m and radius = 20m is | 4523 m^2 | surfaceAreaConeGen | +| 39 | Volume of cone | Volume of cone with height = 29m and radius = 6m is | 1093 m^3 | volumeConeGen | +| 40 | Common Factors | Common Factors of 59 and 57 = | [1] | commonFactors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -1/4x - 2 and y = 4/5x + 3 | (-100/21, -17/21) | intersectionOfTwoLines | +| 42 | Permutations | Number of Permutations from 13 objects picked 8 at a time = | 51891840 | permutations | +| 43 | Cross Product of 2 Vectors | [4, -11, 9] X [-8, -19, -5] = | [226, -52, -164] | vectorCross | +| 44 | Compare Fractions | Which symbol represents the comparison between 3/7 and 2/4? | < | compareFractions | +| 45 | Simple Interest | Simple interest for a principle amount of 2398 dollars, 9% rate of interest and for a time period of 5 years is = | 1079.1 | simpleInterest | +| 46 | Multiplication of two matrices | Multiply +<table><tr><td> -83</td><td> 6</td><td> 91</td><td> 4</td><td> -58</td><td> 91</td><td> -91</td><td> 47</td><td> -87</td></tr> <tr><td> 4</td><td> -2</td><td> 24</td><td> 66</td><td> -58</td><td> -58</td><td> -46</td><td> -96</td><td> 52</td></tr> <tr><td> -5</td><td> 5</td><td> -53</td><td> 74</td><td> 31</td><td> -67</td><td> 65</td><td> -31</td><td> 56</td></tr> <tr><td> 77</td><td> -16</td><td> -73</td><td> 50</td><td> 54</td><td> -46</td><td> -11</td><td> 91</td><td> 64</td></tr></table> and + +<table><tr><td> -59</td><td> -20</td><td> -50</td><td> -79</td><td> 75</td><td> 96</td></tr> <tr><td> -56</td><td> 36</td><td> 70</td><td> 47</td><td> -79</td><td> 64</td></tr> <tr><td> 6</td><td> 0</td><td> -8</td><td> -53</td><td> -23</td><td> -83</td></tr> <tr><td> -42</td><td> -84</td><td> 21</td><td> -10</td><td> -42</td><td> 98</td></tr> <tr><td> -9</td><td> -62</td><td> -15</td><td> -68</td><td> -49</td><td> -59</td></tr> <tr><td> -81</td><td> -84</td><td> 3</td><td> 58</td><td> -84</td><td> -59</td></tr> <tr><td> -56</td><td> 33</td><td> 73</td><td> 98</td><td> 51</td><td> -19</td></tr> <tr><td> -81</td><td> -96</td><td> -98</td><td> 61</td><td> -32</td><td> 73</td></tr> <tr><td> -43</td><td> 66</td><td> 83</td><td> 90</td><td> -22</td><td> -94]] | [[ 3120, -15765, -13401, -2683, -17993, -3354] + [ 10584, 13902, 11916, -7446, 4430, 554] + [ -1800, 6587, 14343, 6224, 4525, 4853] + [-12452, -10675, -8693, 427, 2955, 17691]] | matrixMultiplication | +| 47 | Cube Root | cuberoot of 221 upto 2 decimal places is: | 6.05 | CubeRoot | +| 48 | Power Rule Integration | 4x^5 + 2x^5 + 9x^8 + 9x^5 | (4/5)x^6 + (2/5)x^6 + (9/8)x^9 + (9/5)x^6 + c | powerRuleIntegration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 27 , 155, 116 = | 62 | fourthAngleOfQuadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 53x^2+200x+78=0 | [-0.44, -3.33] | quadraticEquationSolve | +| 51 | HCF (Highest Common Factor) | HCF of 7 and 4 = | 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 11 = | 2/36 | diceSumProbability | -| 53 | Exponentiation | 9^9 = | 387420489 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [291, 254, 274, 207, 253, 289, 268, 280, 225, 240, 278, 270, 247, 252, 211, 212, 295, 241, 290, 206, 222, 263, 264, 228, 229, 256, 209, 292] with 99% confidence is | (265.560249263099, 237.72546502261523) | confidenceInterval | -| 55 | Comparing surds | Fill in the blanks 16^(1/7) _ 67^(1/6) | < | surdsComparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 11 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | fibonacciSeries | -| 57 | Trigonometric Values | What is cos(60)? | 1/2 | basicTrigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sumOfAnglesOfPolygon | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[38, 29, 43, 25, 7, 10, 13, 14, 43, 44, 30, 42, 48, 48, 42] | The Mean is 31.733333333333334 , Standard Deviation is 199.26222222222222, Variance is 14.116027140177303 | dataSummary | -| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 13m is | 2123.7166338267 m^2 | surfaceAreaSphereGen | -| 60 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volumeSphere | \ No newline at end of file +| 53 | Exponentiation | 9^10 = | 3486784401 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [266, 201, 278, 209, 229, 275, 216, 234, 219, 276, 282, 281, 208, 247, 265, 273, 286, 202, 231, 207, 251, 203, 259, 288, 291, 260, 210, 263, 222] with 99% confidence is | (260.5668079141175, 231.29526105139982) | confidenceInterval | +| 55 | Comparing surds | Fill in the blanks 15^(1/9) _ 55^(1/1) | < | surdsComparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 10 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] | fibonacciSeries | +| 57 | Trigonometric Values | What is tan(30)? | 1/√3 | basicTrigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 3 sides = | 180 | sumOfAnglesOfPolygon | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[36, 13, 31, 23, 38, 34, 24, 20, 41, 14, 19, 31, 11, 49, 49] | The Mean is 28.866666666666667 , Standard Deviation is 143.5822222222222, Variance is 11.982579948501167 | dataSummary | +| 59 | Surface Area of Sphere | Surface area of Sphere with radius = 11m is | 1520.5308443374597 m^2 | surfaceAreaSphereGen | +| 60 | Volume of Sphere | Volume of sphere with radius 73 m = | 1629510.5990953872 m^3 | volumeSphere | +| 61 | nth Fibonacci number | What is the 68th Fibonacci number? | 72723460248141 | nthFibonacciNumberGen | +| 62 | Profit or Loss Percent | Profit percent when CP = 825 and SP = 972 is: | 17.81818181818182 | profitLossPercent | +| 63 | Binary to Hexidecimal | 100000 | 0x20 | binaryToHex | +| 64 | Multiplication of 2 complex numbers | (3+14j) * (-3+16j) = | (-233+6j) | complexNumMultiply | +| 65 | Geometric Progression | For the given GP [4, 16, 64, 256, 1024, 4096] ,Find the value of a,common ratio,8th term value, sum upto 7th term | The value of a is 4, common ratio is 4 , 8th term is 65536 , sum upto 7th term is 21844.0 | geometricprogression | +| 66 | Geometric Mean of N Numbers | Geometric mean of 3 numbers 81 , 35 and 99 = | (81*35*99)^(1/3) = 65.47307713912309 | geometricMean | +| 67 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 99 and 25 = | 2/((1/99) + (1/25)) = 39.91935483870967 | harmonicMean | diff --git a/makeReadme.py b/makeReadme.py index 64f7989..796dc00 100644 --- a/makeReadme.py +++ b/makeReadme.py @@ -1,25 +1,51 @@ # To use, paste at bottom of mathgen.py code, change line variable and remove all table rows in README.md except for the top 2 and run mathgen.py +# NOTE: not anymore. but still leaving this comment in. +from mathgenerator.mathgen import * wList = getGenList() +lines = [] +with open('mathgenerator/mathgen.py', 'r') as f: + lines=f.readlines() + allRows = [] -f = open('mathgen.py') -lines = f.readlines() -line = 720 # This has to be changed depending on which line the first generator appears on +line = lines.index('# Funcs_start - DO NOT REMOVE!\n')+1 # get the first line of the functions in mathgen.py for item in wList: myGen = item[2] - prob, sol = myGen() + # NOTE: renamed 'sol' to 'solu' to make it look nicer + prob, solu = myGen() prob = str(prob).rstrip("\n") - sol = str(sol).rstrip("\n") + solu = str(solu).rstrip("\n") + # edge case for matrixMultiplication + if item[0] == 46: + print(prob) + + prob = prob.replace("[[", "<table><tr><td>") + prob = prob.replace("[", "<tr><td>") + prob = prob.replace(", ", "</td><td>") + prob = prob.replace("]]\n", "</td></tr></table>") + prob = prob.replace("]\n", "</td></tr>") + print(prob) + instName = lines[line] - def_name = instName[:instName.find('=')].strip() - row = [myGen.id, myGen.title, prob, sol, def_name] + func_name = instName[:instName.find('=')].strip() # NOTE: renamed 'def_name' to 'func_name' because it suits it more + row = [myGen.id, myGen.title, prob, solu, func_name] + # print(item[1], func_name) line += 1 + if line > len(lines): + break allRows.append(row) -g = open('../README.md', "a") -for row in allRows: - tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n" - g.write(tableLine) -g.close() +with open('README.md', "r") as g: + lines = g.readlines() + + line = lines.index('[//]: # list start\n') + lines = lines[:line+1] + + for row in allRows: + tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n" + lines.append(tableLine) + +with open('README.md', "w") as g: + g.writelines(lines) print("New README.md table generated") diff --git a/mathgenerator/funcs/matrixMultiplicationFunc.py b/mathgenerator/funcs/matrixMultiplicationFunc.py index de69218..eeaa265 100644 --- a/mathgenerator/funcs/matrixMultiplicationFunc.py +++ b/mathgenerator/funcs/matrixMultiplicationFunc.py @@ -40,11 +40,12 @@ def matrixMultiplicationFuncHelper(inp): m = len(inp) n = len(inp[0]) - string = "" + string = "[[" for i in range(m): for j in range(n): string += f"{inp[i][j]: 6d}" - string += " " - string += "\n" + string += ", "if j < n-1 else "" + string += "]\n [" if i < m-1 else "" + string += "]]" return string \ No newline at end of file diff --git a/mathgenerator/funcs/moduloFunc.py b/mathgenerator/funcs/moduloFunc.py index 5f8d2af..71f1421 100644 --- a/mathgenerator/funcs/moduloFunc.py +++ b/mathgenerator/funcs/moduloFunc.py @@ -4,7 +4,7 @@ from .__init__ import * def moduloFunc(maxRes=99, maxModulo=99): a = random.randint(0, maxModulo) b = random.randint(0, min(maxRes, maxModulo)) - c = a % b + c = a % b if b != 0 else 0 problem = str(a) + "%" + str(b) + "=" solution = str(c) diff --git a/mathgenerator/funcs/profitLossPercentFunc.py b/mathgenerator/funcs/profitLossPercentFunc.py index 533c294..05a3653 100644 --- a/mathgenerator/funcs/profitLossPercentFunc.py +++ b/mathgenerator/funcs/profitLossPercentFunc.py @@ -12,3 +12,5 @@ def profitLossPercentFunc(maxCP = 1000, maxSP = 1000): percent = diff/cP * 100 problem = f"{profitOrLoss} percent when CP = {cP} and SP = {sP} is: " solution = percent + + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..3265a0f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -33,126 +33,73 @@ def getGenList(): # Format is: # <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) +# Funcs_start - DO NOT REMOVE! addition = Generator("Addition", 0, "a+b=", "c", additionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc) -multiplication = Generator( - "Multiplication", 2, "a*b=", "c", multiplicationFunc) +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) +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) +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 (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) +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 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) -intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", - 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) -areaOfTriangle = Generator( - "Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) -doesTriangleExist = Generator("Triangle exists check", 19, - "Does triangle with sides a, b and c exist?", "Yes/No", isTriangleValidFunc) -midPointOfTwoPoint = Generator("Midpoint of the two point", 20, - "((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) -factoring = Generator("Factoring Quadratic", 21, - "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) -thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, - "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) -systemOfEquations = Generator("Solve a System of Equations in R^2", 23, - "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) -distance2Point = Generator("Distance between 2 points", 24, - "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) -pythagoreanTheorem = Generator( - "Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) -# This has multiple variables whereas #23 has only x and y -linearEquations = Generator( - "Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) -primeFactors = Generator("Prime Factorisation", 27, - "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) -fractionMultiplication = Generator( - "Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) -angleRegularPolygon = Generator("Angle of a Regular Polygon", 29, - "Find the angle of a regular polygon with 6 sides", "120", regularPolygonAngleFunc) -combinations = Generator("Combinations of Objects", 30, - "Combinations available for picking 4 objects at a time from 6 distinct objects =", " 15", combinationsFunc) +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) +intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix",17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) +areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) +doesTriangleExist = Generator("Triangle exists check", 19,"Does triangle with sides a, b and c exist?", "Yes/No", isTriangleValidFunc) +midPointOfTwoPoint = Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", MidPointOfTwoPointFunc) +factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) +thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) +systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc) +distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)", distanceTwoPointsFunc) +pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) +linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc)# This has multiple variables whereas #23 has only x and y +primeFactors = Generator("Prime Factorisation", 27, "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) +fractionMultiplication = Generator("Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) +angleRegularPolygon = Generator("Angle of a Regular Polygon", 29,"Find the angle of a regular polygon with 6 sides", "120", regularPolygonAngleFunc) +combinations = Generator("Combinations of Objects", 30, "Combinations available for picking 4 objects at a time from 6 distinct objects =", " 15", combinationsFunc) factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc) -surfaceAreaCubeGen = Generator( - "Surface Area of Cube", 32, "Surface area of cube with side a units is", "b units^2", surfaceAreaCube) -surfaceAreaCuboidGen = Generator( - "Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid) -surfaceAreaCylinderGen = Generator( - "Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder) -volumeCubeGen = Generator( - "Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube) -volumeCuboidGen = Generator( - "Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid) -volumeCylinderGen = Generator( - "Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder) -surfaceAreaConeGen = Generator( - "Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone) -volumeConeGen = Generator( - "Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone) -commonFactors = Generator( - "Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc) -intersectionOfTwoLines = 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) -permutations = Generator( - "Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc) -vectorCross = Generator("Cross Product of 2 Vectors", - 43, "a X b = ", "c", vectorCrossFunc) -compareFractions = Generator( - "Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc) -simpleInterest = 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) -matrixMultiplication = Generator("Multiplication of two matrices", - 46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) -CubeRoot = Generator( - "Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) -powerRuleIntegration = Generator( - "Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) -fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49, - "Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) -quadraticEquationSolve = Generator( - "Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) -hcf = Generator("HCF (Highest Common Factor)", 51, - "HCF of a and b = ", "c", hcfFunc) -diceSumProbability = 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) -exponentiation = Generator( - "Exponentiation", 53, "a^b = ", "c", exponentiationFunc) -confidenceInterval = Generator("Confidence interval For sample S", - 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) -surdsComparison = Generator( - "Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) -fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers", - "prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc) -basicTrigonometry = Generator( - "Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc) -sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, - "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) -dataSummary = Generator("Mean,Standard Deviation,Variance", - 59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) -surfaceAreaSphereGen = Generator( - "Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) -volumeSphere = Generator("Volume of Sphere", 60, - "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) +surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube with side a units is", "b units^2", surfaceAreaCube) +surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid) +surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder) +volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube) +volumeCuboidGen = Generator( "Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid) +volumeCylinderGen = Generator( "Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder) +surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone) +volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone) +commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc) +intersectionOfTwoLines = 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) +permutations = Generator("Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc) +vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc) +compareFractions = Generator( "Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc) +simpleInterest = 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) +matrixMultiplication = Generator("Multiplication of two matrices",46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc) +CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc) +powerRuleIntegration = Generator("Power Rule Integration", 48, "nx^m=", "(n/m)x^(m+1)", powerRuleIntegrationFunc) +fourthAngleOfQuadrilateral = Generator("Fourth Angle of Quadrilateral", 49,"Fourth angle of Quadrilateral with angles a,b,c =", "angle4", fourthAngleOfQuadriFunc) +quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation) +hcf = Generator("HCF (Highest Common Factor)", 51,"HCF of a and b = ", "c", hcfFunc) +diceSumProbability = 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) +exponentiation = Generator("Exponentiation", 53, "a^b = ", "c", exponentiationFunc) +confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc) +surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc) +fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc) +basicTrigonometry = Generator("Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc) +sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) +dataSummary = Generator("Mean,Standard Deviation,Variance",59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc) +surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere) +volumeSphere = Generator("Volume of Sphere", 60,"Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc) profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", binaryToHexFunc) complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc) -geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) -geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) -harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +geometricprogression = Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) +geometricMean = Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) +harmonicMean = Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) From b3a80ee8cef0ee86b02ee1a8b95e7ecb70d07178 Mon Sep 17 00:00:00 2001 From: lukew3 <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 09:49:32 -0400 Subject: [PATCH 78/79] localized sympy --- mathgenerator/funcs/matrixInversion.py | 3 ++- mathgenerator/mathgen.py | 1 - test.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/matrixInversion.py b/mathgenerator/funcs/matrixInversion.py index 7de9f15..822cb83 100644 --- a/mathgenerator/funcs/matrixInversion.py +++ b/mathgenerator/funcs/matrixInversion.py @@ -1,4 +1,5 @@ from .__init__ import * +import sympy def matrixInversion(SquareMatrixDimension=3, MaxMatrixElement=99, OnlyIntegerElementsInInvertedMatrix=False): if OnlyIntegerElementsInInvertedMatrix is True: @@ -65,4 +66,4 @@ def matrixInversion(SquareMatrixDimension=3, MaxMatrixElement=99, OnlyIntegerEle Mat = sympy.Matrix(Mat) problem = 'Inverse of Matrix ' + str(Mat) + ' is:' solution = str(sympy.Matrix.inv(Mat)) - return problem, solution \ No newline at end of file + return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4a0810c..01456be 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,7 +1,6 @@ import random import math import fractions -import sympy from .funcs import * genList = [] diff --git a/test.py b/test.py index 925ced3..e5bb2c1 100644 --- a/test.py +++ b/test.py @@ -3,3 +3,4 @@ from mathgenerator import mathgen #test your generators here print(mathgen.addition()) +print(mathgen.genById(74)) From ac1581e9410b9a92dd2fffd17167377d2a302134 Mon Sep 17 00:00:00 2001 From: Luke Weiler <lukew25073@gmail.com> Date: Mon, 19 Oct 2020 10:01:43 -0400 Subject: [PATCH 79/79] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 6c692b0..f2d81dc 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,7 @@ problem, solution = mathgen.genById(0) | 43 | Cross Product of 2 Vectors | [4, -11, 9] X [-8, -19, -5] = | [226, -52, -164] | vectorCross | | 44 | Compare Fractions | Which symbol represents the comparison between 3/7 and 2/4? | < | compareFractions | | 45 | Simple Interest | Simple interest for a principle amount of 2398 dollars, 9% rate of interest and for a time period of 5 years is = | 1079.1 | simpleInterest | -| 46 | Multiplication of two matrices | Multiply -<table><tr><td> -83</td><td> 6</td><td> 91</td><td> 4</td><td> -58</td><td> 91</td><td> -91</td><td> 47</td><td> -87</td></tr> <tr><td> 4</td><td> -2</td><td> 24</td><td> 66</td><td> -58</td><td> -58</td><td> -46</td><td> -96</td><td> 52</td></tr> <tr><td> -5</td><td> 5</td><td> -53</td><td> 74</td><td> 31</td><td> -67</td><td> 65</td><td> -31</td><td> 56</td></tr> <tr><td> 77</td><td> -16</td><td> -73</td><td> 50</td><td> 54</td><td> -46</td><td> -11</td><td> 91</td><td> 64</td></tr></table> and - -<table><tr><td> -59</td><td> -20</td><td> -50</td><td> -79</td><td> 75</td><td> 96</td></tr> <tr><td> -56</td><td> 36</td><td> 70</td><td> 47</td><td> -79</td><td> 64</td></tr> <tr><td> 6</td><td> 0</td><td> -8</td><td> -53</td><td> -23</td><td> -83</td></tr> <tr><td> -42</td><td> -84</td><td> 21</td><td> -10</td><td> -42</td><td> 98</td></tr> <tr><td> -9</td><td> -62</td><td> -15</td><td> -68</td><td> -49</td><td> -59</td></tr> <tr><td> -81</td><td> -84</td><td> 3</td><td> 58</td><td> -84</td><td> -59</td></tr> <tr><td> -56</td><td> 33</td><td> 73</td><td> 98</td><td> 51</td><td> -19</td></tr> <tr><td> -81</td><td> -96</td><td> -98</td><td> 61</td><td> -32</td><td> 73</td></tr> <tr><td> -43</td><td> 66</td><td> 83</td><td> 90</td><td> -22</td><td> -94]] | [[ 3120, -15765, -13401, -2683, -17993, -3354] +| 46 | Multiplication of two matrices | Multiply <table><tr><td>-50</td><td>36</td><td>7</td><td>-26</td><td>-2</td><td>63</td></tr><tr><td>88</td><td>-37</td><td>60</td><td>-19</td><td>61</td><td>-56</td></tr><tr><td>48</td><td>-5</td><td>69</td><td>-87</td><td>-64</td><td>-92</td></tr><tr><td>-84</td><td>-50</td><td>-79</td><td>-19</td><td>86</td><td>-13</td></tr><tr><td>0</td><td>28</td><td>12</td><td>-14</td><td>73</td><td>-49</td></tr><tr><td>94</td><td>-90</td><td>2</td><td>26</td><td>-38</td><td>19</td></tr><tr><td>2</td><td>-11</td><td>79</td><td>-77</td><td>98</td><td>-77</td></tr><tr><td>-87</td><td>70</td><td>72</td><td>-32</td><td>64</td><td>-99</td></tr></table> and <table><tr><td>34</td><td>32</td><td>-6</td><td>-32</td><td>46</td><td>-23</td><td>78</td><td>-81</td><td>-18</td></tr><tr><td>-17</td><td>24</td><td>49</td><td>-62</td><td>-50</td><td>77</td><td>38</td><td>-98</td><td>-64</td></tr><tr><td>-23</td><td>-78</td><td>43</td><td> 5</td><td>-83</td><td>-5</td><td> 4</td><td>-92</td><td>-16</td></tr><tr><td> 46</td><td>-47</td><td>-92</td><td>52</td><td>-25</td><td>-37</td><td>44</td><td>51</td><td>-7</td></tr><tr><td> 20</td><td>26</td><td>70</td><td>37</td><td>96</td><td>-73</td><td>49</td><td>84</td><td>42</td></tr><tr><td>-72</td><td>-15</td><td>-80</td><td>-24</td><td>58</td><td>-47</td><td>-41</td><td>45</td><td>-69</td></tr></table>| <table><tr><td>-8245</td><td>-1057</td><td>-423</td><td>-3535</td><td>-569</td><td>2034</td><td>-6329</td><td>1219</td><td>-5765</td></tr><tr><td>6619</td><td> 567</td><td>10737</td><td>2391</td><td>4001</td><td>-6291</td><td>10147</td><td>-7387</td><td>6383</td></tr><tr><td>1472</td><td>-161</td><td>13318</td><td>-5565<td>-12574</td><td>10381</td><td> 638<td>-23699</td><td>2621</td></tr><tr><td>1593</td><td>5598</td><td>3465</td><td>7899</td><td>13170</td><td>-6487</td><td>-4857</td><td>24642</td><td>10618</td></tr><tr><td>3592</td><td>3027</td><td>12206</td><td>1473</td><td>2120</td><td>-412</td><td>6082</td><td>-635</td><td>4561</td></tr><tr><td>3748</td><td>-1803<td>-11460</td><td>2072</td><td>5462</td><td>-8183</td><td>2423</td><td>11</td><td> 947</td></tr><tr><td>2400</td><td> 960</td><td>22950</td><td>2483</td><td> 952</td><td>-1974</td><td>4625</td><td>-5512</td><td>9372</td></tr><tr><td>1132</td><td>-2067</td><td>22392</td><td>1884<td>-12276</td><td>8196</td><td>1949</td><td>-7148</td><td>5677</td></tr></table> | matrixMultiplication | [ 10584, 13902, 11916, -7446, 4430, 554] [ -1800, 6587, 14343, 6224, 4525, 4853] [-12452, -10675, -8693, 427, 2955, 17691]] | matrixMultiplication |