#DMB8.txt: Maple Code for Dr. Z.'s Dynamical Models in Biology class, Lecture 8, Sept. 26, 2025 with(linalg): print(`For a list of the Main procedures type: Help8(); for help with a specific procedure type: Help8(ProcedureName); for example Help8(RandomMC);`): print(`For a list of the other procedures type: Help8a(); for help with a specific procedure type: Help8(ProcedureName); for example Help8(RandomMC);`): Help8a:=proc() if nargs=0 then print(`The other procedures are: MakeNicePol, raRF `): else Help6(args): fi: end: Help8:=proc() if nargs=0 then print(`The available procedures are: Orb, SS, SSS `): elif nargs=1 and args[1]=MakeNicePol then print(`MakeNicePol(L,k,x): inputs a set of numbers, outputs a polynoomial having these fixed points. k is parameter you can play with. Try:`): print(`MakeNicePol([1,2,3],7,x);`): elif nargs=1 and args[1]=Orb then print(`Orb(f,x,x0,K1,K2): Given a function f of the variable x, an initial value x(0) finds the portion of the orbit`): print(`of the recurrence a(n+1)= f(a(n)), in other words [a(K1),a(K1+1), ..., a(K2)]. If you want the full orbit take K1=1.`): print(`For example, try:`): print(`Orb(5/2*x*(1-x),x,0.2,1000,1010);`): elif nargs=1 and args[1]=raRF then print(`raRF(x,d): A random rational funcion with numerator and denoominators polynomials of degree d with positive coefficients. Try:`): print(`raRF(x,2):`): elif nargs=1 and args[1]=SS then print(`SS(f,x): Given a function f of x outputs all the fixed points. Try:`): print(`SS(5/2*x*(1-x),x);`): elif nargs=1 and args[1]=SSS then print(`SSS(f,x): inputs a function f of x, outputs all the STABLE steady-states of the associated recurrence a(n+1)=f(a(n)). Try:`): print(`SSS(5/2*x*(1-x),x);`): else print(`There is no Help for`, args): fi: end: #Orb(f,x,x0,K1,K2): Given a function f of the variable x, an initial value x(0) finds the portion of the orbit #of the recurrence a(n+1)= f(a(n)), in other words [a(K1),a(K1+1), ..., a(K2)]. If you want the full orbit take K1=1. #For example, try: #Orb(5/2*x*(1-x),x,0.2,1000,1010); Orb:=proc(f,x,x0,K1,K2) local L,y,i: y:=x0: for i from 1 to K1 do y:=subs(x=y,f): od: L:=[y]: for i from K1+1 to K2 do y:=subs(x=y,f): L:=[op(L),y]: od: L: end: #MakeNicePol(L,k,x): inputs a set of numbers, outputs a polynoomial having these fixed points. k is a parameter. Try: #MakeNicePol([-1,2,3],7,x); MakeNicePol:=proc(L,k,x) local i,a: expand(x*(mul(x-a, a in L)/k+1)): end: #SS(f,x): Given a function f of x outputs all the fixed points. Try: #SS(5/2*x*(1-x),x); SS:=proc(f,x): [solve(x=f,x)]: end: #SSS(f,x): inputs a function f of x, outputs all the STABLE steady-states. Try: #SSS(5/2*x*(1-x),x); SSS:=proc(f,x) local L,f1,LS,i: L:=SS(f,x): f1:=diff(f,x): LS:=[]: for i from 1 to nops(L) do if abs(evalf(subs(x=L[i],f1)))<1 then LS:=[op(LS),L[i]]: fi: od: LS: end: #raRF(x,d): A random rational funcion with numerator and denoominators polynomials of degree d with positive coefficients. Try: #raRF(x,2): raRF:=proc(x,d) local ra,i: ra:=rand(1..10): add(ra()*x^i,i=0..d)/add(ra()*x^i,i=0..d): end: