mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge branch 'master' into patch-2
This commit is contained in:
@@ -714,6 +714,29 @@ def fourthAngleOfQuadriFunc(maxAngle = 180):
|
||||
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)
|
||||
@@ -731,7 +754,7 @@ def DiceSumProbFunc(maxDice=3):
|
||||
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)
|
||||
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
|
||||
|
||||
@@ -790,4 +813,6 @@ 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 =","z", DiceSumProbFunc)
|
||||
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)
|
||||
Reference in New Issue
Block a user