mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Two Point distance
This commit is contained in:
@@ -276,6 +276,16 @@ def factoringFunc(range_x1 = 10, range_x2 = 10):
|
|||||||
solution = f"(x{x1})(x{x2})"
|
solution = f"(x{x1})(x{x2})"
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
def distanceTwoPoints(maxValXY = 20, minValXY=-20):
|
||||||
|
point1X = random.randint(minValXY, maxValXY+1)
|
||||||
|
point1Y = random.randint(minValXY, maxValXY+1)
|
||||||
|
point2X = random.randint(minValXY, maxValXY+1)
|
||||||
|
point2Y = random.randint(minValXY, maxValXY+1)
|
||||||
|
distanceSq = (point1X - point2X) ** 2 + (point1Y - point2Y) ** 2
|
||||||
|
solution = f"sqrt({distanceSq})"
|
||||||
|
problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})"
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
# || Class Instances
|
# || Class Instances
|
||||||
|
|
||||||
#Format is:
|
#Format is:
|
||||||
@@ -301,4 +311,5 @@ intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix",
|
|||||||
areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc)
|
areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc)
|
||||||
doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?","Yes/No", isTriangleValidFunc)
|
doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?","Yes/No", isTriangleValidFunc)
|
||||||
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("Subtraction", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc)
|
factoring = Generator("Subtraction", 21, "x^2+(x1+x2)+x1*x2", "(x-x1)(x-x2)", factoringFunc)
|
||||||
|
distance2Point = Generator("Distance between 2 points", 22, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPoints)
|
||||||
Reference in New Issue
Block a user