(* Compute test cases using the formula in footnote[23] *) (* written June 2017 by Kurt Johmann *) (* Set the inputs -- (x1,y1,z1), (x2,y2,z2), and L -- that the formula needs. *) (* Note: After setting the inputs, select "Evaluate Notebook" on the "Evaluation" menu to compute everything using the current inputs. *) myInputs[x1 = 2.3, y1 = -5, z1 = 7700, x2 = -909, y2 = 303, z2 = 625, L = 13] (* the formula: *) x3 = x1 + (If[x2 > x1, 1,-1] * Sqrt[(L^2*(x2 - x1)^2)/((-x1+x2)^2+(-y1+y2)^2+(-z1+z2)^2)]) y3 = y1 + (If[y2 > y1, 1,-1] * Sqrt[(L^2*(y2 - y1)^2)/((-x1+x2)^2+(-y1+y2)^2+(-z1+z2)^2)]) z3 = z1 + (If[z2 > z1, 1,-1] * Sqrt[(L^2*(z2 - z1)^2)/((-x1+x2)^2+(-y1+y2)^2+(-z1+z2)^2)]) (* Verify that the above-computed point (x3,y3,z3) is correct. *) (* The following three ratios should be the same (ignore any ratio if the denominator is 0, which is division by 0): *) ratioX = ((x3 - x1)/(x2 - x1)) ratioY = ((y3 - y1)/(y2 - y1)) ratioZ = ((z3 - z1)/(z2 - z1)) (* The distanceL value should be the same as the L value set as an input: *) distanceL = Sqrt[(x3 - x1)^2 + (y3 - y1)^2 + (z3 - z1)^2] L