Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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$?

share|improve this question
1  
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

2 Answers 2

$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$.

share|improve this answer
    
As a result, the rate of change of $M(t)$ is constant and is $9/5=1.8$ –  Emmad Kareem 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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.