21
3
There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur).
So, now the issue is, most people don't use this system. So, I need a program to convert back from this average!
Challenge
Given the average of the Celsius, Fahrenheit, Kelvin, and Rankine representations of a certain temperature, output the individual standard representations, in any prespecified and consistent order. It turns out that this is possible, based on my whiteboard calculations. Input will be a single floating-point value in whatever range your language can handle, and output will be four floating-point values in any reasonable format. You can restrict the input to force the output to be in the range of your language, but you must be able to support down to Absolute Zero (thus, you need to be able to handle negative numbers).
Test Cases
input -> (Celsius, Fahrenheit, Kelvin, Rankine)
100 -> (-70.86071428571424, -95.54928571428565, 202.28928571428574, 364.12071428571437)
20 -> (-128.0035714285714, -198.4064285714286, 145.14642857142857, 261.2635714285714)
-10 -> (-149.43214285714282, -236.97785714285715, 123.71785714285716, 222.69214285714287)
10000 -> (7000.567857142858, 12633.022142857144, 7273.717857142858, 13092.692142857144)
These values were generated with Uriel's Python program, and I verified that they were correct.
2related – Leaky Nun – 2017-04-24T14:52:01.510
I think the first three test cases are messed up somehow, the Fahrenheit and Kelvin numbers have the same decimal part, and vice versa. – ETHproductions – 2017-04-24T14:58:42.763
Also for the last test case I get
13092....
Rankines instead of13091...
– Business Cat – 2017-04-24T15:08:25.527I'm getting
364.1207142857143
for the Rankine of the first one – Leaky Nun – 2017-04-24T15:08:27.073And how accurate must the output be? – Leaky Nun – 2017-04-24T15:09:11.303
Required precision? That directly translates into the number of decimals in the conversion factors, so it's important to know howm many decimals those factors need to have – Luis Mendo – 2017-04-24T16:07:54.130
@LeakyNun The output should be as accurate as possible; that is, to the best extent of your program's floating-point precision. However, I will require it to be within 1/100 of a unit (whatever the unit applicable is) of precision. – HyperNeutrino – 2017-04-24T18:58:48.997
7-11.99 Kelvin?! – Jonathan Allan – 2017-04-25T10:57:20.273
@JonathanAllan :D That's why programs aren't required to hande it :P – HyperNeutrino – 2017-04-25T12:07:43.893
So why is there a test case for -200 as an input then? – Jonathan Allan – 2017-04-25T12:12:52.767
@JonathanAllan If your program happens to be able to calculate it correctly, you can test if you'd like, but it says that it's not necessary. – HyperNeutrino – 2017-04-25T12:13:25.950
2
There's nothing inherently wrong with negative Kelvin temperatures in the hypothetical. They just are infinitely hotter than regular temperatures. (Note: I'm not a physicist, I just watch Youtube videos all day and pretend to be one on the internet).
– Draco18s no longer trusts SE – 2017-04-25T19:23:27.113