Baystation12/Baystation12 — pull request #4325 by AllSystemsGo (2014-01-21 20:16:07+00:00)
Title: Fixes unsolvable telescience equation.

Currently, telescience requires users to solve for two variables with only one equation (not possible). To best illustrate this problem, I'll present said problem alongside my solution:

D = 2*(P-Poff)*sin(E-Eoff)/10*(P-Poff)*cos(E-Eoff) = (P-Poff)^2*sin(2*E-Eoff)/10
Where:
D is distance
P is power and Poff is power offset
E is elevation and Eoff is elevation offset.

As E and P can be set by the user and D can be measured, let's use a test case from the game where:
let D = 18, E = 45, and P = 20.

Thus:
18 = (20-P_off)^2*sin(2*45-E_off)/10 = (20-P_off)^2*sin(90-E_off)/10
Or after this patch:
18 = (20-P_off)^2*sin(2*45)/10 = (20-P_off)^2*1/10 = (20-P_off)^2/10

And if we try to solve the variables in equations:

Before patch: (The notation here gets complex so excuse the external links)
P_off = http://www.wolframalpha.com/input/?i=solve+%2820-P%29^2*sin%2890-L%29%2F10+%3D+18+for+P
E_off = http://www.wolframalpha.com/input/?i=solve+%2820-P%29^2*sin%2890-L%29%2F10+%3D+18+for+L
Naturally, each variable can only be described in terms of the other; they cannot be solved for a real number.

After patch:
Let D = 29 (Distance will generally be greater if you VV and set angle_off (elevation offset) to 0)
D = ((P-P_off)^2)/10 = ((20-P_off)^2)/10 = 29
Therefore: 20 - P_off = sqrt(D*10) = sqrt(290) ~= 17
Therefor P_off ~= 3
(In wolfram alpha format: http://www.wolframalpha.com/input/?i=solve++%2820-P_1%29^2%2F10+%3D+29 )

Thus, we are able to arrive at an answer and so make telescience actually a calculated science, instead of purely guesswork.

(As an alternative, an extra mechanic could be introduced which uses system of equations instead of a single equation and provides a measurable result separate from distance. If setup right, this would allow an equation with 2 unknown variables to be solved. Though, this would be a lot more effort).