Skip to content

mclements/inteq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  
## Example
## g(s) = \int_0^s (1-g(y)) mu exp(-(beta-alpha)*(s-y)) dy
mu = 0.1 # incidence
beta = 0.2 # mortality from the cancer state
alpha = 0.04 # general mortality
vol1 = volterra_solve2(k = function(s,y) -mu*exp(-(beta-alpha)*(s-y)),
             f = function(s) mu/(beta-alpha)*(1-exp(-s*(beta-alpha))),
             a = 0, b = 10, num = 101L) |>
    transform(target=mu/(mu+beta-alpha)*(1-exp(-(mu+beta-alpha)*sgrid)))
with(vol1, matplot(sgrid, ggrid - target, type="l"))


beta = 0.2
alpha = 0.04
f = sapply(sgrid,
           \(t) # final
               integrate(Vectorize(\(u) mu*exp(-integrate(\(v) rep(beta-alpha,length(v)), u, t)$value)),
                         0, t)$value)

beta = \(v,u) 0.2 + v*0
alpha = \(u) 0.04 + u*0
f = sapply(sgrid,
           \(t) # final
               integrate(Vectorize(\(u) mu*exp(-integrate(\(v) (beta(v,u)-alpha(v)), u, t)$value)),
                         0, t)$value)

About

R package for integral equations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •