mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge branch 'master' into patch-3
This commit is contained in:
@@ -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 |
|
| 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 |
|
| 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 |
|
| 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
|
| 26 | Linear Equations | -11x + -16y = -302 , 1x + 20y = 250 | x = 10, y = 12 | linearEquations |
|
||||||
1x + 20y = 250 | x = 10, y = 12 | linearEquations |
|
|
||||||
| 27 | Prime Factorisation | Find prime factors of 55 | [5, 11] | primeFactors |
|
| 27 | Prime Factorisation | Find prime factors of 55 | [5, 11] | primeFactors |
|
||||||
| 28 | Fraction Multiplication | (4/9)*(8/10) | 16/45 | fractionMultiplication |
|
| 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 |
|
| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 15 sides | 156.0 | angleRegularPolygon |
|
||||||
|
|||||||
@@ -713,6 +713,57 @@ def fourthAngleOfQuadriFunc(maxAngle = 180):
|
|||||||
problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} ="
|
problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} ="
|
||||||
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
|
||||||
|
|
||||||
|
def hcfFunc(maxVal=20):
|
||||||
|
a = random.randint(1, maxVal)
|
||||||
|
b = random.randint(1, maxVal)
|
||||||
|
x, y = a, b
|
||||||
|
while(y):
|
||||||
|
x, y = y, x % y
|
||||||
|
problem = f"HCF of {a} and {b} = "
|
||||||
|
solution = str(x)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
def DiceSumProbFunc(maxDice=3):
|
||||||
|
a = random.randint(1,maxDice)
|
||||||
|
b = random.randint(a,6*a)
|
||||||
|
count=0
|
||||||
|
for i in [1,2,3,4,5,6]:
|
||||||
|
if a==1:
|
||||||
|
if i==b:
|
||||||
|
count=count+1
|
||||||
|
elif a==2:
|
||||||
|
for j in [1,2,3,4,5,6]:
|
||||||
|
if i+j==b:
|
||||||
|
count=count+1
|
||||||
|
elif a==3:
|
||||||
|
for j in [1,2,3,4,5,6]:
|
||||||
|
for k in [1,2,3,4,5,6]:
|
||||||
|
if i+j+k==b:
|
||||||
|
count=count+1
|
||||||
|
problem = "If {} dice are rolled at the same time, the probability of getting a sum of {} =".format(a,b)
|
||||||
|
solution="{}/{}".format(count, 6**a)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
def exponentiationFunc(maxBase = 20,maxExpo = 10):
|
||||||
|
base = random.randint(1, maxBase)
|
||||||
|
expo = random.randint(1, maxExpo)
|
||||||
|
problem = f"{base}^{expo} ="
|
||||||
|
solution = str(base ** expo)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
def confidenceIntervalFunc():
|
def confidenceIntervalFunc():
|
||||||
n=random.randint(20,40)
|
n=random.randint(20,40)
|
||||||
j=random.randint(0,3)
|
j=random.randint(0,3)
|
||||||
@@ -734,7 +785,6 @@ def confidenceIntervalFunc():
|
|||||||
solution= '({}, {})'.format(mean+standard_error, mean-standard_error)
|
solution= '({}, {})'.format(mean+standard_error, mean-standard_error)
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
# || Class Instances
|
# || Class Instances
|
||||||
|
|
||||||
#Format is:
|
#Format is:
|
||||||
@@ -787,7 +837,11 @@ vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vecto
|
|||||||
compareFractions=Generator("Compare Fractions",44,"Which symbol represents the comparison between a/b and c/d?",">/</=",compareFractionsFunc)
|
compareFractions=Generator("Compare Fractions",44,"Which symbol represents the comparison between a/b and c/d?",">/</=",compareFractionsFunc)
|
||||||
simpleInterest = Generator("Simple Interest", 45, "Simple interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc)
|
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)
|
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)
|
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)
|
||||||
ConfidenceInterval = Generator("Confidence interval For sample S", 51, "With X% confidence", "is (A,B)", confidenceIntervalFunc)
|
quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1,x2} of the quadratic equation ax^2+bx+c=0", "x1,x2", quadraticEquation)
|
||||||
|
hcf = Generator("HCF (Highest Common Factor)", 51, "HCF of a and b = ", "c", hcfFunc)
|
||||||
|
diceSumProbability=Generator("Probability of a certain sum appearing on faces of dice", 52,"If n dices are rolled then probabilty of getting sum of x is =","z", DiceSumProbFunc)
|
||||||
|
exponentiation = Generator("Exponentiation", 53,"a^b = ","c",exponentiationFunc)
|
||||||
|
confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc)
|
||||||
|
|||||||
Reference in New Issue
Block a user