$n=%n$

移動紅點調整
\y=f(x)

移動\;x\;軸上的綠
\色點決定範圍

決定分割份數
\與上和或下和

UpperSum

LowerSum

二次多項式

三次多項式

四次多項式

一次多項式

$Random$

黎曼和

E = (1.263774827719478, 5.281111329146157)
R = Point(xAxis)
L = Point(xAxis)
D = (-4.216221964164071, 2.369606859629051)
C = (2.8108487519587175, 4.947308268946742)
B = (4.618874904382882, 3.778997558248796)
A = (-2.426835256610255, 2.6848653053729414)
f_1 = Polynomial({A, B})
f_4 = Polynomial({A, B, C, D, E})
f_3 = Polynomial({A, B, C, D})
f_2 = Polynomial({A, B, C})
deg = 2 (slider from 1 to 4, step 1)
s = 0 (slider from 0 to Max, step 1)
Max = 9
n = 6 (slider from 1 to 30, step 1)
u_2 = UpperSum(f_2, Min[x(L), x(R)], Max[x(R), x(L)], n)
l_2 = LowerSum(f_2, Min[x(L), x(R)], Max[x(R), x(L)], n)
t = 0 (slider from 0 to n, step 1)
U_2 = UpperSum(f_2, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
L_2 = LowerSum(f_2, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
US = true
LS = false
U_3 = UpperSum(f_3, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
L_4 = LowerSum(f_4, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
L_3 = LowerSum(f_3, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
U_4 = UpperSum(f_4, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
l_3 = LowerSum(f_3, Min[x(L), x(R)], Max[x(R), x(L)], n)
l_4 = LowerSum(f_4, Min[x(L), x(R)], Max[x(R), x(L)], n)
u_3 = UpperSum(f_3, Min[x(L), x(R)], Max[x(R), x(L)], n)
u_4 = UpperSum(f_4, Min[x(L), x(R)], Max[x(R), x(L)], n)
Area = Integral(If[deg ≟ 1, f_1, If[deg ≟ 2, f_2, If[deg ≟ 3, f_3, f_4]]], Min[x(L), x(R)], Max[x(L), x(R)])
text1: "決定多項式函數
\\f(x)的次數為" + (LaTeX[deg]) + "次"
L_1 = LowerSum(f_1, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
U_1 = UpperSum(f_1, Min[x(L), x(R)], Min[x(L), x(R)] + (t / n * (Max[x(R), x(L)] - Min[x(L), x(R)])), t)
l_1 = LowerSum(f_1, Min[x(L), x(R)], Max[x(R), x(L)], n)
u_1 = UpperSum(f_1, Min[x(L), x(R)], Max[x(R), x(L)], n)
text7: "上和為" + (LaTeX[If[deg ≟ 1, u_1 + "", If[deg ≟ 2, u_2 + "", If[deg ≟ 3, u_3 + "", u_4 + ""]]]]) + "\\
下和為" + (LaTeX[If[deg ≟ 1, l_1 + "", If[deg ≟ 2, l_2 + "", If[deg ≟ 3, l_3 + "", l_4 + ""]]]]) + "\\" + (LaTeX[If[s ≟ 8, "實際面積為" + Area]]) + ""
text6: "面積為" + (LaTeX[If[deg ≟ 1 ∧ US ≟ true, u_1 + "", If[deg ≟ 2 ∧ US ≟ true, u_2 + "", If[deg ≟ 3 ∧ US ≟ true, u_3 + "", If[deg ≟ 4 ∧ US ≟ true, u_4 + ""]]]]]) + "" + (LaTeX[If[deg ≟ 1 ∧ LS ≟ true, l_1 + "", If[deg ≟ 2 ∧ LS ≟ true, l_2 + "", If[deg ≟ 3 ∧ LS ≟ true, l_3 + "", If[deg ≟ 4 ∧ LS ≟ true, l_4 + ""]]]]]) + ""
text5: "面積\;" + (LaTeX[If[deg ≟ 1 ∧ US ≟ true, U_1 + "", If[deg ≟ 2 ∧ US ≟ true, U_2 + "", If[deg ≟ 3 ∧ US ≟ true, U_3 + "", If[deg ≟ 4 ∧ US ≟ true, U_4 + ""]]]]]) + "" + (LaTeX[If[deg ≟ 1 ∧ LS ≟ true, U_1 + "", If[deg ≟ 2 ∧ LS ≟ true, L_2 + "", If[deg ≟ 3 ∧ LS ≟ true, L_3 + "", If[deg ≟ 4 ∧ LS ≟ true, L_4 + ""]]]]]) + ""
Random = 0 (slider from 0 to 1, step 0.1)
d: abs(x(R) - x(L)) / n
k = 0 (slider from 0 to 0, step 0.1)
list1 = Sequence(Min[x(L), x(R)] + If[k ≟ 0, ((t + (Random * 0) + random()) * d), If[k ≟ 1, (t * d), ((t + 1) * d)]], t, 0, n - 1)
f = If(deg ≟ 1, f_1, If[deg ≟ 2, f_2, If[deg ≟ 3, f_3, f_4]])
list2 = Sequence(Polygon[(Min[x(L), x(R)] + ((t - 1) * d), 0), (Min[x(L), x(R)] + (t * d), 0), (Min[x(L), x(R)] + (t * d), f(Element[list1, t])), (Min[x(L), x(R)] + ((t - 1) * d), f(Element[list1, t]))], t, 1, n)
list3 = Sequence(Segment[(Element[list1, i], 0), (Element[list1, i], f(Element[list1, i]))], i, 1, n)