\vphantom{\dfrac{1}{2}y}

2222

222

#4D4D4D

$\text{NEW EXPRESSION}$

Fix position and allow selection for all text objects

Empty all input boxes

\text{This is the answer.}

\text{\bold{Possible Solution}\
This is the solution}

Reset app

\text{This is the error specific hint}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{This is the general hint}

#eeeeee

#2E006758

#2EB00020

\text{Drag to open}

\text{Slowly reveal the expression to see how different parts can be described.}

randomList2 = Shuffle(Sequence[100])
randomList3 = Shuffle(Sequence[100])
randomList1 = Shuffle(Sequence[100])
maxOpen = 0.19999999999999996
minOpen = 0
maxLeft: -16.5
minLeft = -23 (slider from -50 to 5)
PRight = (-1.3, 2.8)
PLeft = (-16.5, 2.8)
GapRight: PRight + (1.5, 0)
widthOp = 1.373964991444673
varsSingle: {"a", "b", "c", "d", "e", "f", "g", "n", "t", "u", "v", "x", "y", "z"}
varsDouble: {"ab", "xy", "cd", "st"}
coeffs: {"2", "3", "5", "7", "9", "11", "13", "17", "19", "23"}
maxRand: 100
countQuestion = 1
random1 = Element(randomList1, Mod[countQuestion, Length[randomList1]] + 1)
random2 = Element(randomList2, Mod[countQuestion, Length[randomList2] + 1])
random3 = Element(randomList3, Mod[countQuestion, Length[randomList3] + 1])
caseNum: Mod[countQuestion, 5] + 1
numVars = Element({{2, 1, 0}, {1, 1, 2}, {0, 1, 1}, {0, 1, 1}, {1, 1, 1}}, caseNum)
GapLeft: PLeft + (18.5, 0)
currentVars = Sequence(Element[{"", varsSingle(Mod[random2 + A, Length[varsSingle]] + 1), varsDouble(Mod[random2 + A, Length[varsDouble]] + 1)}, numVars(A + 1) + 1], A, 0, 2)
numDigitsCoeff = Element({{0, 1, 1}, {2, 1, 1}, {1, 1, 0}, {1, 1, 1}, {1, 1, 2}}, caseNum)
currentCoeffs = Zip(If[A ≟ 0, "", Element[coeffs, Mod[B, Length[coeffs] / 2] + 1 + If[A ≟ 2, 5, 0]]], A, numDigitsCoeff, B, {random1, random2, random3})
baseY: 7
opening = Polygon({(x(GapLeft), baseY - 3), (x(GapRight), baseY - 3), (x(GapRight), baseY + 3), (x(GapLeft), baseY + 3)})
width3: 2
width2 = 1.6315834273405496
width1 = 1.0877222848937
widthsCurrent = Zip(Element[{width1, width2, width3}, Length[A] + Length[B]], A, currentCoeffs, B, currentVars)
P1: ((-widthsCurrent(1)) - widthOp - (0.5 * widthsCurrent(2)), baseY)
P5: ((0.5 * widthsCurrent(2)) + widthOp, baseY)
P6: ((0.5 * widthsCurrent(2)) + widthOp + widthsCurrent(3), baseY)
P5b = Midpoint(P5, P6)
P2: ((-widthOp) - (0.5 * widthsCurrent(2)), baseY)
P1b = Midpoint(P1, P2)
P3: ((-0.5 * widthsCurrent(2)), baseY)
P2b = Midpoint(P2, P3)
P4: ((0.5 * widthsCurrent(2)), baseY)
P4b = Midpoint(P4, P5)
P3b = Midpoint(P3, P4)
opIndex2: Mod[Element[randomList1, Mod[countQuestion + 2, Length[randomList1]] + 1], 4] + 1
allOps: {{"\plus", "sum"}, {"\minus", "difference"}}
opIndex = Element(randomList1, Mod[countQuestion, Length[randomList1]] + 1)
pulsing = 0.3 (slider from 0 to 1, step 0.1)
curtainLeft = Translate(curtainLeftPattern, PLeft)
xDistanceWord4 = Distance(Corner[word4, 2], Corner[word4, 1])
xDistanceWord3 = Distance(Corner[word3, 2], Corner[word3, 1])
xGap: (xDistanceWord4 - (4 * (xDistanceWord4 - xDistanceWord3))) / 2
textTerm1 = Text(((("\(" * currentCoeffs(1)) * currentVars(1)) * "\)"), Midpoint[P1, P2], true, true, 0, 0)
textTerm3 = Text((((("\(" * currentCoeffs(3)) * currentVars(3)) * vSpace) * "\)"), Midpoint[P5, P6], true, true, 0, 0)
textOp1 = Text((allOps(Mod[opIndex, 2] + 1, 1) * vSpace), Midpoint[P2, P3], false, true, 0, 0)
textOp2 = Text((allOps(Mod[opIndex2, 2] + 1, 1) * vSpace), Midpoint[P4, P5], false, true, 0, 0)
textTerm2 = Text((((("\(" * currentCoeffs(2)) * currentVars(2)) * vSpace) * "\)"), Midpoint[P3, P4], true, true, 0, 0)
coeffIndxStart = Element(randomList3, Mod[countQuestion, Length[randomList3]] + 1)
PMsg: (0, 2)
op1Word: allOps(Mod[opIndex, 2] + 1, 2)
termDescriptions = Zip((("\text{" * If[A ≟ 0, "A constant term.", ((("A term with " * If[C ≟ 0, "", ((("a coefficient of " * "") * B) * " and ")]) * If[A ≟ 1, "one variable", "two variables"]) * ".")]) * "}"), A, numVars, B, currentCoeffs, C, numDigitsCoeff)
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY: 178
layoutX: 16
layoutAppSize = Corner(5)
inputSaved: {NaN, NaN}
numFactors1: Mod[Element[randomList1, Mod[countQuestion, Length[randomList1]] + 1], 2] + 1
numFactors2: Mod[Element[randomList1, Mod[countQuestion + 1, Length[randomList1]] + 1], 2] + 1
numFactors3: Mod[Element[randomList1, Mod[countQuestion + 2, Length[randomList1]] + 1], 2] + 1
randVarIndex: Mod[countQuestion, Length[varsSingle] - 3] + 1
opIndex1: Mod[Element[randomList1, Mod[countQuestion, Length[randomList1]] + 1], 4] + 1
speed: 0
leftMin: 1
rightMax: 6
rightCoeff2: 0.48
leftTerm2: 3
leftTerm3: 5
leftOp1: 2
leftOp2: 4
rightCoeff1 = Element({0.42, 0.4, 0.38}, numVars(1))
op2Word: allOps(Mod[opIndex2, 2] + 1, 2)
descOperator = Text("\text{An operator.}", PMsg, false, true, 0, 0)
descTotal = Text("\text{An expression with three terms.}", PMsg, false, true, 0, 0)
descTerm3 = Text(termDescriptions(3), PMsg, false, true, 0, 0)
descTerm2 = Text(termDescriptions(2), PMsg, false, true, 0, 0)
descTerm1 = Text(termDescriptions(1), PMsg, false, true, 0, 0)
desc23 = Text((("\text{The " * op2Word) * " of two terms.}"), PMsg, false, true, 0, 0)
desc12 = Text((("\text{The " * op1Word) * " of two terms.}"), PMsg, false, true, 0, 0)
coeffNames: {"two", "three", "five", "seven", "nine", "eleven", "thirteen", "fifteen", "seventeen", "nineteen"}
coeffIndex: Mod[random1, 5] + 1
curtainRight = Translate(curtainRightPattern, PRight)
baseCurtain: 2.8
maxRight: 3
termEndPos = Zip(x(Corner[A, 2] - xGap), A, {textTerm1, textOp1, textTerm2, textOp2, textTerm3})
termPositionStartEnd = Flatten(Zip[{x(Corner[A, 1]) + xGap, x(Corner[A, 2] - xGap)}, A, {textTerm1, textOp1, textTerm2, textOp2, textTerm3}])
onboarding = true
pulsingCurtain = expandQuad(Corner[curtainLeft, 1], Corner[curtainLeft, 2], Corner[curtainLeft, 3], Corner[curtainLeft, 4], (pulsing * 7), Corner[1], Corner[3], Corner[5])
pulsingSpeed: 8
StartPositions: {(-11.89, 4), (-1.3, 4)}
pointsInRegion = Zip(IsInRegion[A, opening], A, {P1, P1b, P2, P2b, P3, P3b, P4, P4b, P5, P5b, P6})
minRight: -3.5
showNewExpression: minOpen ≤ x(P1) ∧ maxOpen ≥ x(P6)

Tool: pixelsToDistanceX
pixelsToDistanceX(inputPixels,corner1,corner3,corner5)
Input: inputPixels, Corner1, Corner3, Corner5
Output: outputDistance

inputPixels: 5
Corner1: (-4, -2)
Corner3: (6, 6)
Corner5: (800, 500)
xLeft: x(Corner1)
xRight: x(Corner3)
outputDistance: (inputPixels / x(Corner5) * (xRight - xLeft))

Tool: pixelsToDistanceX (command pixelsToDistanceX1)
pixelsToDistanceX(inputPixels,corner1,corner3,corner5)
Input: inputPixels, Corner1, Corner3, Corner5
Output: outputDistance

inputPixels: 5
Corner1: (-4, -2)
Corner3: (6, 6)
Corner5: (800, 500)
xLeft: x(Corner1)
xRight: x(Corner3)
outputDistance: (inputPixels / x(Corner5) * (xRight - xLeft))

Tool: pixelsToDistanceY
pixelsToDistanceY(inputPixels,corner1,corner3,corner5)
Input: inputPixels, Corner1, Corner3, Corner5
Output: outputDistance

Corner1: (-4, -2)
Corner3: (6, 6)
Corner5: (800, 500)
yLeft: y(Corner1)
yRight: y(Corner3)
outputDistance: (inputPixels / y(Corner5) * (yRight - yLeft))

Tool: expandQuad
expandQuad(A,B,C,D,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, C, D, pixelGap, Corner1, Corner3, Corner5
Output: newQuad

Corner1: (-4, -2)
Corner3: (7, 6)
Corner5: (800, 500)
pointGap = pixelsToDistanceX(pixelGap, Corner1, Corner3, Corner5)
allVerts: {A, B, C, D}
concaveAngles = Zip(Angle[I, J, K] > 180°, I, Append[allVerts(-1), allVerts], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
allVecs = Zip(Vector[J, K], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
pVecs = Zip(Vector[UnitOrthogonalVector[A]], Vector[A], allVecs)
xyScale: pixelsToDistanceY[10, Corner1, Corner3, Corner5] / pixelsToDistanceX[10, Corner1, Corner3, Corner5]
circTemplate = CurveCartesian((pointGap * cos(t)), ((xyScale * pointGap) * sin(t)), t, 0, (2 * pi))
scaledVecs = Zip(Vector[(x(K), (xyScale * y(K)))], Vector[K], pVecs)
vPointsPre = Zip(A - (pointGap * B), A, allVerts, B, Append[scaledVecs(-1), scaledVecs])
vPointsPost = Zip(A - (pointGap * B), A, allVerts, Vector[B], scaledVecs)
endAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPost, M, allVerts)
startAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPre, J, vPointsPost, M, allVerts)
roundedCornersConvex = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, endAngles, C, startAngles)
roundedCornersConcave = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, startAngles, C, endAngles)
cornerAngles = Zip(Angle[A, B, C], A, vPointsPre, B, allVerts, C, vPointsPost)
cornerPoints = Flatten(Zip[If[¬Concave, {Element[D, 3]}, If[A < pi / 3 ∨ (¬Concave), {Element[C, 3]}, C]], A, cornerAngles, C, roundedCornersConcave, D, roundedCornersConvex, Concave, concaveAngles])
newQuad = Polygon(cornerPoints)

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) * (yTop - y(InputPoint)) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)