R Routines
The subfolders in the main folder odepde_R contain the routines from
the two books:
Differential Equation Analysis in Biomedical Science and Engineering
Ordinary Differential Equation Applications with R[1]
designated subsequently as ode_v1 (ode = ordinary differential equations),
and
Differential Equation Analysis in Biomedical Science and Engineering
Partial Differential Equation Applications with R
designated subsequently as pde_v2 (pde = partial differential equations).
[1] R is an open source, general purpose, scientific computing system that
can be donloaded (gratis) from the Internet: http://cran.fhcrc.org/. Also,
the package deSolve can be downloaded for use with the R routines from the
two books. The editor Rstudio is recommended for use in working with the
routines and for facilitating graphical output: http://rstudio.org/.
The following information is basically an index to the routines organized
by chapters as listed next. After this initial listing, the contents of
the chapter folders is indexed.
Also, two other folders are provided pertaining to the solution of PDEs in
pde_v2:
dssRoutines - the dss routines (dss = differentation in space subroutines)
used in Chapters 1-8 of pde_v2 are collected in this single library folder.
The dss routines that are used in particular pde_v2 applications are also
included in the corresponding chapter folders. A complete example application
of several of the dss routines, including a manuscript (documentation) file,
is in the subfolder exampleApplication.
fluxLimiters - the vanLeer, superbee and smart flux limiters for the
numerical solution of first-order hyperbolic PDEs that can accommodate
steep moving fronts and discontinuties in the numerical solutions are
collected in this single folder. A complete example application of
the three flux limiters applied to the linear advection equation, taken
from [1], is in the subfolder exampleApplication.
[1] Griffiths, G.W. and W.E. Schiesser (2012), Traveling Wave Analysis
of Partial Differential Equations, Chapter 2, Elsevier, New York
Chapter titles for ode_1 and pde_2
Differential Equation Analysis in Biomedical Science and Engineering
Ordinary Differential Equation Applications with R
Chapter 1
Introduction to Ordinary Differential Equation Analysis
Bioreactor Dynamics
Chapter 2
Diabetes Glucose Tolerance Test
Chapter 3
Apoptosis (Programmed Cell Death)
Chapter 4
Dynamic Neuron Model
Chapter 5
Stem Cell Differentiation
Chapter 6
Acetylcholine Neurocycle
Chapter 7
Tuberculosis with Differential Infectivity
Chapter 8
Corneal Curvature
Differential Equation Analysis in Biomedical Science and Engineering
Partial Differential Equation Applications with R
Chapter 1
Introduction to Partial Differential Equation Analysis
Chemotaxis
Chapter 2
Pattern Formation
Chapter 3
Belousov-Zhabotinskii Reaction System
Chapter 4
Hodgkin-Huxley and Fitzhugh-Nagumo Models
Chapter 5
Anesthesia Spatiotemporal Distribution
Chapter 6
Influenza with Vaccination and Diffusion
Chapter 7
Drug Release Tracking
Chapter 8
Temperature Distributions in Cryosurgery
Chapter folders in ode_v1
Folder: chap1_ode_v1
bioreactor_lsoda_1.R Listing 1.1. Note the use of deSolve that must be downloaded
(this can be done from http://cran.fhcrc.org/ or with Rstudio
via Packages menu),
#
# Library of R ODE solvers
library("deSolve")
bioreactor_lsoda_2.R Listings 1.2,1.3; note that the directory where the ODE routine
bioreactor_2.R bioreactor_2.R resides must be declared, e.g., in the main
program bioreactor_lsoda_2.R
#
# ODE routine
setwd("c:/R/bme_ode/chap1")
source("bioreactor_2.R")
Also, a forward slash / is used in place of the usual backslash
\ in the setwd (set working directory).
bioreactor_lsoda_3.R
bioreactor_3.R Listing 1.4
bioreactor_lsodes_1.R Listing 1.5
bioreactor_4.R
bioreactor_euler_1.R Listings 1.6a,1.6b
bioreactor_5.R
bioreactor_meuler_1.R Listing 1.7
bioreactor_6.R
bioreactor_meuler_2.R Listing 1.8
bioreactor_7.R
bioreactor_meuler_3.R Listing 1.9
bioreactor_8.R
bioreactor_rkc_1.R Listing 1.10
bioreactor_9.R
bioreactor_rkf45_1.R Listing 1.11
bioreactor_10.R
Folder: chap2_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
glucose_lsoda_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program glucose_lsoda_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap2")
source("glucose_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
glucose_lsoda_1.R Listings 2.1,2.2
glucose_1.R
glucose_RKF45_1.R Listing 2.3
glucose_RKF45_2.R Listings 2.4,2.5,2.6
glucose_2.R
rkf45.R
glucose_rkc4_1.R Classical fourth order Runge Kutta not discussed in Chapter 2,
glucose_2.R but could be useful in the discussion of the glucose model
rkc4.R
Folder: chap3_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
apoptosis_lsoda_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program apoptosis_lsoda_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap3")
source("apoptosis_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
apoptosis_lsoda_1.R Listings 3.1,3.2
apoptosis_1.R
apoptosis_lsoda_1a.R Listing 3.3 (Listing 3.1 with ncase=1,2 variation of IC added)
apoptosis_1.R
apoptosis_lsoda_2.R Listing 3.1 with ncase=1,2 variation in a12 in apoptosis_2.R
apootosis_2.R Listing 3.4 (apoptosis_2.R is used with apoptosis_lsoda_2.R but is
named as an alternative apoptosis_1.R in Listing 3.4 of Chapter 3).
apoptosis_rkf45_1.R Listing 3.5
apoptosis_2a.R Listing 3.6 (rename apoptosis_2a.R to apoptosis_2.R when using with
rkf45.R apoptosis_rkf45_1.R and rkf45.R; apoptosis_2.R and apoptosis_2a.R
are the same except for the one word deletion of "list" in the return
statement of apoptosis_2a.R so that it will run with rkf45.R).
Folder: chap4_ode_v1
Note that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program neuron_euler_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap4")
source("euler.R")
source("neuron_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
neuron_euler_1.R Listing 4.1
neuron_1.R Listing 4.2
euler.R Listing 4.3
neuron_euler_2.R Listings 4.4a,4.4b
neuron_1.R Listing 4.2
euler.R Listing 4.3
neuron_meuler_1.R Listing 4.5
neuron_1.P
meuler.R Listing 4.7
neuron_meuler_2.R
neuron_1.R
meuler.R Listing 4.7
neuron_rkc4_1.R
neuron_1.R
rkc4.R Listing 4.8
neuron_rkf45_1.R Listing 4.6
neuron_1.R
rkf45.R
Folder: chap5_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
stem_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program stem_lsodes_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap5")
source("stem_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
stem_lsodes_1.R Listings 5.1,5.2
stem_1.R
stem_lsodes_2.R Listings 5.3,5.2
stem_1.R
Folder: chap6_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
trans_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program trans_lsodes_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap6")
source("trans_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
trans_lsodes_1.R Listing 6.2
trans_1.R Listing 6.1
trans_lsodes_1a.R Listing 6.3
trans_1.R Listing 6.1
jacob.R Listing 6.4
trans_lsodes_2.R Listing 6.6
trans_2.R Listing 6.5
Folder: chap7_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
tb_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program tb_lsodes_1.R
#
# ODE routine
setwd("c:/R/bme_ode/chap7")
source("tb_1.R")
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
tb_lsodes_1.R Listing 7.2
tb_1.R LIsting 7.1
Folder: chap8_ode_v1
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
corneal_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program corneal_lsodes_1.R
#
# ODE/PDE routines
setwd("c:/R/bme_ode/chap8");
source("corneal_1.R");
source("corneal_2.R");
source("dss006.R");
source("dss046.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
corneal_lsodes_1.R Listing 8.1
corneal_1.R Listing 8.2
corneal_2.R
dss006.R Listing 8.3
dss008.R
dss046.R Listing 8.4
dss048.R
Chapter folders in pde_v2
Folder: chap1_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
chemo_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program chemo_lsodes_1.R
#
# Access functions for numerical, analytical solutions
setwd("c:/R/bme_pde/chap1");
source("chemo_1.R");
source("u1_anal.R");
source("u2_anal.R");
source("dss004.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
chemo_lsodes_1.R Listing 1.1
chemo_1.R Listing 1.2
u1_anal.R Listing 1.3a
u2_anal.R Listing 1.3b
dss004.R
chemo_lsodes_2.R Listing 1.4
chemo_1.R Listing 1.2
u1_anal.R Listing 1.3a
u2_anal.R Listing 1.3b
dss004.R
Folder: chap2_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
p_form_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
program p_form_lsodes_1.R
For subfolder: v_2pde
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap2/v_2pde");
source("p_form_1.R");
source("dss004.R");
source("dss044.R");
For subfolder: v_3pde
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap2/v_3pde");
source("p_form_2.R");
source("pde_terms.R");
source("dss004.R");
source("dss044.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
Subfolder: v_2pde
p_form_lsodes_1.R Listing 2.2
p_form_1.R Listing 2.1
dss004.R
dss044.R
Subfolder: v_3pde
p_form_lsodes_2_n41.R Listing 2.4 (if 41 points in x are used)
p_form_lsodes_2_n51.R Listing 2.4 (if 51 points in x are used)
p_form_2.R Listing 2.3
p_form_2_004-044.R renamed to p_form_2.R if dss004, dss044 are used
p_form_2_006-046.R renamed to p_form_2.R if dss006, dss046 are used
pde_terms.R Listing 2.5
dss004.R
dss044.R
dss006.R
dss046.R
Folder: chap3_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
bz_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
bz_lsodes_1.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap3");
source("bz_1.R");
source("dss004.R");
source("dss044.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
bz_lsodes_1.R Listing 3.2
bz_1.R Listing 3.1
dss004.R
dss044.R
Folder: chap4_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
fhn_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
fhn_lsodes_1.R
#
# Access functions for analytical, numerical solutions
setwd("c:/R/bme_pde/chap4");
source("fhn_1.R");
source("u0_1.R");
source("ua_1.R");
source("uxa_1.R");
source("dss004.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
fhn_lsodes_1.R Listing 4.3
fhn_1.R Listing 4.1
ua_1.R Listing 4.2a
u0_1.R Listing 4.4
uxa_1.R Listing 4.2b
dss004.R
fhn_lsodes_2.R Listing 4.5
fhn_1.R Listing 4.1
dss004.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap5");
source("pharma_1.R");
source("ge.R");
source("vf.R");
source("dss004.R");
source("dss012.R");
source("dss044.R");
Folder: chap5_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
pharma_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
pharma_lsodes_1.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap5");
source("pharma_1.R");
source("ge.R");
source("vf.R");
source("dss004.R");
source("dss012.R");
source("dss044.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
pharma_lsodes_1.R Listing 5.1
pharma_1.R Listing 5.2
ge.R Listing 5.4
vf.R Listing 5.3
ge_main.R Listing 5.5
dss004.R
dss012.R
dss044.R
pharma_lsodes_2.R Listing 5.8
pharma_2.R Listing 5.6
ge.R Listing 5.4
gs.R Listing 5.7
vf.R Listing 5.3
dss004.R
dss012.R
dss044.R
pharma_lsodes_2_color_u1.R pharma_lsodes_2.R with 3D color plotting for u1
pharma_2.R Listing 5.6
ge.R Listing 5.4
gs.R Listing 5.7
vf.R Listing 5.3
dss004.R
dss012.R
dss044.R
pharma_lsodes_2_color_u2.R pharma_lsodes_2.R with 3D color plotting for u2
pharma_2.R Listing 5.6
ge.R Listing 5.4
gs.R Listing 5.7
vf.R Listing 5.3
dss004.R
dss012.R
dss044.R
Folder: chap6_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
flu_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
flu_lsodes_1.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap6");
source("flu_1.R");
source("dss004.R");
source("dss044.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
flu_lsodes_1.R Listing 6.2
flu_1.R Listing 6.1
dss004.R
dss044.R
Folder: chap7_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
drug_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
drug_lsodes_1.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap7");
source("drug_1.R");
source("drug_2.R");
source("f_u.R");
source("g_v.R");
source("dss004.R");
source("dss044.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
drug_lsodes_1.R Listing 7.3
drug_1.R Listing 7.1
f_u.R Listing 7.2
g_v.R Listing 7.2
dss004.R
dss044.R
drug_lsodes_2.R Listing 7.4
drug_2.R Listing 7.5
f_u.R Listing 7.2
g_v.R Listing 7.2
dss004.R
dss044.R
Folder: chap8_pde_v2
Note the use of deSolve in each of the main programs that must be
downloaded (this can be done from http://cran.fhcrc.org/ or with
Rstudio via Packages menu); for example, in the main program
cryo_lsodes_1.R, deSolve is accessed as
#
# Library of R ODE solvers
library("deSolve")
Note also that the directory where the subordinate routines reside
must be declared in each of the main programs, e.g., in the main
cryo_lsodes_1.R
#
# Access functions for numerical solutions
setwd("c:/R/bme_pde/chap8");
source("cryo_1.R");
source("kc.R");
source("Cp.R");
source("Qm.R");
source("dkc.R");
A forward slash / is used in place of the usual backslash \ in the
setwd (set working directory).
cryo_lsodes_1.R Listing 8.6
cryo_1.R Listing 8.1
Cp.R Listing 8.2
kc.R Listing 8.3
dkc.R Listing 8.4
Qm.r Listing 8.5