 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Find Points, Maximise Ratio (Posted on 2015-06-05) Given a plane X, a point M in the plane and a point N not in the plane.

Find all points R in X such that the ratio (NM + MR)/NR is the maximum.

 No Solution Yet Submitted by K Sengupta Rating: 4.0000 (1 votes) Comments: ( Back to comment list | You must be logged in to post comments.) computer finding | Comment 2 of 6 | My gut reaction is that the point where this ratio ((MN+MR)/NR is how I like to think about it) is maximized is on a plane perpendicular to plane X, containing both M and N, as, if R is off this vertical plane, NR is unnecessarily increased.

The following program assumes that this is the case, and takes a particular example of M at the origin and N at 5,3 on the vertical plane (3 units from plane X and its projection on plane X is 5 units from M).

The beginning and end points were arrived at by trial and error.

DEFDBL A-Z
ptNx = 5: ptNy = 3
MN = SQR(ptNx * ptNx + ptNy * ptNy)
OPEN "find points max ratio.txt" FOR OUTPUT AS #2
'FOR ptRx = 5.8 TO 5.878 STEP .001
' DO
bg = 5.817: fin = 5.84: stp = .001
FOR ptRx = bg TO fin STEP stp
MR = ptRx
NR = SQR((ptRx - ptNx) * (ptRx - ptNx) + ptNy * ptNy)
v = (MN + MR) / NR
PRINT #2, USING " ##.#####"; ptRx; v;
PRINT #2, "     ";
PRINT #2, USING " #####.#####"; MN; MR; NR
NEXT
' LOOP
CLOSE #2

`    MR  R's X    ratio              MN          MR          NR  coord.    5.81700  3.74622          5.83095     5.81700     3.10926  5.81800  3.74622          5.83095     5.81800     3.10952  5.81900  3.74622          5.83095     5.81900     3.10978  5.82000  3.74623          5.83095     5.82000     3.11005  5.82100  3.74623          5.83095     5.82100     3.11031  5.82200  3.74624          5.83095     5.82200     3.11058  5.82300  3.74624          5.83095     5.82300     3.11084  5.82400  3.74624          5.83095     5.82400     3.11111  5.82500  3.74624          5.83095     5.82500     3.11137  5.82600  3.74625          5.83095     5.82600     3.11164  5.82700  3.74625          5.83095     5.82700     3.11190  5.82800  3.74625          5.83095     5.82800     3.11217  5.82900  3.74625          5.83095     5.82900     3.11243  5.83000  3.74625          5.83095     5.83000     3.11270* 5.83100  3.74625          5.83095     5.83100     3.11297  5.83200  3.74625          5.83095     5.83200     3.11323  5.83300  3.74625          5.83095     5.83300     3.11350  5.83400  3.74625          5.83095     5.83400     3.11377  5.83500  3.74625          5.83095     5.83500     3.11404  5.83600  3.74625          5.83095     5.83600     3.11431  5.83700  3.74624          5.83095     5.83700     3.11457  5.83800  3.74624          5.83095     5.83800     3.11484  5.83900  3.74624          5.83095     5.83900     3.11511`

The required point seems to be where MR equals MN, so triangle MNR is isosceles, and as assumed, is on the plane perpendicular to X.

To verify that going off this vertical plane can only decrease, not increase, the ratio:

Taking the found point above and using points surrounding it on plane X at a distance of .1 units, finds only lower values. (The Z axis is perpendicular to that vertical plane, so the circle of trial points is on plane X, where y=0).

The second part of the following program is the test part:

DEFDBL A-Z
ptNx = 5: ptNy = 3
MN = SQR(ptNx * ptNx + ptNy * ptNy)
OPEN "find points max ratio.txt" FOR OUTPUT AS #2
'FOR ptRx = 5.8 TO 5.878 STEP .001
' DO
bg = 5.817: fin = 5.84: stp = .001
FOR ptRx = bg TO fin STEP stp
MR = ptRx
NR = SQR((ptRx - ptNx) * (ptRx - ptNx) + ptNy * ptNy)
v = (MN + MR) / NR
PRINT #2, USING " ##.#####"; ptRx; v;
PRINT #2, "     ";
PRINT #2, USING " #####.#####"; MN; MR; NR
NEXT
' LOOP

x0 = MN: y = 0: z0 = 0

FOR angle = 0 TO 3 STEP .1
x = x0 + .1 * COS(angle)
z = z0 + .1 * SIN(angle)
MR = SQR(x * x + z * z)
NR = SQR((x - ptNx) * (x - ptNx) + z * z + ptNy * ptNy)
v = (MN + MR) / NR
PRINT #2, USING " ##.#####"; angle; v;
PRINT #2, "     ";
PRINT #2, USING " #####.#####"; MN; MR; NR

NEXT angle
CLOSE #2

`   angle  (radians)  ratio  1.00000  3.74457          5.83095     5.88558     3.12894  1.10000  3.74458          5.83095     5.87699     3.12664  1.20000  3.74459          5.83095     5.86793     3.12421  1.30000  3.74459          5.83095     5.85849     3.12169  1.40000  3.74459          5.83095     5.84878     3.11909  1.50000  3.74460          5.83095     5.83888     3.11645  1.60000  3.74459          5.83095     5.82889     3.11378  1.70000  3.74459          5.83095     5.81891     3.11112  1.80000  3.74458          5.83095     5.80905     3.10849  1.90000  3.74457          5.83095     5.79940     3.10592  2.00000  3.74456          5.83095     5.79005     3.10344  2.10000  3.74455          5.83095     5.78111     3.10106  2.20000  3.74453          5.83095     5.77267     3.09882  2.30000  3.74451          5.83095     5.76481     3.09673  2.40000  3.74450          5.83095     5.75761     3.09482  2.50000  3.74448          5.83095     5.75115     3.09311  2.60000  3.74447          5.83095     5.74549     3.09161  2.70000  3.74445          5.83095     5.74070     3.09035  2.80000  3.74444          5.83095     5.73683     3.08932  2.90000  3.74443          5.83095     5.73391     3.08855`

All the ratios here are less than 3.74625.

 Posted by Charlie on 2015-06-05 15:51:30 Please log in:

 Search: Search body:
Forums (0)