Before tackling this one, take a look at
this one.
+-------------D
/| /|
/ | / |
/ | / |
/ | / |
C-------------+ |
| | | |
| B--------|----+
| / | /
| / | /
| / | /
|/ |/
+-------------A
A, B, C and D are non-adjacent vertices of a cube. There is a point P in space such that PA=3, PB=5, PC=7, and PD=6. Find the distance from P to the other four vertices and find the length of the edge of the cube.
There are two answers, one with P outside the cube and one with P inside the cube.
The following is my final cut at the problem. Vertex labeling as follows:
A(s,0,0) a = PA = 3
B(0,s,0) b = PB = 5
C(0,0,s) c = PC = 7
D(s,s,s) d = PD
E(s,s,0) e = PE
F(s,0,s) f = PF
G(0,s,s) g = PG P(x,y,z)
O(0,0,0) o = PO
The program variable $i represents the variable i and $i2 = i^2.
$t2 represents the sqrt(8*(19-d^2)*(d*2-64))
The program was run for d = 5, 6, and 7. The values for x, y, and z
differ from Charlie's because we labeled the vertices differently.
for($d=5;$d<8;$d++) {
$d2 = $d*$d;
$t2 = sqrt(8*(19-$d2)*($d2-64));
$s2 = ($d2+83-$t2)/6;
$s = sqrt($s2);
$e = sqrt(($d2-15)/2);
$f = sqrt(($d2+33)/2);
$g = sqrt(($d2+65)/2);
$o = sqrt((83-$d2)/2);
$x = (2*$s2-$d2+65)/(4*$s);
$y = (2*$s2-$d2+33)/(4*$s);
$z = (2*$s2-$d2-15)/(4*$s);
printf("d = %f e = %f f = %f g = %f o = %f\n",$d,$e,$f,$g,$o);
printf(" s = %f x = %f y = %f z = %f\n",$s,$x,$y,$z);
$s2 = $s2+$t2/3;
$s = sqrt($s2);
$x = (2*$s2-$d2+65)/(4*$s);
$y = (2*$s2-$d2+33)/(4*$s);
$z = (2*$s2-$d2-15)/(4*$s);
printf(" s = %f x = %f y = %f z = %f\n\n",$s,$x,$y,$z);
}
d = 5.000000 e = 2.236068 f = 5.385165 g = 6.708204 o = 5.385165
s = 3.284646 x = 4.686791 y = 2.251217 z = -1.402146
s = 5.021066 x = 4.502142 y = 2.908855 z = 0.518924
d = 6.000000 e = 3.240370 f = 5.873670 g = 7.106335 o = 4.847680
s = 3.090065 x = 3.891261 y = 1.302319 z = -2.581095
s = 5.488002 x = 4.065065 y = 2.607339 z = 0.420751
d = 7.000000 e = 4.123106 f = 6.403124 g = 7.549834 o = 4.123106
s = 3.464102 x = 2.886751 y = 0.577350 z = -2.886751
s = 5.656854 x = 3.535534 y = 2.121320 z = 0.000000
|
Posted by Bractals
on 2004-07-22 11:31:24 |