空間中兩點的距離(3)
Author: 藍邦偉　老師

單位向量

座標軸

Start

x

y

z

$ O $

$A$

$B$

$  空間中兩點的距離 $

$ A( $

x1

y1

z1

x2

y2

z2

$ B( $

1

2

3

$ , $

$ , $

$ ) $

$ , $

$ , $

$ ) $

$ A\;點輔助參考 $

$ B\;點輔助參考 $

$ 顯示提示 $

O = (10.890675530473038, 4.342529132592103)
β = 1.3962634015954636 rad (slider from 0 to 6.283185307179586, step 0.1*°)
Z_{unit}: O + (0, sin(β))
w = Vector(O, Z_{unit})
α = 1.3089969389957472 rad (slider from 0 to 6.283185307179586, step 0.1*°)
X_{unit}: O + (cos(α), sin(α) * cos(β))
u = Vector(O, X_{unit})
Y_{unit}: O + (-1 * sin(α), cos(α) * cos(β))
v = Vector(O, Y_{unit})
L = 7 (slider from 1 to 10, step 1)
yy = Vector(O - L * v, O + L * v)
zz = Vector(O - L * w, O + L * w)
xx = Vector(O - L * u, O + L * u)
c = false
d = true
Q_2: 0.25 * Corner[2] + 0.75 * Corner[1]
Q_3: (x(Q_2), y(Corner[3]))
g = Segment(Q_2, Q_3)
poly1, h, q_1, q_4, i = Polygon(Corner[1], Q_2, Q_3, Corner[4])
x_1 = 1 (slider from -5 to 5, step 1)
y_1 = 1 (slider from -5 to 5, step 1)
z_1 = 1 (slider from -5 to 5, step 1)
A: O + x_1 * u + y_1 * v + z_1 * w
A_2: O + x_1 * u + y_1 * v
A_3: O + x_1 * u + z_1 * w
A_4: O + y_1 * v + z_1 * w
A_5: O + x_1 * u
A_6: O + y_1 * v
A_7: O + z_1 * w
a_3 = Segment(O, A_6)
a_4 = Segment(O, A_5)
a_c = Segment(O, A_7)
a_6 = Segment(A_3, A_5)
a_7 = Segment(A, A_2)
a_8 = Segment(A_6, A_4)
a_1 = Segment(A, A_4)
a_5 = Segment(A_2, A_6)
a_2 = Segment(A_2, A_5)
a_9 = Segment(A_3, A_7)
a_a = Segment(A_3, A)
a_b = Segment(A_7, A_4)
x_2 = -1 (slider from -5 to 5, step 1)
y_2 = -1 (slider from -5 to 5, step 1)
z_2 = -1 (slider from -5 to 5, step 1)
B: O + x_2 * u + y_2 * v + z_2 * w
B_2: O + y_2 * v + z_2 * w
B_3: O + x_2 * u + z_2 * w
B_4: O + x_2 * u + y_2 * v
B_5: O + x_2 * u
B_6: O + y_2 * v
B_7: O + z_2 * w
b_1 = Segment(O, B_5)
b_0 = Segment(O, B_6)
b_2 = Segment(O, B_7)
b_3 = Segment(B_3, B_5)
b_4 = Segment(B_3, B_7)
b_5 = Segment(B_4, B_6)
b_6 = Segment(B_4, B_5)
b_7 = Segment(B_2, B_6)
b_8 = Segment(B_2, B_7)
b_9 = Segment(B, B_4)
b_a = Segment(B, B_2)
b_b = Segment(B, B_3)
max_x = If((x_1 ≥ 0) ∧ (x_2 ≥ 0), Max[x_1, x_2], If[(x_1 < 0) ∧ (x_2 < 0), 0, If[x_1 * x_2 < 0, Max[x_1, x_2]]])
min_x = If((x_1 ≥ 0) ∧ (x_2 ≥ 0), 0, If[(x_1 < 0) ∧ (x_2 < 0), Min[x_1, x_2], If[(x_1 < 0) ∧ (x_2 > 0), x_1, If[(x_1 > 0) ∧ (x_2 < 0), x_2]]])
max_y = If((y_1 ≥ 0) ∧ (y_2 ≥ 0), Max[y_1, y_2], If[(y_1 < 0) ∧ (y_2 < 0), 0, If[y_1 * y_2 < 0, Max[y_1, y_2]]])
max_z = If((z_1 ≥ 0) ∧ (z_2 ≥ 0), Max[z_1, z_2], If[(z_1 < 0) ∧ (z_2 < 0), 0, If[z_1 * z_2 < 0, Max[z_1, z_2]]])
C_1: O + max_x * u + max_y * v + max_z * w
min_y = If((y_1 ≥ 0) ∧ (y_2 ≥ 0), 0, If[(y_1 < 0) ∧ (y_2 < 0), Min[y_1, y_2], If[(y_1 < 0) ∧ (y_2 > 0), y_1, If[(y_1 > 0) ∧ (y_2 < 0), y_2]]])
min_z = If((z_1 ≥ 0) ∧ (z_2 ≥ 0), 0, If[(z_1 < 0) ∧ (z_2 < 0), Min[z_1, z_2], If[(z_1 < 0) ∧ (z_2 > 0), z_1, If[(z_1 > 0) ∧ (z_2 < 0), z_2]]])
C_2: O + min_x * u + min_y * v + min_z * w
C_3: O + max_x * u + max_y * v + min_z * w
C_6: O + max_x * u + min_y * v + min_z * w
C_7: O + min_x * u + max_y * v + min_z * w
C_4: O + max_x * u + min_y * v + max_z * w
C_8: O + min_x * u + min_y * v + max_z * w
c_0 = Segment(C_2, C_6)
c_1 = Segment(C_3, C_6)
c_2 = Segment(C_3, C_7)
c_3 = Segment(C_2, C_7)
c_4 = Segment(C_2, C_8)
c_5 = Segment(C_6, C_4)
c_6 = Segment(C_1, C_3)
c_7 = Segment(C_1, C_4)
c_8 = Segment(C_8, C_4)
C_5: O + min_x * u + max_y * v + max_z * w
c_9 = Segment(C_8, C_5)
c_a = Segment(C_7, C_5)
c_b = Segment(C_1, C_5)
inputBox1 = Textfield(x_1)
inputBox2 = Textfield(y_1)
inputBox3 = Textfield(z_1)
inputBox4 = Textfield(x_2)
inputBox5 = Textfield(y_2)
inputBox6 = Textfield(z_2)
a_0 = Segment(A, B)
b = true
e = true
a = true
n: (x_2 - x_1)^(2) + (y_2 - y_1)^(2) + (z_2 - z_1)^(2)
C = (-0.650004412415708, 7.245844841494927)
text4 = txtSqrt(n, C)
t_{D1}: "$ \overline{AB} =\sqrt{" + (LaTeX[(x_2 - x_1)^(2)]) + "+" + (LaTeX[(y_1 - y_2)^(2)]) + "+" + (LaTeX[(z_1 - z_2)^(2)]) + "}$
$\;\;\;\;\;\;=$"

Tool: txtSqrt
txtSqrt[n,A]
Input: n, A
Output: text1

p = Factors(n)
m = Length(p)
p1 = Sequence({Element[p, k, 1], Div[Element[p, k, 2], 2]}, k, 1, m)
p2 = Sequence({Element[p, k, 1], Mod[Element[p, k, 2], 2]}, k, 1, m)
a = Product(Sequence[Element[p1, k, 1]^(Element[p1, k, 2]), k, 1, m])
b = Product(Sequence[Element[p2, k, 1]^(Element[p2, k, 2]), k, 1, m])
str = If(n ≟ 1, "1", If[b ≟ 1, "" + a, If[a ≟ 1, "\sqrt{" + b + "", a + "\sqrt{" + b + "}"]])
text1 = Text(str, A, false, true)