絕對值函數
Author: 藍邦偉  老師

$ O $

$ 絕對值函數 $

$%v個絕對值$

u = Vector((x(Corner[1]), 0), (x(Corner[3]), 0))
v = Vector((0, y(Corner[1])), (0, y(Corner[3])))
O = (0, 0)
Q_2: 0.65 * Corner[1] + 0.35 * Corner[2]
Q_3: (x(Q_2), y(Corner[4]))
poly1, q_1, q_2, q_4, q_3 = Polygon(Corner[1], Q_2, Q_3, Corner[4])
a = -1 (slider from -5 to 5, step 1)
b = 5 (slider from -5 to 5, step 1)
c = -4 (slider from -5 to 5, step 1)
d = 1 (slider from -5 to 5, step 1)
f_2(x) = abs(x - a) + abs(x - b)
f_3(x) = abs(x - a) + abs(x - b) + abs(x - c)
f_4(x) = abs(x - a) + abs(x - b) + abs(x - c) + abs(x - d)
f_1(x) = abs(x - a)
n = 1 (slider from 1 to 4, step 1)
A = (-15.924448971667994, 10.62221491534954)
m_1 = Min(f_1, x(Q_2), x(Corner[2]))
m_2 = Min(f_2, x(Q_2), x(Corner[2]))
m_3 = Min(f_3, x(Q_2), x(Corner[2]))
m_4 = Min(f_4, x(Q_2), x(Corner[2]))
text1: "$f(x)=|x" + (LaTeX[If[a > 0, "-", If[a < 0, "+", ""]]]) + "" + (LaTeX[If[a ≠ 0, abs(a), ""]]) + "| $
$f(x)的最小值為f(" + (LaTeX[a]) + ")=\;" + (LaTeX[y(m_1)]) + "$"
text3: "$f(x)=|x" + (LaTeX[If[a > 0, "-", If[a < 0, "+", ""]]]) + "" + (LaTeX[If[a ≠ 0, abs(a), ""]]) + "|+|x" + (LaTeX[If[b > 0, "-", If[b < 0, "+", ""]]]) + "" + (LaTeX[If[b ≠ 0, abs(b), ""]]) + "| $
$\;\;\;\;\;\;\;\;\;\;\;+|x" + (LaTeX[If[c > 0, "-", If[c < 0, "+", ""]]]) + "" + (LaTeX[If[c ≠ 0, abs(c), ""]]) + "|$
$f(x)的最小值為f(" + (LaTeX[Median[{a, b, c}]]) + ")\;=" + (LaTeX[y(m_3)]) + "$"
text4: "$ f(x)=|x" + (LaTeX[If[a > 0, "-", If[a < 0, "+", ""]]]) + "" + (LaTeX[If[a ≠ 0, abs(a), ""]]) + "|+|x" + (LaTeX[If[b > 0, "-", If[b < 0, "+", ""]]]) + "" + (LaTeX[If[b ≠ 0, abs(b), ""]]) + "|$
$\;\;\;\;\;\;\;\;\;\;\;+|x" + (LaTeX[If[c > 0, "-", If[c < 0, "+", ""]]]) + "" + (LaTeX[If[c ≠ 0, abs(c), ""]]) + "|+|x" + (LaTeX[If[d > 0, "-", If[d < 0, "+", ""]]]) + "" + (LaTeX[If[d ≠ 0, abs(d), ""]]) + "| $
$f(x)的最小值為f(" + (LaTeX[Median[{a, b, c, d}]]) + ")=\;" + (LaTeX[y(m_4)]) + "$"
text2: "$ f(x)=|x" + (LaTeX[If[a > 0, "-", If[a < 0, "+", ""]]]) + "" + (LaTeX[If[a ≠ 0, abs(a), ""]]) + "|+|x" + (LaTeX[If[b > 0, "-", If[b < 0, "+", ""]]]) + "" + (LaTeX[If[b ≠ 0, abs(b), ""]]) + "| $
$f(x)的最小值為$
$f(" + (LaTeX[Min[a, b]]) + ")=f(" + (LaTeX[Max[a, b]]) + ")=f(" + (LaTeX[Median[{a, b}]]) + ")=\;" + (LaTeX[y(m_2)]) + "$"