#4D4D4D

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

$\textbf\textsf{NEW PROBLEM}$

\text{Dot plot:}

$\text{CHECK}$

\text{\bold{Possible Solution}}

SYMMETRIC: 3
randomSkew = Shuffle({1, 2, 3, 1, 2, 3, 1, 2, 3})
SKEWRIGHT: 2
SKEWLEFT: 1
countQuestion = 0
possibleSkew = Element(randomSkew, Mod[countQuestion, Length[randomSkew]] + 1)
randomStart = Sequence(-5, 20)
startVal = Element(randomStart, Mod[countQuestion, Length[randomStart]] + 1)
randomNum2 = Sequence(100)
expectedMedian: Mod[Element[randomNum2, Mod[countQuestion, Length[randomNum2]] + 1], 6] + startVal + 2
spaceLeft: expectedMedian - startVal - 1
spaceRight: startVal + 8 - expectedMedian
randomRange = Shuffle({3, 4, 5, 6, 7, 8})
showHintRange = false
counts: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
validData = Zip(If[A > 0, 1, 0], A, counts)
minDataPoint = IndexOf(1, validData)
maxDataPoint: 11 - IndexOf[1, Reverse[validData]]
studentRange: maxDataPoint - minDataPoint
helpRange: (("The range of your dot plot is \(" * studentRange) * "\).")
allData = RemoveUndefined(Flatten[Sequence[Sequence[K, L, 1, counts(K)], K, 1, 10]])
numValues = Length(allData)
displayMedian = If(IsInteger[numValues / 2], (allData(numValues / 2) + allData((numValues + 2) / 2)) / 2, allData(ceil(numValues / 2)))
studentMedian: displayMedian + startVal - 1
helpMedian: (("The median of your dot plot is \(" * studentMedian) * "\).")
studentMean: Sum[allData] / Length[allData] + startVal - 1
studentSkew = If(studentMean > studentMedian, SKEWRIGHT, If[studentMean < studentMedian, SKEWLEFT, SYMMETRIC])
helpSkew: "Your dot plot is " + (LaTeX[Element[{"skewed left", "skewed right", "symmetric"}, studentSkew]]) + "."
showHintSkew = true
showHintMedian = true
tailRight: maxDataPoint - studentMedian
tailLeft: studentMedian - minDataPoint
physicalX = Sequence(1, 10)
validate = false
showanswer = false
showsolution = false
showhint = false
showbuttons = true
showhinttypicalerror = false
numberLine1 = Segment((physicalX(1) - 0.5, 0), (physicalX(10) + 0.5, 0))
displayX = Sequence(i, i, startVal, startVal + 9, 1)
ticks = Zip(Segment[(A, 0.1), (A, -0.15)], A, physicalX)
allDots = Sequence(Sequence[(A, B), B, 0.2, 3, 0.2], A, 1, 10)
displayPoints = Sequence(Sequence[allDots(J, K), K, 1, counts(J)], J, 1, 10)
lowerHalf = Take(allData, 1, floor(numValues / 2))
upperHalf = Take(allData, floor(numValues / 2) + 1, Length[allData])
numLower = Length(lowerHalf)
numUpper = Length(upperHalf)
quartile3 = If(IsInteger[numUpper / 2], (upperHalf(numUpper / 2) + upperHalf((numUpper + 2) / 2)) / 2, upperHalf(ceil(numUpper / 2)))
quartile2 = If(IsInteger[numLower / 2], (lowerHalf(numLower / 2) + lowerHalf((numLower + 1) / 2)) / 2, lowerHalf(ceil(numLower / 2)))
levelWhiskers: -4
IQRange: quartile3 - quartile2
maxCount = Max(counts)
modeCheck = Zip(A ≟ maxCount, A, counts)
allModes = RemoveUndefined(Sequence[If[modeCheck(A), A], A, 1, Length[modeCheck]])
textMean: "Mean \(=" + (LaTeX[round(studentMean, 2)]) + "\)"
textMedian: "Median \(=" + (LaTeX[studentMedian]) + "\)"
textRQ: "IQR = \( " + (LaTeX[quartile3 - quartile2]) + "\)"
textSkewDescription: "" + (If[studentMean > studentMedian, "Right skewed", If[studentMean < studentMedian, "Left skewed", "Symmetric"]]) + ""
expectedRange = Min(Element[randomRange, Mod[countQuestion, Length[randomRange]] + 1], spaceLeft + spaceRight)
expectedSkew = Element({If[spaceLeft > ceil(expectedRange / 2), SKEWLEFT, SKEWRIGHT], If[spaceRight > ceil(expectedRange / 2), SKEWRIGHT, SKEWLEFT], If[Min[spaceLeft, spaceRight] > ceil(expectedRange / 2), SYMMETRIC, If[spaceLeft > spaceRight, SKEWLEFT, SKEWRIGHT]]}, possibleSkew)
questiontext: "\text{Create a dot plot that has a median of " + (LaTeX[expectedMedian]) + ", is " + (LaTeX[Element[{"skewed left", "skewed right", "symmetric"}, expectedSkew]]) + ", and has a range of " + (LaTeX[expectedRange]) + ".}"
correctSkew: studentSkew ≟ expectedSkew
correctMedian: studentMedian ≟ expectedMedian
correctRange: studentRange ≟ expectedRange
tries = 0
countCorrect = 0
pixelsBottom: 16
pixelsLeft: 16
pixelsRight: 16
pixelsTop: 24
layoutX: 16
layoutY: 299
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)}])
layoutAppSize = Corner(5)
inputCurrent: counts
inputSaved: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
labelButtonValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent]
correct: correctMedian ∧ correctRange ∧ correctSkew
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
helpTextHintTypicalError: "\text{" + (LaTeX[If[showHintMedian, (helpMedian * "\\"), ""]]) + "" + (LaTeX[If[showHintSkew, helpSkew, ""]]) + "}"
helpTextHint: "\text{" + (LaTeX[If[showHintMedian, (helpMedian * "\\"), ""]]) + "" + (LaTeX[If[showHintSkew, (helpSkew * "\\"), ""]]) + "" + (LaTeX[If[showHintRange, helpRange, ""]]) + "}"
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}{\bold{Hint}}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError, helpTextHint]]) + "}"
isTypicalError: (¬correctMedian) ∨ (¬correctSkew)
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
textCountCorrect: (("\text{Number correct: " * countCorrect) * "}")
solnMedian: expectedMedian - startVal + 1
solnLow: solnMedian - Element[{Min[expectedRange - 1, solnMedian - 1], Max[1, solnMedian + expectedRange - 10], expectedRange / 2}, expectedSkew]
solnHigh: solnLow + expectedRange
vShift: -4.5
solnLine = Translate(numberLine1, (0, vShift))
solnTicks = Translate(ticks, (0, vShift))
solnCounts = Sequence(If[A ≟ solnLow ∨ A ≟ solnHigh, 1, If[A ≟ solnMedian, 3, 0]], A, 1, Length[counts])
solnDots = Translate(allDots, (0, vShift))
solnPoints = Sequence(Sequence[solnDots(J, K), K, 1, solnCounts(J)], J, 1, 10)
maxDots: 8
digits1 = Zip(Text[("" * A), (B + If[B > 0, 0.3, 0.4], -0.1), true, true, -1, -1], A, displayX, B, physicalX)
digitsSoln = Zip(Text[("" * A), (B + If[B > 0, 0.3, 0.4], -0.1 + vShift), true, true, -1, -1], A, displayX, B, physicalX)

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: centerText
centerText(sizeStr,textStr)
Input: sizeStr, textString
Output: centeredLatex

this is dynamic centered text

centeredLatex: (((("\begin{tabular}\hspace{" * sizeStr) * "}\\") * textString) * "\end{tabular}")