mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Integer Multiplication with 2x2 Matrix
This commit is contained in:
@@ -206,6 +206,17 @@ def divideFractionsFunc(maxVal=10):
|
||||
solution = x
|
||||
return problem, solution
|
||||
|
||||
def multiplyIntToMatrix22(maxMatrixVal = 10, maxRes = 100):
|
||||
a = random.randint(0, maxMatrixVal)
|
||||
b = random.randint(0, maxMatrixVal)
|
||||
c = random.randint(0, maxMatrixVal)
|
||||
d = random.randint(0, maxMatrixVal)
|
||||
constant = random.randint(0, int(maxRes/max(a,b,c,d)))
|
||||
problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = "
|
||||
solution = f"[[{a*constant},{b*constant}],[{c*constant},{d*constant}]]"
|
||||
return problem, solution
|
||||
|
||||
|
||||
# || Class Instances
|
||||
|
||||
#Format is:
|
||||
@@ -227,3 +238,4 @@ intDivision = Generator("Easy Division", 13,"a/b=","c",divisionToIntFunc)
|
||||
decimalToBinary = Generator("Decimal to Binary",14,"Binary of a=","b",DecimalToBinaryFunc)
|
||||
binaryToDecimal = Generator("Binary to Decimal",15,"Decimal of a=","b",BinaryToDecimalFunc)
|
||||
fractionDivision = Generator("Fraction Division", 16, "(a/b)/(c/d)=", "x/y", divideFractionsFunc)
|
||||
intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22)
|
||||
Reference in New Issue
Block a user