#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

\text{This is the answer.}

Reset app

\text{Switch the dependent\
and independent\variables.}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{Trace the\dependent and\
independent\variables until they\meet at a single\point.}

#eeeeee

#2E006758

#2EB00020

\text{This is some additional info}

sizingText

\text{\bold{Possible Solution}\
The points are\
plotted where the\
dependent and \
independent\
variables meet.
}

allRandoms = RandomUniform(0, 0.99, 400)
numRandoms: 39
countQuestion = 0
randIndex: (Mod[countQuestion, floor(Length[allRandoms] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandoms, randIndex, randIndex + numRandoms - 1)
randomProb: Mod[countQuestion, 3] + 1
dimensionsAll: {{-7.7, -52.9, 7, 138.1}, {-7.7, (-52.9 * 0.2), 7, (138.1 * 0.2)}, {-7.7, -52.9, 7, 138.1}}
dimensions: dimensionsAll(randomProb)
pixelHeightConvert: (dimensions(4) - dimensions(2)) / 500
boxHeight: ((31 + 4) * pixelHeightConvert)
pixelWidthConvert: (dimensions(3) - dimensions(1)) / 800
rowWidth: ((If[randomProb ≟ 1, 154, randomProb ≟ 2, 171, 168] + 2) * pixelWidthConvert)
CornerLeftTable = PixelsToPoint(Corner[1], Corner[3], Corner[5], (11 + 5, 154))
randomMult = Zip((-100 + floor((n * 201))) / 10, n, Take[currentRandomSeeds, 15, 39])
randomRecip = Zip(10 + floor((n * 11)), n, Take[currentRandomSeeds, 8, 32])
randomXH = Zip(floor((n * 61)) / 10, n, First[currentRandomSeeds, 24])
randomSlope1: (100 + floor((currentRandomSeeds(3) * 38))) / 10
randomSlope2: (-32 + floor((currentRandomSeeds(4) * 12))) / 10
problem3x = Zip(1 + floor((n * 6)), n, First[currentRandomSeeds, 24])
problem3y = Zip((round((20 + floor((n * 80))) / 5) * 5), n, Take[currentRandomSeeds, 15, 39])
randomPoints3: (problem3x, problem3y)
randomPoints3U = Unique(randomPoints3)
lengthUnique3 = Length(randomPoints3U)
uniqueRandomPoints3 = If(6 < Mod[(6 * (countQuestion + 1)), lengthUnique3] < lengthUnique3, Take[randomPoints3U, Mod[(6 * countQuestion), lengthUnique3] + 1, Mod[(6 * (countQuestion + 1)), lengthUnique3]], Mod[(6 * (countQuestion + 1)), lengthUnique3] ≟ 0, Last[randomPoints3U, 6], Join[{Last[randomPoints3U, 6 - Mod[(6 * (countQuestion + 1)), lengthUnique3]], First[randomPoints3U, Mod[(6 * (countQuestion + 1)), lengthUnique3]]}])
titleHeight = If(randomProb ≠ 2, ((42 + 2) * pixelHeightConvert), ((55 + 2) * pixelHeightConvert))
rowHeight: ((31 + 1) * pixelHeightConvert)
numMax = If(randomProb ≟ 2, 20, 100)
randomSlope = If(randomProb ≟ 1, randomSlope1, randomProb ≟ 2, randomSlope2, 0)
guideLine(x) = (randomSlope * x) + 20
problemPoints12 = Zip((n, guideLine(n) + c / k), n, randomXH, c, randomMult, k, randomRecip)
problemPoints12Rounded = Zip((round(x(n)), (round((y(n) * If[randomProb ≟ 2, 1, 0.2])) * If[randomProb ≟ 2, 1, 5])), n, problemPoints12)
problemPoints12U = Unique(KeepIf[y(n) < numMax, n, problemPoints12Rounded])
lengthUnique12 = Length(problemPoints12U)
uniqueRandomPoints12 = If(6 < Mod[(6 * (countQuestion + 1)), lengthUnique12] < lengthUnique12, Take[problemPoints12U, Mod[(6 * countQuestion), lengthUnique12] + 1, Mod[(6 * (countQuestion + 1)), lengthUnique12]], Mod[(6 * (countQuestion + 1)), lengthUnique12] ≟ 0, Last[problemPoints12U, 6], Join[{Last[problemPoints12U, 6 - Mod[(6 * (countQuestion + 1)), lengthUnique12]], First[problemPoints12U, Mod[(6 * (countQuestion + 1)), lengthUnique12]]}])
randomPoints = If(randomProb ≟ 3, uniqueRandomPoints3, uniqueRandomPoints12)
randomPointsRounded = Sort(Zip[(round(x(n)), If[y(n) < 0, 0, y(n)]), n, randomPoints])
scalingFactor = If(randomProb ≟ 2, 0.2, 1)
DragPoints = Flatten(Sequence[Sequence[(n / 2, ((5 * m) * scalingFactor)), n, -6, 12], m, 0, 20])
InputPoint1 = Point(DragPoints)
InputPoint6 = Point(DragPoints)
InputPoint5 = Point(DragPoints)
InputPoint4 = Point(DragPoints)
InputPoint3 = Point(DragPoints)
InputPoint2 = Point(DragPoints)
answerInput1: {InputPoint1, InputPoint2, InputPoint3, InputPoint4, InputPoint5, InputPoint6}
answerInput = Zip((x(n), y(n)), n, answerInput1)
errorList = KeepIf(¬(n ∈ answerInput), n, randomPointsRounded)
numFirstIncorrect: IndexOf[errorList(1), randomPointsRounded] - 1
graphDimsAll: {{-1, -11, 6.5, 105}, {-1, (-11 * 0.2), 6.5, (105 * 0.2)}, {-1, -11, 6.5, 105}}
graphDims: graphDimsAll(randomProb)
DragArea = Polygon({(-2.5, (105 * scalingFactor)), (-2.5, (-1 * scalingFactor)), (6.5, (-1 * scalingFactor)), (6.5, (105 * scalingFactor))})
answerInputSorted = Sort(answerInput)
boolCorrects = Zip(n ∈ randomPointsRounded, n, answerInput)
solutionYDifferences = Zip(abs(y(m) - y(n)), m, answerInputSorted, n, randomPointsRounded)
solutionXDifferences = Zip(abs(x(m) - x(n)), m, answerInputSorted, n, randomPointsRounded)
inputCurrent: {answerInputSorted}
boolCorrectPoints = Zip(n ≟ 0 ∧ m ≤ (2 * scalingFactor), n, solutionXDifferences, m, solutionYDifferences)
animationSlider = 0 (slider from 0 to 1.3, step 0.01)
graphDimPoints: {(graphDims(1), graphDims(2)), (graphDims(1), graphDims(4)), (graphDims(3), graphDims(4)), (graphDims(3), graphDims(2))}
graphArea = Polygon(graphDimPoints)
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
correct: ¬(false ∈ boolCorrects)
showbuttons = true
showhinttypicalerror = false
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16 + 36 + 24 + 16 + 8
pixelsTop: 24 + 16 + 8
borderBox = Polygon(Zip[PixelsToPoint[Corner[1], Corner[3], Corner[5], A], A, {(pixelsLeft, pixelsTop), (pixelsLeft, y(Corner[5]) - pixelsBottom), Corner[5] - (pixelsRight, pixelsBottom), (x(Corner[5]) - pixelsRight, pixelsTop)}])
layoutY: 448
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 170 + 24
layoutAppSize = Corner(5)
inputPointLastPos: (0, 1)
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
numScatter: 1 / (6 / (20 + floor((currentRandomSeeds(2) * 80))))
numRecip: 1 / ((5 * numScatter))
axisX = Segment((0, 0), (graphDims(3), 0))
axisY = Segment((0, 0), (0, graphDims(4)))
axisLabels: {{"\text{Hours Spent Studying}", "\text{Grade \%}"}, {"\text{Price \$}", "\text{Number Sold}"}, {"\text{Number of Siblings}", "\text{Grade \%}"}}
axisLabel: axisLabels(randomProb)
tableLabels: {{"\text{Hours}", "\text{Grade \%}"}, {"\text{\begin{array}{c}Price\\\left(\$\right)\end{array}}", "\text{\begin{array}{c}Number\\Sold\end{array}}"}, {"\text{Siblings}", "\text{Grade \%}"}}
tableLabel: tableLabels(randomProb)
problemText: {"Data was collected to show the relationship between number of hours spent studying\\and grade (\%) of students.", "Data was collected to show the relationship between price of a candy bar and the \\\\nnumber of candy bars sold.", "Data was collected to show the relationship between number of siblings and math\\score."}
textXDropped = false
textYDropped = false
step = 1
textLabelX: "\text{" + (LaTeX[axisLabel(1)]) + "}"
textLabelY: "\text{" + (LaTeX[axisLabel(2)]) + "}"
randomOrder = If(countQuestion ≟ 0, 1, 1 + floor((currentRandomSeeds(1) * 2)))
sizeLabelX: "\text{" + (LaTeX[axisLabel(1)]) + "}"
sizeLabelY: "\text{" + (LaTeX[axisLabel(2)]) + "}"
numLabelXW = Distance(Corner[sizeLabelX, 1], Corner[sizeLabelX, 2])
numLabelYW = Distance(Corner[sizeLabelY, 1], Corner[sizeLabelY, 2])
pointStartY: (If[randomProb ≟ 2, 0.2, 1] * 75)
textListForTable = Join({{tableLabel(1) + "&" + (tableLabel(2)) + "\vphantom{\frac{a}{b}}\\\hline"}, Sequence["" + (x(randomPointsRounded(n))) + "&" + (y(randomPointsRounded(n))) + "\vphantom{\large{|}}\\\hline", n, 1, 6]})
textForTable = Sum(textListForTable)
textTable: "\begin{array}{|c|c|}
\hline" + (LaTeX[textForTable]) + "
\end{array}"
boxAxisXLabel = Polygon(Sequence[Corner[textLabelX, n], n, 1, 4])
boxAxisYLabel = Polygon(Sequence[Corner[textLabelY, n], n, 1, 4])
polygonCoordsStart: {(0, -24), (0, -10), (6.5, -10), (6.5, -24)}
polygonCoords: (x(polygonCoordsStart), (y(polygonCoordsStart) * If[randomProb ≟ 2, 0.2, 1]))
dragArea = Polygon(polygonCoords)
CornerSizing = Corner(sizingText, 4)
polygonShade: dragArea
xLabelCorners = Sequence(Corner[textLabelX, n], n, 1, 4)
yLabelCorners = Sequence(Corner[textLabelY, n], n, 1, 4)
xInRegion: true ∈ Zip[IsInRegion[n, dragArea], n, xLabelCorners]
yInRegion: true ∈ Zip[IsInRegion[n, dragArea], n, yLabelCorners]
boolRegionFilled: xInRegion ∨ yInRegion
vertLabelY = VerticalText(textLabelY)
sizeLabelYVert = VerticalText(textLabelY)
numVertYH = Distance(Corner[sizeLabelYVert, 1], Corner[sizeLabelYVert, 4])
PolygonCoordsStart: Midpoint[polygonCoords(2), polygonCoords(3)] - (numLabelXW / 2, 0)
StartInputPoint = Translate(PolygonCoordsStart, Vector[(2 * Vector[CornerSizing, PolygonCoordsStart])])
PointLabelY: (-1, (y(graphDimPoints(2)) + numVertYH) / 2)
hints1: {"the number of hours\\studying affects the grade.", "the price of a candy bar\\affects the amount sold", " the number of siblings\\affect the grade."}
textHint1: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\The independent variable affects\\
the dependent variable. This data\\
shows how " + (LaTeX[hints1(randomProb)]) + "\\\\
\text{\it{" + (LaTeX[textLabelX]) + "}} is the\\independent variable.}"
showhint1 = false
correctPoints = RemoveUndefined(Sequence[If[boolCorrectPoints(n), answerInputSorted(n)], n, 1, 6])
HintPoint2: (0, y(errorList(1)))
HintPoint3: errorList(1)
hintBox = makeBox(CornerLeftTable, rowWidth, boxHeight)
animationSlider1 = If(animationSlider < 0.3, 0, animationSlider - 0.3)
HintPoint1: (x(errorList(1)), 0)
HintAnimate1 = PartitionPoint(HintPoint1, HintPoint3, animationSlider1, 1)
HintAnimate2 = PartitionPoint(HintPoint2, HintPoint3, animationSlider1, 1)
speed: 4
hintSeg2 = Segment(HintPoint2, HintAnimate2 - (0.15, 0))
hintSeg1 = Segment(HintPoint1, HintAnimate1 - (0, (2.4 * scalingFactor)))
hintBoxFirst = Translate(hintBox, Vector[(0, ((-numFirstIncorrect) * rowHeight) - titleHeight)])
hintBoxOutline = Translate(hintBox, Vector[(0, ((-numFirstIncorrect) * rowHeight) - titleHeight)])
inputSaved: {(-2.5, 20.05), (-2, 19), (-2.5, 15.8), (-1.5, 18), (-2, 16.900000000000002), (-2.5, 18)}
enableBtnValidate: inputSaved ≠ inputCurrent ∧ (¬(false ∈ Zip[IsInRegion[n, graphArea], n, answerInput]))
animationPlaying: 0 < animationSlider < 1.3
animationSlider2 = 0 (slider from 0 to 1, step 0.01)
PointStartY: (If[randomOrder ≟ 2, 0, 0.35 + numLabelXW] + dimensions(1) + 0.5, pointStartY)
PointStartX: (If[randomOrder ≟ 1, 0, 0.35 + numLabelYW] + dimensions(1) + 0.5, pointStartY)
isTypicalError: false
errorListInput = Remove(answerInput, randomPointsRounded)
solutionList = Intersection(answerInput, randomPointsRounded)
solutionAnimation = Zip(PartitionPoint[n, m, animationSlider2, 1], n, Sort[errorListInput], m, Sort[errorList])
boolValidMove: {}
DragStart2: (-2, (If[randomProb ≟ 2, 0.2, 1] * 95))
DragStart4: (-1.5, (If[randomProb ≟ 2, 0.2, 1] * 90))
DragStart5: (-2, (If[randomProb ≟ 2, 0.2, 1] * 84.5))
DragStart6: (-2.5, (If[randomProb ≟ 2, 0.2, 1] * 90))
DragStart1: (-2.5, (If[randomProb ≟ 2, 0.2, 1] * 100.25))
onboarding = false
pulsingSpeed: 8
pulsing = 0.9 (slider from 0 to 1, step 0.1)
textForTitle = Sum({tableLabel(1) + "&" + (tableLabel(2)) + "\vphantom{\frac{a}{b}}\\\hline"})
textForRow = Sum({"" + (x(randomPointsRounded(1))) + "&" + (y(randomPointsRounded(1))) + "\vphantom{\large{|}}\\\hline"})
textQuestion: "\text{" + (LaTeX[problemText(randomProb)]) + "} "
DragStart3: (-2.5, (If[randomProb ≟ 2, 0.2, 1] * 79))
pulsingObject = expandCircle(InputPoint1, 7 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
textLabelYStatic: "" + (LaTeX[textLabelY]) + ""
textLabelXStatic: "" + (LaTeX[textLabelX]) + ""
textXMoved: Corner[textLabelX, 1] ≟ Corner[textLabelXStatic, 1]
textYMoved: Corner[textLabelY, 1] ≟ Corner[textLabelYStatic, 1]
textInstruction2: "" + (LaTeX[If[step ≟ 1, "\textsf{Drag the independent variable}\\\textsf{to the }\math{x-}\textsf{axis.}", "\textsf{Drag points onto the grid to\\graph the data.}"]]) + ""

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: PointToPixels
PointToPixels(Corner1,Corner3,Corner5,InputPoint)
Input: Corner1, Corner3, Corner5, InputPoint
Output: OutputPixels

Corner1: (-5, -5)
Corner3: (16, 6)
Corner5: (300, 200)
xLeft: x(Corner1)
xRight: x(Corner3)
yTop: y(Corner3)
yBottom: y(Corner1)
yPixels: (y(Corner5) * (y(InputPoint) - yBottom) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)

Tool: PartitionPoint
PartitionPoint(P1,P2,Num,Den)
Input: SimMove, solutionPoint, animation1Slider, animation1Range
Output: Animation1Point

$\textbf{\mathsf{F}}$

Animation1Point: SimMove + (animation1Slider * (solutionPoint - SimMove) / animation1Range)

Tool: circlePixels
circlePixels(A,pixelRadius,Corner1,Corner3,Corner5
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newCircle

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
newCircle = Circle(A, pointRadius)

Tool: expandCircle
expandCircle(A,pixelRadius,Corner1,Corner3,Corner5)
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newEllipse

distanceX: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
distanceY: (pixelRadius / y(Corner5) * (y(Corner3) - y(Corner1)))
xyScale: distanceY / distanceX
pointGap: distanceX
cMinor = Min(pointGap, (pointGap * xyScale))
cMajor = Max(pointGap, (pointGap * xyScale))
f1: sqrt(cMajor^(2) - cMinor^(2))
A: (3, 4)
newEllipse = If(xyScale < 1, Ellipse[A + (f1, 0), A + ((-f1), 0), A + (cMajor, 0)], Ellipse[A + (0, f1), A + (0, (-f1)), A + (0, cMajor)])

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: cornerBox
cornerBox(width,height,bottomLeftPoint)
Input: width, length, StartPoint
Output: myBox

StartPoint: (0, 0)
A: StartPoint
D: StartPoint + (0, length)
B: StartPoint + (width, 0)
C: StartPoint + (width, length)
myBox = Polygon({A, B, C, D})