Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know I can find out the amount of time a function takes to run like this:

In:=  function1[100] //Timing
Out:= {0.043334, Null}

How can I graph this over a set of 10 or 20 parameters (which are increasingly large), in order to get an idea of how the function scales?

share|improve this question
Did you mean to write function1[100]? – s0rce Mar 8 '13 at 2:24
yes. New to mathematica - not used to square brackets. :) – Jakob Weisblat Mar 8 '13 at 2:25
up vote 6 down vote accepted

This isn't the most exciting example but I hope it helps.

Use AbsoluteTiming to time the function and use Table to iterate over a set of values. We're simply going to time the Pause function which just waits x seconds, in this case x^2. The values will be stored as list. First gives us the first element of the output of AbsoluteTiming which is the time taken.

list = Table[First[AbsoluteTiming[Pause[x^2]]], {x, 0, 0.1, 0.01}];

Then we'll plot it with ListPlot


Mathematica graphic

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.