$\text{SHOW SOLUTION}$

#C75000

#4D4D4D

No selection allowed for all input boxes

Fix position and allow selection for all text objects

Empty all input boxes

Reset app

\text{The two legs go on the left side. The\
hypotenuse goes on the right side.}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#E07415

\text{It is a right triangle if and only if the sum of the\squares 
of the legs are equal to the square of the\
hypotenuse.
}

#eeeeee

#2E006758

#2EB00020

$\text{TRY ANOTHER}$

\text{Slide to compare}

\text{Height}

\text{Width}

randomTens = Shuffle(Join[{Sequence[9, 9], Sequence[1, 9]}])
randomA = Shuffle({2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4})
randomOnes = Shuffle(Join[{Sequence[0, 9], Sequence[0, 9], Sequence[0, 9]}])
randomHundreds = Shuffle(Join[{Sequence[3, 9], Sequence[3, 9], Sequence[3, 9]}])
slideN = 0 (slider from (-rangeN) to rangeN, step 1)
slideM = 0 (slider from (-rangeM) to rangeM, step 1)
countQuestion = 39
numA: randomA(Mod[countQuestion, Length[randomA]] + 1)
numAWord = Element({"two", "three", "four"}, numA - 1)
numMStart: (100 * randomHundreds(Mod[countQuestion, Length[randomHundreds]] + 1)) + (10 * randomTens(Mod[countQuestion, Length[randomTens]] + 1)) + randomOnes(Mod[countQuestion, Length[randomOnes]] + 1)
numM: numMStart + slideM
numNStart: floor(numMStart / 20)
numN: numNStart - slideN
numAN: (numA * numN)
solnSlider = 0 (slider from 0 to numA, step 0.1)
Anchor1 = (-48.086962891813315, 39.18581795109452)
pixelsPerPoint: x(Corner[5]) / (x(Corner[2]) - x(Corner[1]))
maxWidth: 600 / pixelsPerPoint
scaleFactor: maxWidth / (numMStart + 15)
maxN: numNStart + 15
maxHeight: (maxN * scaleFactor)
Anchor2: Anchor1 - (0, maxHeight + 2)
boxHeight: (numN * scaleFactor)
boxWidth: (scaleFactor * numM)
solnAnchors = Sequence(Anchor2 + (0, (-K)), K, 0, (numA * (boxHeight - 0.5)), boxHeight)
scale: 1.5
showhint = false
showsolution = false
showbuttons = true
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 10
pixelsTop: 24
speed: 1
boxA = makeBox(Anchor1, boxWidth, boxHeight)
boxB = makeBox(Anchor2, boxWidth, (boxHeight * numA))
measureTop = Segment(Anchor1 + (0, 3), Anchor1 + (boxWidth, 3))
maxM: numMStart + 15
captionTop = Text((("" * numM) * ""), Anchor1 + (boxWidth / 2, 2), true, true, 0, 1)
col1: {(((((((((("\(" * numAN) * "\times") * numM) * "=(") * numA) * "\times") * numN) * ")\times") * numM) * "\)"), (((((("\(=" * numA) * "\times(") * numN) * "\times") * numM) * ")\)")}
col2: {(((((("\textsf{\(" * numAN) * "\) is ") * numAWord) * " times ") * numN) * ".}"), (((((((((("\textsf{So, }" * numAN) * " \times") * numM) * "\textsf{ is \(") * numAWord) * "\) times }") * numN) * "\times") * numM) * ".")}
solutiontext = TableText({TableText[col1, "vr"], TableText[col2, "vl"]}, "c")
outlineA = makeBox(Anchor1, boxWidth, boxHeight)
outlineB = makeBox(Anchor2, boxWidth, (boxHeight * numA))
solnTimers = Sequence(If[solnSlider < A - 1, 0, If[solnSlider > A, 1, solnSlider - A + 1]], A, 1, 4)
solnBoxes = Zip(makeBox[Anchor1 + (A * Vector[Anchor1, B]), boxWidth, boxHeight], A, solnTimers, B, solnAnchors)
solnBox1: solnBoxes(1)
solnOutline1: solnBoxes(1)
solnBox2: solnBoxes(2)
solnOutline2: solnBoxes(2)
solnBox3: solnBoxes(3)
solnOutline3: solnBoxes(3)
solnBox4: solnBoxes(4)
solnOutline4: solnBoxes(4)
rangeN = Min(15, floor(numNStart / 3))
rangeM: 15
measureSide1 = Segment(Anchor1 + (-3, 0), Anchor1 + (-3, (-boxHeight)))
measureSide2 = Segment(Anchor2 + (-3, 0), Anchor2 + (-3, ((-numA) * boxHeight)))
captionSideA = Text((("\(" * numN) * "\)"), Anchor1 + (-3.5, ((-boxHeight)) / 2), true, true, -1, 0)
captionSideB = Text((("\(" * numAN) * "\)"), Anchor2 + (-3.5, (((-numA) * boxHeight)) / 2), true, true, -1, 0)
textQuestion: "\textsf{How do the products compare?\quad\quad}" + (LaTeX[numN]) + "\times " + (LaTeX[numM]) + "\textsf{ and }" + (LaTeX[(numA * numN)]) + "\times " + (LaTeX[numM]) + ""
ySolnTop: y(Anchor2) - (boxHeight * numA)
ySolnBottom: -2
PSoln: (-59.5, (ySolnTop + ySolnBottom) / 2 + 3)

Tool: PixelsToPoint
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: PixelsToPoint (command PixelsToPoint1)
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: simpRadForm
simpRadForm(num)
Input: n
Output: simplestRadical

n: 35
l1 = PrimeFactors(n)
l2 = Frequency(l1)
l3 = Sequence(Sum[First[l2, i]], i, 1, Length[l2])
l4 = Zip(Mod[a, 2], a, l2)
l5: l2 - l4
before = Zip((l1(a))^(b), a, l3, b, l4)
a = Product(before)
l6 = Zip((l1(a))^(b), a, l3, b, l5)
after: sqrt(Product[l6])
simplestRadical: "" + (LaTeX[If[after > 1 ∨ a ≟ 1, after + "", ""]]) + "" + (LaTeX[If[a > 1, "\sqrt{" + a + "}", ""]]) + ""

Tool: makeBox
makeBox(point, width,height)
Input: PointText1, boxWidth, boxHeight
Output: BoxText1

PointText2: PointText1 + (boxWidth, 0)
PointText3: PointText2 - (0, boxHeight)
PointText4: PointText1 - (0, boxHeight)
BoxText1 = Polygon({PointText1, PointText2, PointText3, PointText4})

Tool: makeBox (command makeBox1)
makeBox(point, width,height)
Input: PointText1, boxWidth, boxHeight
Output: BoxText1

PointText2: PointText1 + (boxWidth, 0)
PointText3: PointText2 - (0, boxHeight)
PointText4: PointText1 - (0, boxHeight)
BoxText1 = Polygon({PointText1, PointText2, PointText3, PointText4})

Tool: getLblCornerPos
getLabelCornerPos(A,B,C) returns corner# of label box for midpoint of each triangle side
Input: A, B, C
Output: allCornerPositions

slopeAB: (y(A) - y(B)) / (x(A) - x(B))
regionAB(x, y) = y > (slopeAB * (x - x(B))) + y(B)
cornerAB = If(IsInRegion[C, regionAB], If[slopeAB < 0, 3, 4], If[slopeAB > 0, 2, 1])
slopeCA: (y(C) - y(A)) / (x(C) - x(A))
regionCA(x, y) = y > (slopeCA * (x - x(A))) + y(A)
cornerCA = If(IsInRegion[B, regionCA], If[slopeCA < 0, 3, 4], If[slopeCA > 0, 2, 1])
slopeBC: (y(B) - y(C)) / (x(B) - x(C))
regionBC(x, y) = y > (slopeBC * (x - x(C))) + y(C)
cornerBC = If(IsInRegion[A, regionBC], If[slopeBC < 0, 3, 4], If[slopeBC > 0, 2, 1])
allCornerPositions: {cornerAB, cornerBC, cornerCA}