SharedOrbits.sagewsOpen in CoCalc
Orbit presentation




fcn(x) = piecewise([((-1,.5),2*x), ([.5,1],2*x-1)])
DisplayOrbit = []
skip = 90; maxit = 100 ; x0 = (1/3)
nextx = var('nextx')
oldx = x0
FullOrbit = [oldx]
for i in range(0,maxit):
nextx = fcn(oldx)
FullOrbit.append(nextx)
oldx = nextx
DisplayOrbit = FullOrbit[skip:maxit]

+------+-------+ | iter | orbit | +======+=======+ | 90 | 1/3 | +------+-------+ | 91 | 2/3 | +------+-------+ | 92 | 1/3 | +------+-------+ | 93 | 2/3 | +------+-------+ | 94 | 1/3 | +------+-------+ | 95 | 2/3 | +------+-------+ | 96 | 1/3 | +------+-------+ | 97 | 2/3 | +------+-------+ | 98 | 1/3 | +------+-------+ | 99 | 2/3 | +------+-------+

def OrbitDisplay(fcn,x0,skip=0,maxit=10):
FullOrbit = []
OrbitDisplay = []
var('nextx, oldx')
oldx = x0
for i in range(0,maxit):
nextx = fcn(oldx)
FullOrbit.append(nextx)
oldx = nextx
return FullOrbit[skip:maxit]
fcn(x) = 3*x*(1-x)
fcn2(x) = fcn(fcn(x))

+------+-------------------+ | iter | orbit | +======+===================+ | 40 | 0.641594498760650 | +------+-------------------+ | 41 | 0.641867522278635 | +------+-------------------+ | 42 | 0.642131835724847 | +------+-------------------+ | 43 | 0.642387893032981 | +------+-------------------+ | 44 | 0.642636115649511 | +------+-------------------+