Merge branch 'master' into master

This commit is contained in:
Luke Weiler
2020-10-17 14:04:39 -04:00
committed by GitHub
2 changed files with 45 additions and 21 deletions

25
makeReadme.py Normal file
View File

@@ -0,0 +1,25 @@
#To use, paste at bottom of mathgen.py code, change line variable and remove all table rows in README.md except for the top 2 and run mathgen.py
wList = getGenList()
allRows = []
f=open('mathgen.py')
lines=f.readlines()
line = 720 #This has to be changed depending on which line the first generator appears on
for item in wList:
myGen = item[2]
prob, sol = myGen()
prob = str(prob).rstrip("\n")
sol = str(sol).rstrip("\n")
instName = lines[line]
def_name = instName[:instName.find('=')].strip()
row = [myGen.id, myGen.title, prob, sol, def_name]
line+=1
allRows.append(row)
g=open('../README.md', "a")
for row in allRows:
tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n"
g.write(tableLine)
g.close()
print("New README.md table generated")

View File

@@ -666,8 +666,8 @@ def matrixMultiplicationFunc(maxVal=100):
for t in range(n): for t in range(n):
temp+=a[r][t]*b[t][c] temp+=a[r][t]*b[t][c]
res[r].append(temp) res[r].append(temp)
problem= f"Multiply \n{a_string}\n and \n\n{b_string}" #consider using a, b instead of a_string, b_string if the problem doesn't look right problem= f"Multiply {a} and {b}" #consider using a, b instead of a_string, b_string if the problem doesn't look right
solution= matrixMultiplicationFuncHelper(res) solution= res#matrixMultiplicationFuncHelper(res)
return problem, solution return problem, solution
def matrixMultiplicationFuncHelper(inp): def matrixMultiplicationFuncHelper(inp):
@@ -860,8 +860,7 @@ doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with s
midPointOfTwoPoint=Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPointFunc) midPointOfTwoPoint=Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPointFunc)
factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc) factoring = Generator("Factoring Quadratic", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc)
thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc) thirdAngleOfTriangle = Generator("Third Angle of Triangle", 22, "Third Angle of the triangle = ", "angle3", thirdAngleOfTriangleFunc)
systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y = 13, -3x - 3y = -6", "x = -1, y = 3", systemOfEquationsFunc)
systemOfEquationsFunc)
distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc)
pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc)
linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) #This has multiple variables whereas #23 has only x and y linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) #This has multiple variables whereas #23 has only x and y