數線上的有理數
Author: 藍邦偉老師

$分母=%v$

$分子=%v$

$整數部分為%v$

$ 數線上的有理數 $

m = 7 (slider from 1 to 20, step 1)
n = 5 (slider from 0 to m, step 1)
a = 0 (slider from -10 to 10, step 1)
k = Min(n, m)
文字6: "- \frac{" + k + " }{" + m + "}"
poly1, b, c, d, e = Polygon((If[a ≥ 0, 1, 2], 0), (If[a ≥ 0, 1, 2], 0.1), (If[a ≥ 0, 1, 2] + If[a ≥ 0, k, -k] / m, 0.1), (If[a ≥ 0, 1, 2] + If[a ≥ 0, k, -k] / m, 0))
P = Point(xAxis)
f: y(Corner[2]) - y(Corner[3])
u = Vector(P, P + (0, f / 10))
v = Vector((x(Corner[1]), 0), (x(Corner[3]), 0))
text2: "$ " + (LaTeX[a]) + " $"
text3: "$  " + (LaTeX[a + 1]) + "$"
list1 = Sequence(Segment[(1 + t / m, 0), (1 + t / m, 0.05)], t, 0, m)
A: (1 + If[a ≥ 0, k, m - k] / m, 0)
text1: "$ A(" + (LaTeX[If[a > 0, a, If[(a < 0) ∧ (a ≠ -1), -abs(a + 1), If[a ≟ 0, "", If[a ≟ -1, "-"]]]]]) + "\frac{" + (LaTeX[n]) + "}{" + (LaTeX[m]) + "}) " + (LaTeX[If[a < 0, "=(" * FractionText[(a * m - n) / m + 1] * ")", If[a > 0, "=(" * FractionText[(a * m + n) / m] * ")", If[a ≟ 0, ""]]]]) + "$"
text4: "$ A(-\frac{" + (LaTeX[n]) + "}{" + (LaTeX[m]) + "}) $"
B = (1.5003348805576144, 0.5639886972817361)
t_A: "$A( " + (LaTeX[If[x(A) ≥ 0, x(A) + a - 1, x(A) + a]]) + " )$"