# What does this function calculate?

Can anyone confirm to me what this function calculates?

Function m(t);
p=9t;
q=p+32;
r = q/5;
Return r;
End function


Ok so inputting numbers from $0-9$ (in numerical order) the output is as follows: $$6.4, 8.2, 10, 11.8, 13.6, 15.4, 17.2, 19, 20.8, 22.6$$ Ok so clearly each value is being incremented by $1.8$. But would it be correct to say that the function adds increments by $1.8$?

-
Please be consistent between lower and upper case. If you divide by 5 before adding 32 you get the conversion from Celsius to Fahrenheit. – Ross Millikan Nov 3 '12 at 23:43
Sorry about the format. Yes I get the conversion for Celsius into Fahrenheit. This is why i am confused when i am being asked what this code calculates. – Fendorio Nov 3 '12 at 23:47
When the 32 is divided by 5, it takes Celsius and returns Fahrenheit-25.6. I don't think there is a better characterization than Alexander Gruber has given. – Ross Millikan Nov 3 '12 at 23:49

$M(t)=\frac{9t+32}{5}$ is the equation of a line with slope $9/5=1.8$ and $y$-intercept $32/5=6.4$.

-
As a result, the rate of change of $M(t)$ is constant and is $9/5=1.8$ – NoChance Nov 3 '12 at 23:39
Ok so would i be right in saying: "This code calculates a constant rate of change of M(t) by 9/5 (1.8)"? As an answer to "Confirm what the code calculates"? I have this written down but just doesn't seem right to me – Fendorio Nov 3 '12 at 23:44
@Fendorio No. This code calculates the height of the line with the equation I wrote above as a function of $t$. It's just a linear equation. – Alexander Gruber Nov 3 '12 at 23:46

r = q/5 $\rightarrow$ r = (p + 32)/5 $\rightarrow$ r = (9t + 32)/5

Hence r = 9/5t + 32/5

equation of line is y = mx + b, so as we can see this is just equation of line of slope 9/5 and y-intercept of 32/5.

-

So, we simplify the calculation to one-line equation $$r=\frac{9t+32}{5}$$

to find the increment, we separate the division, and do the division, which is $$r = \frac{9}{5}t + \frac{32}{5}$$ $$r = 1.8t + 6.4$$

and with $1.8t$, we can prove that the answer was incremented 1.8 when t incremented by 1

EDIT: if we use "Equation of a Straight Line" formula where $y = mx + b$ (or $y = mx + c$ in UK), we can use this formula to form a graph $y = 1.8x + 6.4$, where $m=1.8$, $b=6.4$

-

Just work through the formula:

$r = \frac{q}{5} = \frac{p+32}{5} = \frac{9t+32}{5}$. It multiplies by 9, adds 32 and divides by 5. Or it multiplies by 0.18 and adds 6.4.

-