[Date Index]
[Thread Index]
[Author Index]
newbie: programmatic sequence of plots?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg96762] newbie: programmatic sequence of plots?
*From*: Tom Roche <tlroche at gmail.com>
*Date*: Tue, 24 Feb 2009 05:45:38 -0500 (EST)
How to get a programmatic sequence of plots?
As advertised by the Subject:, I'm new to Mathematica (specifically
7.0.0 for Students for 32-bit Windows on XP Pro) so please excuse any
lapses in terminology. I'd also appreciate pointers to specific docs
rather than just an RTFM.
Since I'm currently unable to model the logistic map y=a y (1-y) (see
previous post) I'm trying to do a series of plots of it, to see how
behavior changes over time. I can get a plot of a single instance with
Clear[a,y,y0,nRecurr];
a=3.5;
y0=0.4;
nRecurr=50;
ListPlot[
RecurrenceTable[{y[n+1]==a y[n] (1-y[n]),y[0]==y0},
y,{n,1,nRecurr}],Joined->True
]
I can get a sequence of tables of values with
Clear[a, y, y0, nRecurr, yinit, yinc, yfinal];
a = 3.5;
nRecurr = 50;
yinit = 0.1;
yinc = 0.01;
yfinal = 0.2;
For[y0 = yinit, y0 <= yfinal, y0 += yinc, Print[y0, ":\n",
RecurrenceTable[{y[n + 1] == a y[n] (1 - y[n]), y[0] == y0}, y, {n,
1, nRecurr}]]]
But when I try to plot those values with
Clear[a, y, y0, nRecurr, yinit, yinc, yfinal];
a = 3.5;
nRecurr = 50;
yinit = 0.1;
yinc = 0.01;
yfinal = 0.2;
For[y0 = yinit, y0 <= yfinal, y0 += yinc,
ListPlot[
RecurrenceTable[
{y[n + 1] == a y[n] (1 - y[n]), y[0] == y0}, y, {n, 1, nRecurr}
]
,Joined->True]
]
I get absolutely nothing: no plot, no error message, no nada.
Similarly, when I try to plot the difference between two runs of the
map with
seqDiff[a_,y_,inc_]:=Module[
{r=y,s=y+inc},
ListPlot[
Table[r=a r (1-r),{50}]-Table[s=a s (1-s),{50}],
Joined->True,PlotRange->{-1,1}
]
]
seqDiff[4.0,0.3,0.1]
I get a plot. But when I try to put that inside a for loop
Clear[a, i,init,inc,final];
a = 4.0;
init=0.3;
inc=0.1;
final=0.5;
For[i=init,i<=final,i+=inc,seqDiff[a,i,inc]]
I get nothing: no plot, no error message.
What am I doing wrong? How to get a series of plots?
TIA, Tom Roche <Tom_Roche at pobox.com>
Prev by Date:
**Re: no message from Minimize[] on a weird function(x^x) !?!**
Next by Date:
**Re: Error using Manpulate that is NOT obvious (to me)**
Previous by thread:
**Re: Need some help with monitoring evaluation**
Next by thread:
**Re: newbie: programmatic sequence of plots?**
| |