# Tips on integrals using DiffEqOperators

**URL:** <https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769>\
**Category:** New to Julia\
**Created:** [March 8, 2021, 10:54pm UTC](https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769 "2021-03-08T22:54:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdwfrost](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdwfrost/32/2831_2.png) [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Post date:** [March 8, 2021, 10:54pm UTC](https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769/1 "2021-03-08T22:54:22Z")

</div>

I’m trying to use DiffEqOperators to define the Kermack-McKendrick model, which is basically a PDE generalization of the simple SIR epidemiological model:

> **[Kermack–McKendrick theory](https://en.wikipedia.org/wiki/Kermack%E2%80%93McKendrick_theory)**
>
> Kermack–McKendrick theory is a hypothesis that predicts the number and distribution of cases of an infectious disease as it is transmitted through a population over time. Building on the research of Ronald Ross and Hilda Hudson, A. G. McKendrick and W. O. Kermack published their theory in a set of three articles from 1927, 1932, and 1933. While Kermack–McKendrick theory was indeed the source of SIR models and their relatives, Kermack and McKendrick were thinking of a more subtle and empirically ...

The equation for I is a PDE, while that for S and R is an ODE with an integral of I over a at t.

The declarations seem straightforward:

@parameters t a β γ  
@variables S(…) I(…) R(…)  
@derivatives Dt’~t  
@derivatives Da’~a

However, how does one describe integrals over one dimension (in this case, a)?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 8, 2021, 11:11pm UTC](https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769/2 "2021-03-08T23:11:09Z")

</div>

You can’t yet. @zobot is going to start working on it though IIRC. You mean [Feature request: add integro-differential equation support · Issue #572 · SciML/ModelingToolkit.jl · GitHub](https://github.com/SciML/ModelingToolkit.jl/issues/572) right?

---

<div class="post-metadata">

**Author:** ![sdwfrost](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdwfrost/32/2831_2.png) [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Post date:** [March 8, 2021, 11:26pm UTC](https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769/3 "2021-03-08T23:26:33Z")

</div>

Kinda, but not quite. I was hoping to write down something like this for the equations (probably abusing all sorts of notation here):

```julia
@parameters t a β c γ
@variables S(t) i(t,a) R(t)
@derivatives Dt'~t
@derivatives Da'~a
Y(t) = sum(i[t,])
N(t) = S(t)+Y(t)+R(t)

eqs = [Dt(S) ~ -β*c*Y(t)*S,
       Da(i) ~ -γ*i,
       Dt(R) ~ γ*Y]

```

(missing out the boundary conditions and domains right now), to be passed to DiffEqOperators to be solved by the method of lines, along the lines of this:

> **[Europe PMC](https://europepmc.org/article/med/26337289)**
>
> Europe PMC is an archive of life sciences journal literature.

This involves integrating along the spatial dimension rather than the time dimension - the latter is the issue you refer to for integro-differential equation support.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 9, 2021, 12:28am UTC](https://discourse.julialang.org/t/tips-on-integrals-using-diffeqoperators/56769/4 "2021-03-09T00:28:56Z")

</div>

Yeah we can’t handle this in any of the discretizers right now. Lump it into the other requests. We’re getting to it, though a little slower than we hoped.
