$\textsf{Desliza para animar}$

$\mathsf{%v}$

$\mathsf{%v}$

$\mathsf{%v}$

$\mathsf{%v}$

$\text{NUEVAS FRACCIONES}$

#949494

#6557D2

#ffffff

#eeeeee

÷

$\rotatebox{90}{\textsf{animation speed}}$

=

$\text{Show Common Denominators}$

$\text{Desliza para animar}$

animationSlider = 0 (slider from animationSliderStart to animationRange, step 0.01)
Start2: (6.5, 2)
Start1: (-1, 2)
animation1bRange: (3 * Distance[Start1, Start2])
animation1aRange: (3 * Distance[Start1, Start2])
animation1bEnd: animation1aRange + animation1bRange
Start3: (14, y(Start1))
animation2Range: (3 * Distance[Start1, Start3])
countQuestion: 1
randomN1 = Shuffle(Sequence[Random[1, 9], i, 1, 100])
randomD1 = Shuffle(Sequence[Random[3, 10], i, 1, 100])
randD1 = Element(randomD1, Mod[countQuestion, 100] + 1)
factRandD1 = PrimeFactors(randD1)
randN1List = If(Element[randomN1, Mod[countQuestion, 100] + 1] > randD1, {randD1 - 1}, PrimeFactors[Element[randomN1, Mod[countQuestion, 100] + 1]])
randN1Final = If(Length[Remove[randN1List, factRandD1]] > 0, Remove[randN1List, factRandD1], {1})
randomD2 = Shuffle(Sequence[Random[3, 10], i, 1, 100])
randD2 = If(Element[randomD2, Mod[countQuestion, 100] + 1] ≟ randD1, randD1 - 1, Element[randomD2, Mod[countQuestion, 100] + 1])
dynamicNum1 = Sum(randN1Final)
dynamicDen1 = Element(randomD1, Mod[countQuestion, 100] + 1)
dynamicDen2 = If(Element[randomD2, Mod[countQuestion, 100] + 1] ≟ randD1, randD1 - 1, Element[randomD2, Mod[countQuestion, 100] + 1])
modelAnimationPoints1 = Flatten(Sequence[Sequence[Point[{Start3 + ((i * 5 / dynamicDen1), (j * 5 / dynamicDen2))}], i, 0, dynamicDen1 - 1], j, 0, dynamicDen2 - 1])
modelAnimationPoints2 = Flatten(Sequence[Sequence[Point[{Start1 + ((i * 5 / dynamicDen1), (j * 5 / dynamicDen2))}], i, 0, dynamicNum1 - 1], j, 0, dynamicDen2 - 1])
modelAnimationDistance = Zip(Distance[a, b], a, modelAnimationPoints1, b, modelAnimationPoints2)
animation2End: animation1aRange + animation2Range
modelNumRangeSequence = Sequence(Sum[First[modelAnimationDistance, n]] + animation2End, n, 1, Length[modelAnimationDistance])
animation2Slider = If(0 ≤ animationSlider < animation1bEnd, 0, animationSlider < animation1bEnd + animation2Range, animationSlider - animation1bEnd, animation2Range)
frac1 = Polygon({Start1, Start1 + (((dynamicNum1 * 5)) / dynamicDen1, 0), Start1 + (((dynamicNum1 * 5)) / dynamicDen1, 5), Start1 + (0, 5)})
userAnswer = NaN
randomN2 = Shuffle(Sequence[Random[1, 9], i, 1, 100])
randN1 = Sum(randN1Final)
randN2List = If(Element[randomN2, Mod[countQuestion, 100] + 1] > randD2, {randD2 - 1}, PrimeFactors[Element[randomN2, Mod[countQuestion, 100] + 1]])
factRandD2 = PrimeFactors(randD2)
randN2Final = If(Length[Remove[randN2List, factRandD2]] > 0, Remove[randN2List, factRandD2], {1})
randN2 = Sum(randN2Final)
solutionList: {(randN1 * randD2), (randN2 * randD1), (randD1 * randD2), (randD1 * randD2)}
gcfSolution = GCD({solutionList(1), solutionList(2)})
solutionFinal: {solutionList(1) / gcfSolution, solutionList(2) / gcfSolution}
solution: solutionFinal(1) / solutionFinal(2)
modelParts2 = Sequence(Segment[Start2 + (0, (i * 5 / dynamicDen2)), Start2 + (5, (i * 5 / dynamicDen2))], i, 1, dynamicDen2 - 1)
modelParts1 = Sequence(Segment[Start1 + ((i * 5 / dynamicDen1), 0), Start1 + ((i * 5 / dynamicDen1), 5)], i, 1, dynamicDen1 - 1)
model1 = Polygon({Start1, Start1 + (5, 0), Start1 + (5, 5), Start1 + (0, 5)})
model2 = Polygon({Start2, Start2 + (5, 0), Start2 + (5, 5), Start2 + (0, 5)})
dynamicNum2 = Sum(randN2Final)
frac2 = Polygon({Start2, Start2 + (0, ((dynamicNum2 * 5)) / dynamicDen2), Start2 + (5, ((dynamicNum2 * 5)) / dynamicDen2), Start2 + (5, 0)})
Dims = Corner(5)
modelCommonParts2 = Translate({model2, modelParts2}, Vector[Start2, Start1])
partAnswer = Mod(solutionFinal(1), solutionFinal(2))
answerWhole: floor(solutionFinal(1) / solutionFinal(2))
modelCommonParts1 = Translate(modelParts1, Vector[Start1, Start2])
correct: userAnswer ≟ solution
textFeedback: "\text{" + (LaTeX[If[¬correct, "✘ Incorrect", "✓ Correct"]]) + "}"
showbuttons: true
textQuestion: "\dfrac{" + (LaTeX[randN1]) + " }{" + (LaTeX[randD1]) + "}÷\dfrac{" + (LaTeX[randN2]) + "}{" + (LaTeX[randD2]) + " }="
pixelsRight: 16
pixelsLeft: 16
pixelsTop: 16
pixelsBottom: 16
countCorrect: 0
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)}])
N1 = NaN
D1 = NaN
textCommonFrac1: "\dfrac{" + (LaTeX[(dynamicNum1 * dynamicDen2)]) + "}{" + (LaTeX[(dynamicDen2 * dynamicDen1)]) + "}"
textCommonFrac2: "\dfrac{" + (LaTeX[(dynamicNum2 * dynamicDen1)]) + "}{" + (LaTeX[(dynamicDen2 * dynamicDen1)]) + "}"
modelAnimation1 = Flatten(Sequence[Sequence[Polygon[{Start1 + ((i * 5 / dynamicDen1), (j * 5 / dynamicDen2)), Start1 + (((i + 1) * 5 / dynamicDen1), (j * 5 / dynamicDen2)), Start1 + (((i + 1) * 5 / dynamicDen1), ((j + 1) * 5 / dynamicDen2)), Start1 + ((i * 5 / dynamicDen1), ((j + 1) * 5 / dynamicDen2))}], i, 0, dynamicNum1 - 1], j, 0, dynamicDen2 - 1])
modelAnimation1': modelAnimation1
numMax = Length(modelAnimationPoints2)
modelNumAnimationSequence = Sequence(If[a > 1, If[0 ≤ animationSlider ≤ modelNumRangeSequence(a - 1), 0, animationSlider < modelNumRangeSequence(a), animationSlider - modelNumRangeSequence(a - 1), modelAnimationDistance(a)], If[0 ≤ animationSlider ≤ animation2End, 0, animationSlider < modelNumRangeSequence(a), animationSlider - animation2End, modelAnimationDistance(a)]], a, 1, Length[modelNumRangeSequence])
modelFractionAnimationSequence = Zip(a / b, a, modelNumAnimationSequence, b, modelAnimationDistance)
modelAnimationPoints3 = Zip(PartitionPoints[b, a, c], a, modelAnimationPoints1, b, modelAnimationPoints2, c, modelFractionAnimationSequence)
modelAnimationVectors = Zip(Vector[a, b], a, modelAnimationPoints2, b, modelAnimationPoints3)
modelAnimationStart = First(modelAnimation1, numMax)
numEnd: Length[modelAnimation1] - numMax
modelAnimationMove = Zip(Translate[a, Vector[b]], a, modelAnimation1, Vector[b], modelAnimationVectors)
modelAnimationMove' = Zip(Translate[a, Vector[b]], a, modelAnimation1, Vector[b], modelAnimationVectors)
total = CountIf(n > 0, n, modelNumAnimationSequence)
speed = 1 (slider from 1 to 10, step 0.1)
PointAnimation2Move = PartitionPoints(Start2, Start3, animation2Slider / animation2Range)
modelParts2_1 = Sequence(Segment[Start2 + (0, (i * 5 / dynamicDen2)), Start2 + (5, (i * 5 / dynamicDen2))], i, 0, dynamicNum2)
modelParts2_2 = Sequence(Segment[Start2 + ((i * 5 / dynamicDen1), 0), Start2 + ((i * 5 / dynamicDen1), (5 * dynamicNum2 / dynamicDen2))], i, 0, dynamicDen1)
modelParts2' = Translate({modelParts2_1, modelParts2_2}, Vector[Start2, PointAnimation2Move])
animation1aSlider = If(animationSlider < animation1aRange, animationSlider, animation1aRange)
PointAnimation1aMove = PartitionPoints(Start1, Start2, animation1aSlider / animation1aRange)
modelAnimationParts1 = Translate(modelParts1, Vector[Start1, PointAnimation1aMove])
translationVectorRanges = Zip(Vector[b, a], a, modelAnimationPoints1, b, modelAnimationPoints2)
modelAllRanges = Flatten({animation1aRange, animation2Range, modelNumRangeSequence})
animationRange: Sum[modelAnimationDistance] + animation2End + animation1bRange
totalReduced = If(abs(animationSlider - animationRange) > 0.01, total - 1, total)
textAnimatedFrac: "\dfrac{" + (LaTeX[totalReduced]) + "}{" + (LaTeX[(dynamicNum2 * dynamicDen1)]) + "}"
showCD = false
animationSliderStart = If(showCD, animation1aRange, 0)
textQuestionFrac1: "\frac{" + (LaTeX[randN1]) + "}{" + (LaTeX[randD1]) + "} " + (LaTeX[If[showCD ∨ animationSlider > animation1aRange, ("=" * textCommonFrac1) + "", ""]]) + ""
textQuestionFrac2: "\dfrac{" + (LaTeX[randN2]) + "}{" + (LaTeX[randD2]) + "} " + (LaTeX[If[showCD ∨ animationSlider > animation1aRange, ("=" * textCommonFrac2) + "", ""]]) + ""
animation1bSlider = If(0 ≤ animationSlider < animation1aRange, 0, animationSlider < animation1aRange + animation1bRange, animationSlider - animation1aRange, animation1bRange)
PointAnimation1bMove = PartitionPoints(Start2, Start1, animation1bSlider / animation1bRange)
modelAnimationParts2 = Translate(modelParts2, Vector[Start2, PointAnimation1bMove])

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: 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: PartitionPoints
PartitionPoints(A,B,fraction)
Input: A, B, a
Output: C

a: 2 / 3
C: A + (a * (B - A))