#Maple code for Lecture 5 #DMB:="Dynamical Models in Biology" by S.P. Ellner and J. Gukenheimer with(LinearAlgebra): Help5:=proc(): print(`RecToSeq(INI,REC,N), GrowthC(INI,REC,K) , GrowthCe(REC)`): print(` LeslieMod(SUR,FER): e.g. LeslieMod([9/10,9/10],[0,1,1]);`): print(` LeslieMat(SUR,FER); e.g. LeslieMat([9/10,9/10],[0,1,1]);`): end: #RecToSeq(INI,REC,N): Inputs two lists of numbers, INI and REC (of the same length, let's call it k) and a positive integer N larger than their length #outputs the list of the first N members of the sequence satisfying the linear recurrence with constants coefficients or order k #f(n)=REC[1]*f(n-1)+...+REC[k]*f(n-k) RecToSeq:=proc(INI,REC,N) local i,k,L,newguy: if not (type(INI,list) and type(REC,list) and nops(INI)=nops(REC) and type(N,integer) and N>=nops(INI)) then print(`bad innput`): RETURN(FAIL): fi: k:=nops(INI): L:=INI: while nops(L)