When I run this simple code, which repeats many times the exact same operation (a differential equation), the runtime (given by Timing
) increases systematically, from roughly 1 second to 5.
I am using Math 9.0.1.0 on a MacBook Air. (Edit: the problem is not reproduced when running the same code with Mathematica 7 on a Linux machine.)
Can somebody else reproduce this? Does anybody know why and what can I do to avoid it?
Clear[delta];
delta := NDSolve[{y''[n] + y'[n] - y[n] == 0, y[-3] == 1, y'[-3] == 1}, y, {n, -3, 0}];
Do[{time = Timing[Do[delta, {a, 1000}]]; Print[time]}, {i, 10}]
Comments
Post a Comment