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 01/15] 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 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 02/15] 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 03/15] 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 04/15] 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 05/15] 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 06/15] 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 07/15] 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 08/15] 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 09/15] 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 10/15] 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 11/15] 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)Z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n!_-8VWh-l39D*_LXgLq5v9v5)}s8*%$v@ryiz0#zsk)fV>*>mLka2Q|rv~HF%`1Y`88xby?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 12/15] 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 e2bbbee7c6957ac6276c9b95dad579fcc93745ac Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 12:54:30 -0400 Subject: [PATCH 13/15] 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 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 14/15] 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 Date: Sat, 17 Oct 2020 13:38:09 -0400 Subject: [PATCH 15/15] 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 |