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.

I'm a computer programmer by profession with no formal CS education. When I read in mathematics the terminology used around a function, I get confused. For example, I was reading up on some calc and read this: As a function of time. Or the following statement: "In science, engineering, technology, finance, and other areas, graphs are tools used for many purposes. In the simplest case one variable is plotted as a function of another, typically using rectangular axes"

What does this example As a function of time actually mean for a programmer? Is t the parameter of a method? What would be the return value? Any simple examples to bridge this gap of confusion.

share|improve this question
If one variable (say $x$) is the input for a method (call it $f$), and the return of the method is captured by another variable (say $y$), this is exactly the case that we are writing $y$ as a function of $x$; so $y=f(x)$ is the relationship. –  MPW Jun 27 '14 at 20:17
I think it is overly literal to expect "a function of time" to have a narrow interpretation with software routines playing the role of "function". While software routines that return a value are often called "functions", the result may depend on inputs other than the bindings of formal arguments ("input parameter"). For graphing exercises it is often specfied which variable is "indpendent" (a value that can be specifed autonomously) and which variable is "dependent" (a value which is determined by the choice of value for the independent variable). Think of an example for yourself. –  hardmath Jun 27 '14 at 22:23

2 Answers 2

For a programmer, a "function of time" would be a method where the parameter is time and every time the method is run with a specific value of time the same value is returned every single time. There will usually be no other parameters if the function is only a function of time. For example:

 double Velocity(double time){
      return 10*time;

Would be considered a function of time. This can be thought of a function that represents the velocity of an object where the object is at rest when time = 0 and then accelerates.

In mathematics, time is generally represented with a t and the function is usually f or other letter. For example, we could write:

 double f(double t){
      return t*t+2*t-10;

This would represent a function of time such that $f(t) = t^2 + 2t - 10$.

For an example of something that is not a function of t:

 double notAFunction(double time){
      return t*rand();

This is not a mathematical function of time because if you wrote the expression notAFunction(1) == notAFunction(1) it would almost always be false. This contradicts the criteria in my first sentence.

Another odd example of a (valid) function of time would be

 int returnTen(double time){
      return 10;

This satisfies every one of the criteria even though no matter what value you use you have that returnTen(t) == 10. This would represent a constant function $f(t) = 10$.

share|improve this answer
This answer is perfect and pays attention to the fact that the question was asked from the point of view of a programmer. –  nhgrif Jun 28 '14 at 2:35

If you go in your car and move at a speed of $60$ mph then you can express the distance you travel "as a function of time". Written in mathematical terms $f(t)=60 \cdot t.$ So, $f(0)=0,$ which means in $0$ hours you move $0$ miles; $f(2)=120,$ which means in $2$ hours you move $120$ miles.

share|improve this answer

Your Answer


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.