牛頓法求二次函數
Author: 藍邦偉　老師

2

3

$ 牛頓法求二次函數 $

1

1

A = (2, 3)
B = (-1, -2)
C = (-2, 3)
text1: "f_1(" + (x(A)) + ")=" + (y(A))
text2: "f_2(" + (x(A)) + ")=" + (y(A)) + ",f_2(" + (x(B)) + ")=" + (y(B))
text3: "f_3(" + (x(A)) + ")=" + (y(A)) + ",f_3(" + (x(B)) + ")=" + (y(B)) + ",f_3(" + (x(C)) + ")=" + (y(C))
f_1(x) = y(A)
f_2 = Polynomial({A, B})
f_3 = Polynomial({A, B, C})
text5: "f_1(x)=a=" + (y(A))
text6: "f_2(x)=" + (y(A)) + "+b(" + (x(B)) + (If[x(A) > 0, "-", "+"]) + (abs(x(A))) + ")=" + (y(B)) + "⇒b=" + (FractionText[abs((y(B) - y(A)) / (x(B) - x(A)))])
a: y(A)
b: (y(B) - y(A)) / (x(B) - x(A))
text4: "設\left\lbrace \begin{array}{ll} f_1(x)=a \\ f_2(x)=a+b(x" + (LaTeX[If[x(A) > 0, "-", "+"]]) + "" + (LaTeX[abs(x(A))]) + " )\\ f_3(x)=a+b(x" + (LaTeX[If[x(A) > 0, "-", "+"]]) + "" + (LaTeX[abs(x(A))]) + ")+c(x" + (LaTeX[If[x(A) > 0, "-", "+"]]) + "" + (LaTeX[abs(x(A))]) + ")(x" + (LaTeX[If[x(B) > 0, "-", "+"]]) + "" + (LaTeX[abs(x(B))]) + " )\end{array}  \right.\"
d = false
e = false
u = Vector((x(Corner[1]), 0), (x(Corner[3]), 0))
v = Vector((0, y(Corner[1])), (0, y(Corner[3])))
text10: "A" + (LaTeX[A]) + ""
text11: "B " + (LaTeX[B]) + ""
text12: "C" + (LaTeX[C]) + ""
text8: "⇒c=" + (LaTeX[FractionText[y(C) - a - (b * (x(C) - x(A))) / (x(C) - x(A)) * (x(C) - x(B))]]) + ""
c: y(C) - a - b * (x(C) - x(A)) / (x(C) - x(A)) * (x(C) - x(B))
f = false
ab: a * b
text13: "⇒f_3(x)=" + (LaTeX[a]) + "" + (LaTeX[If[b < 0, "-", "+"]]) + "" + (LaTeX[FractionText[abs(b)]]) + "(x" + (LaTeX[If[x(A) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(A))]) + ")" + (LaTeX[If[c < 0, "-", "+"]]) + "" + (LaTeX[FractionText[abs(c)]]) + "(x" + (LaTeX[If[x(A) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(A))]) + ")(x" + (LaTeX[If[x(B) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(B))]) + ")"
text7: "f_3(x)=" + (LaTeX[FractionText[a]]) + "" + (LaTeX[If[b < 0, "-", "+"]]) + "" + (LaTeX[FractionText[abs(b)]]) + "(" + (LaTeX[x(C)]) + "" + (LaTeX[If[x(A) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(A))]) + ")+c(" + (LaTeX[x(C)]) + "" + (LaTeX[If[x(A) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(A))]) + ")(" + (LaTeX[x(C)]) + "" + (LaTeX[If[x(B) < 0, "+", "-"]]) + "" + (LaTeX[abs(x(B))]) + ")=" + (LaTeX[y(C)]) + ""
Q_2: 0.5 * (Corner[1] + Corner[2])
Q_3: (x(Q_2), y(Corner[3]))
poly1, g, q_2, q_3, h = Polygon(Corner[1], Q_2, Q_3, Corner[4])
n = 0 (slider from 0 to 9, step 1)