File: cobweb2.ode

package info (click to toggle)
xppaut 5.85-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,552 kB
  • ctags: 7,725
  • sloc: ansic: 80,633; cpp: 965; makefile: 265
file content (26 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# way to fool XPP into cobwebbing
# first I define a function that every other step evaluates
# the map -- in the alternate steps, it just keeps the same
# value so that it alternates between horizontal and vertical
# jumps
g(x,y)=if(mod(t,2)<.5)then(f(x))else(y)
# note that 't' is the iteration number 0,1,2,...
# if t is even evaluate f otherwise keep the old y
y(t+1)=g(x,y)
x(t+1)=if(t==0)then(x)else(y)
# note that x(t+2)=f(x(t)) so every other point is the map!
f(x)=a*x*(1-x)
par a=3.95
init y=0,x=.01
# always start y=0
#
# add this plot to the graph to see the actual function
# this assumes that you have chosen at least 100 iterates
aux map=f(.01*t)
aux st=.01*t
# some convenient settings for the graphics
@ xlo=0,ylo=0,xhi=1,yhi=1
@ xp=x,yp=y
# tell xpp that it is discrete and iterate 100 times
@ meth=discrete,total=100
done