mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Merge pull request #103 from ShivenTripathi/patch-2
add problem to find roots of quadratic equation
This commit is contained in:
@@ -714,6 +714,18 @@ def fourthAngleOfQuadriFunc(maxAngle = 180):
|
|||||||
solution = angle4
|
solution = angle4
|
||||||
return problem, solution
|
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
|
||||||
|
|
||||||
# || Class Instances
|
# || Class Instances
|
||||||
|
|
||||||
#Format is:
|
#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)
|
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)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)
|
||||||
|
|||||||
Reference in New Issue
Block a user