From c4f21014d023dc926f40260fc96669f35d27947f Mon Sep 17 00:00:00 2001 From: razinc Date: Fri, 16 Oct 2020 22:43:40 +0800 Subject: [PATCH 01/21] 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 39d9040da26095bca5632b31e25d245c868f8a71 Mon Sep 17 00:00:00 2001 From: NarayanAdithya Date: Sun, 18 Oct 2020 08:43:41 +0530 Subject: [PATCH 02/21] 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 Date: Sun, 18 Oct 2020 09:02:12 +0530 Subject: [PATCH 03/21] 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 Date: Sun, 18 Oct 2020 09:03:00 +0530 Subject: [PATCH 04/21] 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 Date: Sun, 18 Oct 2020 09:06:03 +0530 Subject: [PATCH 05/21] 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 Date: Sun, 18 Oct 2020 09:07:43 +0530 Subject: [PATCH 06/21] 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 Date: Sun, 18 Oct 2020 09:09:16 +0530 Subject: [PATCH 07/21] 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 Date: Sun, 18 Oct 2020 09:15:21 +0530 Subject: [PATCH 08/21] 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 09/21] 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 10/21] 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 11/21] 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 12/21] 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 e1c50c5fd68caa11ab452d590ede0d1a791da815 Mon Sep 17 00:00:00 2001 From: ieshaan12 Date: Sun, 18 Oct 2020 14:26:13 +0530 Subject: [PATCH 13/21] 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 Date: Sun, 18 Oct 2020 16:11:38 +0530 Subject: [PATCH 14/21] 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 5d787161f1a87f47b89de88a8763c41bd84b8604 Mon Sep 17 00:00:00 2001 From: "sakshi.kst" Date: Sun, 18 Oct 2020 22:01:42 +0530 Subject: [PATCH 15/21] 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 Date: Sun, 18 Oct 2020 18:28:30 -0500 Subject: [PATCH 16/21] 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 Date: Mon, 19 Oct 2020 02:27:00 +0200 Subject: [PATCH 17/21] 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
-50367-26-263
88-3760-1961-56
48-569-87-64-92
-84-50-79-1986-13
02812-1473-49
94-90226-3819
2-1179-7798-77
-877072-3264-99
and
3432-6-3246-2378-81-18
-172449-62-507738-98-64
-23-7843 5-83-5 4-92-16
46-47-9252-25-374451-7
2026703796-73498442
-72-15-80-2458-47-4145-69
|
-8245-1057-423-3535-5692034-63291219-5765
6619 5671073723914001-629110147-73876383
1472-16113318-5565-1257410381 638-236992621
159355983465789913170-6487-48572464210618
359230271220614732120-4126082-6354561
3748-1803-1146020725462-8183242311 947
2400 960229502483 952-19744625-55129372
1132-2067223921884-1227681961949-71485677
| 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 Date: Sun, 18 Oct 2020 22:05:47 -0400 Subject: [PATCH 18/21] 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 Date: Sun, 18 Oct 2020 22:31:01 -0400 Subject: [PATCH 19/21] 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 Date: Sun, 18 Oct 2020 22:38:28 -0400 Subject: [PATCH 20/21] 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 Date: Sun, 18 Oct 2020 23:14:56 -0400 Subject: [PATCH 21/21] 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)