/usr/share/doc/mathomatic/tests/distance.in is in mathomatic 16.0.4-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 | ; This input arrives at the shortest distance between a point and a line
; in 2 dimensions. The point is at (x0, y0) in cartesian coordinates.
; (x, y) are the points on the line.
a*x+b*y+c=0 ; equation of the line
y ; solve for y
unfactor fraction ; equation of the line in slope-intercept form:
distance=|a*(x-x0)+b*(y-y0)|/(a^2+b^2)^.5
eliminate y ; Combine the above two equations to eliminate x and y.
simplify ; The beautiful answer is:
; Replacing a with -m, b with 1, and c with -b results in the shortest distance from the line y=m*x+b.
|