\text{Usa los botones para ver la solución.}

#4D4D4D

$\text{Check}$

$\text{NUEVO}$

Fix position and allow selection for all text objects

Empty all input boxes

\text{Esta es la respuesta.}

num

den

Reset app

\text{Una fracción no puede tener\denominador 0.}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{Observa el modelo y úsalo\para calcular la diferencia.}

#eeeeee

#2E006758

#2EB00020

\text{Resta las siguientes fracciones de igual denominador.} 

\rule{60px}{1px}

-

aniSli = 1 (slider from 1 to 5, step 1)
countQuestion = 0
allDen = Shuffle(Sequence[t, t, 5, 12])
den = Element(allDen, Mod[countQuestion, Length[allDen]] + 1)
allNum1 = Shuffle(Sequence[t, t, 2, den, 1])
num1 = Element(allNum1, Mod[countQuestion, Length[allNum1]] + 1)
textNum1Pi: "\textcolor{#DA2570}{" + (LaTeX[num1]) + "}"
allNum2 = Shuffle(Sequence[t, t, 1, num1 - 1, 1])
num2 = Element(allNum2, Mod[countQuestion, Length[allNum2]] + 1)
textNum2Pu: "\textcolor{#6557D2}{" + (LaTeX[num2]) + "}"
diffNum: num1 - num2
textDiffTeal: "\textcolor{#006758}{" + (LaTeX[diffNum]) + "}"
input1 = NaN
input2 = NaN
correctVal: input1 / input2 ≟ (num1 - num2) / den
correct1: input1 ≟ num1 - num2 ∨ input1 / (num1 - num2) ≟ input2 / den ∧ input1 ≠ 0
vertSide: 15
horSide = 20 (slider from -5 to 20, step 1)
F1 = (0, 0)
numRandoms: 2
allRandomSeeds = Sequence(Random[0, 99] / 100, A, 1, 200)
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
randomNum1: 3 + floor((currentRandomSeeds(1) * 15))
onboarding = false
inputSaved: {NaN, NaN}
inputCurrent: {input1, input2}
B = (5.000341064524864, 5.69392166828734)
randomNum2: randomNum1 + 2 + floor((currentRandomSeeds(2) * 10))
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
InputBox1 = Textfield(input1)
InputBox2 = Textfield(input2)
correct2: input2 ≟ den ∨ input1 / (num1 - num2) ≟ input2 / den
correct: correct1 ∧ correct2
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror = false
textCountCorrect: "\text{Correctos: " + (LaTeX[countCorrect]) + " }"
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent] ∧ (¬onboarding)
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
layoutY: 178
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correcto}$", "$\text{✕ " + (If[tries < 3, "Reinténtalo", "Quizás la próxima vez"]) + "}$"]]) + ""
pulsingSpeed: 8
pulsing = 0.5 (slider from 0 to 1, step 0.1)
haloPixels: (pulsing * 7)
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
A = (4.591072725036432, 5.892161020227049)
C = (4.917208433066277, 6.084005554362252)
layoutOnboarding = PointToPixels(Corner[onboardingDisplayText, 2], Corner[1], Corner[3], Corner[5])
onboardingX: 400
onboardingY: 148
onboardingCase: 2
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
textExercise: "\frac{" + (LaTeX[num1]) + "}{" + (LaTeX[den]) + "}-\frac{" + (LaTeX[num2]) + "}{" + (LaTeX[den]) + "}="
frac1 = Polygon({F1, F1 + (((num1 * horSide)) / den, 0), F1 + (((num1 * horSide)) / den, vertSide), F1 + (0, vertSide)})
vertDividers1 = Sequence(Segment[F1 + ((t * horSide / den), 0), F1 + ((t * horSide / den), vertSide)], t, 1, den - 1)
frame = Polygon({F1, F1 + (horSide, 0), F1 + (horSide, vertSide), F1 + (0, vertSide)})
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Pista}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
TL1: F1 + (0, vertSide + 1)
TL2: F1 + (horSide, vertSide + 1)
topLine = Segment(TL1, TL2)
textParts: "" + (LaTeX[den]) + " \textsf{ partes}"
BLF1: F1 + (0, -4)
BLF2: BLF1 + (((num1 * horSide)) / den, 0)
BLF3 = Mirror(F1 + (((num1 * horSide) + (num2 * horSide)) / den, -1), x = x(F1) + ((num1 * horSide)) / den)
bottomLine1 = Segment(BLF1, BLF2)
bottomLine2 = Segment(BLF2 + (0, 3), BLF3)
textFrac1: "" + (LaTeX[num1]) + " \textsf{" + (LaTeX[If[num1 ≟ 1, " parte", " partes"]]) + "}"
textFrac2: "" + (LaTeX[num2]) + " \textsf{" + (LaTeX[If[num2 ≟ 1, " parte", " partes"]]) + "}"
frac2 = Mirror(Polygon[{F1 + (((num1 * horSide)) / den, 0), F1 + (((num1 * horSide) + (num2 * horSide)) / den, 0), F1 + (((num1 * horSide) + (num2 * horSide)) / den, vertSide), F1 + (((num1 * horSide)) / den, vertSide)}], x = x(F1) + ((num1 * horSide)) / den)
textSolution: "\textsf{\bold\textcolor{#006758}{Posible solución}}\\\\" + (LaTeX[If[aniSli ≟ 2, "\bold{", ""]]) + "\frac{" + (LaTeX[If[aniSli ≥ 2, textNum1Pi, ("" * num1)]]) + "}{" + (LaTeX[den]) + "}" + (LaTeX[If[aniSli ≟ 2, "}", ""]]) + "-" + (LaTeX[If[aniSli ≟ 3, "\bold{", ""]]) + "\frac{" + (LaTeX[If[aniSli ≥ 3, textNum2Pu, ("" * num2)]]) + "}{" + (LaTeX[den]) + "}" + (LaTeX[If[aniSli ≟ 3, "}", ""]]) + "=" + (LaTeX[If[aniSli ≟ 4, "\bold{", ""]]) + "\frac{" + (LaTeX[If[aniSli ≥ 4, textNum1Pi, ("" * num1)]]) + "-" + (LaTeX[If[aniSli ≥ 4, textNum2Pu, ("" * num2)]]) + "}{" + (LaTeX[den]) + "}" + (LaTeX[If[aniSli ≟ 4, "}", ""]]) + "=" + (LaTeX[If[aniSli ≟ 5, "\bold{", ""]]) + "\frac{" + (LaTeX[If[aniSli ≥ 5, textDiffTeal, ("" * diffNum)]]) + "}{" + (LaTeX[den]) + "}" + (LaTeX[If[aniSli ≟ 5, "}", ""]]) + ""
tabOrder: {textQuestion, textExercise, InputBox1, InputBox2, btnValidate, textFeedback, textHint, onboardingText, btnForward, btnBack, textParts, textFrac1, textFrac2, textSolution, textCountCorrect, btnNew}
isTypicalError: input2 ≟ 0
bottomLineSol = Segment((x(BLF1), y(BLF3)), BLF3)
labelBtnValidate: "\text{CHEQUEAR (" + (LaTeX[3 - tries]) + ")}"
textFinalParts: "" + (LaTeX[num1 - num2]) + " \textsf{" + (LaTeX[If[num1 - num2 ≠ 1, " partes", " parte"]]) + ""

Tool: PointToPixels
PointToPixels(InputPoint,Corner1,Corner3,Corner5)
Input: InputPoint, Corner1, Corner3, Corner5
Output: OutputPixels

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)

Tool: sectorPixels
sectorPixels(Midpoint,B,C,pixelRadius,Corner1,Corner3,Corner5
Input: A, B, C, pixelRadius, Corner1, Corner3, Corner5
Output: newSector

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
BPrime: A + (pointRadius * UnitVector[B - A])
newSector = CircleSector(A, BPrime, C)

Tool: onboardingTextOffset
onboardingTextOffset(textCorner1,textCorner3,case,corner1,corner3,corner5)
Input: CornerText1, CornerText3, case, Corner1, Corner3, Corner5
Output: TextOffset

xPixels: ((x(CornerText3) - x(CornerText1)) * x(Corner5) / (x(Corner3) - x(Corner1)))
yPixels: ((y(CornerText3) - y(CornerText1)) * y(Corner5) / (y(Corner3) - y(Corner1)))
xOffset = Element({27, (-xPixels) + 2, 16 - xPixels / 2, 16 - xPixels / 2}, case)
yOffset = Element({-23, -23, yPixels - 27, -49}, case)
TextOffset: (xOffset, yOffset)