# mathematica - why is this Do loop not producing any output?

• May 14th 2009, 01:50 PM
tolland
mathematica - why is this Do loop not producing any output?
Code:

```Clear[f] f[t_, i_] := (1000*20)/((1000 - 20)*E^(-(1 + 0.2 i)*t) + 20) Do[  Plot[f[t, i], {t, 0, 3}, PlotRange -> {{0, 3}, {0, 1000}}],  {i, 1, 10}]```
I was expecting 10 Plots to appear?
• May 15th 2009, 02:54 AM
MikeCroucher
It's a long story. The practical upshot is that you could try this

Code:

```Clear[f] f[t_, i_] := (1000*20)/((1000 - 20)*E^(-(1 + 0.2 i)*t) + 20) Do[Print[Plot[f[t, i], {t, 0, 3},   PlotRange -> {{0, 3}, {0, 1000}}]], {i, 1, 10}]```
Best Wishes,
Mike
www.walkingrandomly.com
• May 15th 2009, 02:59 AM
tolland
Quote:

Originally Posted by MikeCroucher
It's a long story. The practical upshot is that you could try this

haha, I am interested?

I got that example out of a tutorial for mathematica, which might been an earlier version so it would seem that they have changed the behaviour

T.
• May 15th 2009, 03:08 AM
MikeCroucher
The tutorial you copied it from is almost certainly pre v6.0. Wolfram changed the graphics model completely when they moved to version 6 and most of the time the only thing you'll notice is that plotting is massively better.

Sometimes though, the changes break old code and this is one of those times. More details can be found in the following mathform thread

MathGroup Archive: June 2007 [01202]

Cheers,
Mike
www.walkingrandomly.com
• May 15th 2009, 03:37 AM
tolland
Quote:

Originally Posted by MikeCroucher
Sometimes though, the changes break old code and this is one of those times. More details can be found in the following mathform thread

MathGroup Archive: June 2007 [01202]

Now that makes perfect sense, and it wasn't even a long story ;-)
Cheers,

Tom