# CoVID-19 SEIR model implemented in HP 49g+ RPL # input parameters S, E, I, R, alpha, beta, gamma, rho, tmax, and dt # first enter program (<<>>) on the stack, then name (''), then press STO to store program # type program name ('') and then press EVAL to run program # store subroutines first!! << "SEIR model simulation" ":S: :E: :I: :R: :α: :β: :γ: :ρ: :dt: :tmax:" INPUT OBJ-> VARSTOR STEPS 0 'nsteps' RCL 1 - START DS DE DI DR NEXTSEIR NEXT 'S' RCL 'S' ->TAG 'E' RCL 'E' ->TAG 'I' RCL 'I' ->TAG 'R' RCL 'R' ->TAG >> 'SEIRSIM' # store loaded variables << 'tmax' STO 'dt' STO 'ρ' STO 'γ' STO 'β' STO 'α' STO 'R' STO 'I' STO 'E' STO 'S' STO >> 'VARSTOR' # get nsteps from tmax over dt << 'tmax' RCL 'dt' RCL / 'nsteps' STO >> 'STEPS' # calculate dS << 'ρ' RCL 'β' RCL * 'S' RCL 'I' RCL * * 'dt' RCL * NEG 'dS' STO >> 'DS' # calculate dE << 'ρ' RCL 'β' RCL * 'S' RCL 'I' RCL * * 'α' RCL 'E' RCL * - 'dt' RCL * 'dE' STO >> 'DE' # calculate dI << 'α' RCL 'E' RCL * 'γ' RCL 'I' RCL * - 'dt' RCL * 'dI' STO >> 'DI' # calculate dR << 'γ' RCL 'I' RCL * 'dt' RCL * 'dR' STO >> 'DR' # calculate new S, E, I, and R << 'dS' RCL 'S' STO+ 'dE' RCL 'E' STO+ 'dI' RCL 'I' STO+ 'dR' RCL 'R' STO+ >> 'NEXTSEIR'