Follow

Here's a requiring a bit of algebra.

For any four non-collinear points A, B, C, and D in three-dimensional space, there is a unique hyperbolic paraboloid H containing the lines AB, BC, CD, and AD (that is, every point on any of these lines is also on the surface of H). Write a program that accepts Cartesian coordinate triplets representing A, B, C, and D and prints an equation in x, y, and z that is satisfied if and only if <x, y, z> is a point on H.

Your program's output may differ from the examples but should be optimised for human readability. Combine like terms, omit terms equal to zero and avoid unnecessary factors (e.g. prefer "x = y" to "2x + 0 = 4y - 2y" even though both describe the same surface).

Example 1 input:
<0, 1, -1>; <1, 0, 1>; <0, -1, -1>; <-1, 0, 1>
Example 1 output:
z = x² - y²

Example 2 input:
<1, 1, 1>; <1, 0, -1>; <-1, 1, -1>; <-1, 0, 1>
Example 2 output:
2y = xz + 1

Example 3 input:
<0, 1, 1>; <0, 1, -1>; <0, -1, -1>; <0, -1, 1>
Example 3 output:
x = 0

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves. A STEM-oriented instance.

No hate, No censorship. Be kind, be respectful

We federate with all servers: we don't block any servers.