A and B are points on the graph y=x
2+8x+7
C and D are points on the graph y=-x
2+8x-7
and ABCD is a square.
Find all possible x-coordinates of point A
DEFDBL A-Z
CLS
FOR xdist = 3.1842101291981# TO 3.1842101291982# STEP .00000000000001#
x1 = -4 + xdist: x2 = 4 - xdist
y1 = x1 * x1 + 8 * x1 + 7
y2 = -x2 * x2 + 8 * x2 - 7
x3 = y1: y3 = -x1
x4 = y2: y4 = -x2
y3c = -x3 * x3 + 8 * x3 - 7
y4c = x4 * x4 + 8 * x4 + 7
PRINT USING "##.############# "; xdist; y3 - y3c; y4 - y4c
PRINT USING "##.############# "; x1; y1; x2; y2
PRINT USING "##.############# "; x3; y3; x4; y4
PRINT
NEXT xdist
(the bounds of xdist were narrowed down for each run to get as close to zero as possible for the discrepancy between the alternate vertices of the square vs their x,y values computed from the parabolas)
gives
x y x y
-0.8157898708018 1.1391941468883 0.8157898708018 -1.1391941468883
1.1391941468883 0.8157898708018 -1.1391941468883 -0.8157898708018
and A could be either of the points with negative x coordinate, with B being the other.
--- later: corrected y-coordinate of first point, and program listing which showed wrong variable being displayed.
Edited on February 24, 2010, 4:11 pm
|
Posted by Charlie
on 2010-02-24 13:04:26 |