Let X
1, X
2, ... , X
n be n≥2 distinct points on a circle C
with center O and radius r. What is the
locus of points P inside C such that
∑
ni=1 |X
iP|/|PY
i| = n
,where the line X
iP also intersects C at point Y
i.
The locus will always include point O, the center of C, as each ratio equals 1 there, and so n of them add up to n. The following program calculates the sum for each point on a grid within the circle and plots a color in DOS full-screen graphics. It won't run under Windows Vista, but will run under XP, except for XP 64, apparently, where we're told no DOS programs will run. The QuickBasic 4.5 IDE is available at http://www.winsite.com/bin/Info?14000000036569, http://www.qbcafe.net/qbc/english/download/compiler/qbasic_compiler.shtml and other sites. Also see the Wikipedia article http://en.wikipedia.org/wiki/QuickBASIC. When run, you can make r larger (like 150) to see a more detailed view, in color, and in correct proportion. One character position on the printed output represents one square pixel on the screen so the view looks compressed horizontally and/or stretched vertically. On the screen it shows correct proportions; this was done so as not to increase the comment pane size unreasonably.
DEFDBL A-Z
SCREEN 12
pi = ATN(1) * 4
dr = pi / 180
n = 2
r = 50
ang(1) = 0
ang(2) = 180
FOR i = 1 TO n
x(i) = r * COS(ang(i) * dr)
y(i) = r * SIN(ang(i) * dr)
NEXT
CIRCLE (300, 200), r, 7
PSET (300, 200), 12
FOR px = -r + 1 TO r - 1
ylim = INT(SQR(r * r - px * px))
FOR py = -ylim TO ylim
t = 0
FOR i = 1 TO n
PSET (300 + px, 200 - py)
p1x = x(i): p1y = y(i)
' CIRCLE (300 + p1x, 200 - p1y), 4, 14
IF p1x = px THEN
m = 1D+100
ELSE
m = (p1y - py) / (p1x - px)
END IF
a = m * m + 1
b = 2 * m * (py - m * px)
c = m * m * px * px - 2 * m * py * px + py * py - r * r
IF b * b - 4 * a * c < 0 OR p1x = px THEN
p2x = (p1x + px) / 2 ' vertical line among three points
p2y = -p1y
ELSE
IF p1x > px THEN
p2x = (-b - SQR(b * b - 4 * a * c)) / (2 * a)
ELSE
p2x = (-b + SQR(b * b - 4 * a * c)) / (2 * a)
END IF
p2y = m * (p2x - px) + py
END IF
rr = SQR(p2x * p2x + p2y * p2y)
IF ABS(rr - r) > 10 THEN
' CIRCLE (300 + p2x, 200 - p2y), 4, 12
REM bad point
END IF
d2 = SQR((p2y - py) * (p2y - py) + (p2x - px) * (p2x - px))
d1 = SQR((p1y - py) * (p1y - py) + (p1x - px) * (p1x - px))
rat = d2 / d1
t = t + rat
NEXT i
SELECT CASE t
CASE IS < n * .99999
c = 14
CASE IS > n * 1.00001
c = 9
CASE ELSE
c = 4
END SELECT
'IF m > 1D+299 THEN c = 7
PSET (300 + px, 200 - py), c
NEXT py
NEXT px
CIRCLE (300, 200), 4, 15
FOR th = -pi / 4 TO pi / 4 STEP 1 / 1000
rho = r * SQR(ABS(COS(2 * th)))
x = 300 + rho * COS(th)
y = 200 - rho * SIN(th)
CIRCLE (x, y), 1, 2
NEXT th
FOR th = 3 * pi / 4 TO 5 * pi / 4 STEP 1 / 1000
rho = r * SQR(ABS(COS(2 * th)))
x = 300 + rho * COS(th)
y = 200 - rho * SIN(th)
CIRCLE (x, y), 1, 2
NEXT th
OPEN "locuspts.txt" FOR OUTPUT AS #2
FOR row = 200 - 56 TO 200 + 56
FOR col = 300 - 56 TO 300 + 56
IF POINT(col, row) = 14 OR POINT(col, row) = 0 THEN
PRINT #2, " ";
ELSEIF POINT(col, row) = 15 THEN
PRINT #2, ".";
ELSEIF POINT(col, row) = 7 THEN
PRINT #2, "-";
ELSEIF POINT(col, row) = 2 THEN
PRINT #2, "X";
ELSE
PRINT #2, "*";
END IF
NEXT
PRINT #2,
NEXT
CLOSE
The above program is set for n = 2 with the two points diametrically opposed, at 0 degrees and 180 degrees.
The below result shows a locus that matches the lemniscate of Bernoulli (the points where the sum of the ratios exceeds n are marked with *; those where the sum is less than 1 are blank, so the locus sought is the boundary between the *'ed area and the blank area)(http://mathworld.wolfram.com/Lemniscate.html or http://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli). The lemniscate is marked by a band of X's, and does lie on the boundary of the *'d area and the blank area. The original circle, C, is marked by hyphens. The center of the circle is marked by a circle of periods (.), which replace any * or blank that may lie under them. As the center is on the locus, it's on the border between the *'s and the blanks, and so the .'s usually replace half *'s and half blanks.
------- -------
--- ---
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
XXXXXX XXXXXX
- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX -
XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX****XXXXXXXXXXX XXXXXXXXXXX****XXXXXXXXXX
- XXXXXX**************XXXXXXXX XXXXXXXX**************XXXXXX -
XXXXX*******************XXXXXX XXXXXX*******************XXXXX
XXXX***********************XXXXXX XXXXXX***********************XXXX
- XXXX**************************XXXXX XXXXX**************************XXXX -
- XXXX*****************************XXXXX XXXXX*****************************XXXX -
-XXXX*******************************XXXXX XXXXX*******************************XXXX-
XXXX**********************************XXXX XXXXX*********************************XXXX
XXX************************************XXXX XXXX************************************XXX
XXXX*************************************XXXX XXXX*************************************XXXX
XXX***************************************XXXX XXXX***************************************XXX
XXX****************************************XXXX X XX****************************************XXX
XXXX*****************************************XXXX ... X X******************************************XXXX
XXX*******************************************XX.X X.X********************************************XXX
XXX*********************************************X X X X*********************************************XXX
XXX********************************************.*X*X*X*.********************************************XXX
XXX********************************************.**X*X**.********************************************XXX
XXX********************************************.*X*X*X*.********************************************XXX
XXX*********************************************X X X X*********************************************XXX
XXX********************************************X.X X.XX*******************************************XXX
XXXX******************************************X X ... XXXX*****************************************XXXX
XXX****************************************XX X XXXX****************************************XXX
XXX***************************************XXXX XXXX***************************************XXX
XXXX*************************************XXXX XXXX*************************************XXXX
XXX************************************XXXX XXXX************************************XXX
XXXX*********************************XXXXX XXXX**********************************XXXX
-XXXX*******************************XXXXX XXXXX*******************************XXXX-
- XXXX*****************************XXXXX XXXXX*****************************XXXX -
- XXXX**************************XXXXX XXXXX**************************XXXX -
XXXX***********************XXXXXX XXXXXX***********************XXXX
XXXXX*******************XXXXXX XXXXXX*******************XXXXX
- XXXXXX**************XXXXXXXX XXXXXXXX**************XXXXXX -
XXXXXXXXXX****XXXXXXXXXXX XXXXXXXXXXX****XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX
- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX -
XXXXXX XXXXXX
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
--- ---
------- -------
Edited on December 12, 2007, 7:49 pm
|
Posted by Charlie
on 2007-12-12 19:48:10 |