# Can this type of integro-differential equation be solved somewhere?

**URL:** <https://discourse.julialang.org/t/can-this-type-of-integro-differential-equation-be-solved-somewhere/107286>\
**Category:** Modelling & Simulations\
**Tags:** diffeq, differentialequation\
**Created:** [December 7, 2023, 4:05pm UTC](https://discourse.julialang.org/t/can-this-type-of-integro-differential-equation-be-solved-somewhere/107286 "2023-12-07T16:05:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Post date:** [December 7, 2023, 4:05pm UTC](https://discourse.julialang.org/t/can-this-type-of-integro-differential-equation-be-solved-somewhere/107286/1 "2023-12-07T16:05:18Z")

</div>

Hey,

I admit that I am a novice in differential equations solving, this problem came out of completely somthing else…

I want to solve an equation that has the following form :

S(t) = \exp(- H(t))  
\partial H(t) = F(t, S(t), parameters...)

The function F(t) is highly non-linear, but :

- it has jumps at _previously known_ time values t\_1,...t\_n
- between these times values it is continuous (but still non-linear).

I can provide starting values S(0) = 1.

Is this kind of stuff solvable ?

---

<div class="post-metadata">

**Author:** ![jondavis847](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jondavis847](https://discourse.julialang.org/u/jondavis847)\
**Post date:** [December 7, 2023, 8:45pm UTC](https://discourse.julialang.org/t/can-this-type-of-integro-differential-equation-be-solved-somewhere/107286/2 "2023-12-07T20:45:04Z")

</div>

```julia
using DifferentialEquations

function odefunc!(du,u,p,t)
    S = u[1]
    H = u[2]

    dS = exp(-H)
    dH = p * (S - t^2 + S^3) #arbitrary nonlinear function, p is switched at predefined times in callback

    du[1] = dS
    du[2] = dH
    nothing
end

affect!(integrator) = (integrator.p > 0) ? integrator.p = -1 : integrator.p = 1
cb = PresetTimeCallback([2,5],affect!)

S0 = 1
H0 = 2
u0 = [S0,H0]

p = 1.0

prob = ODEProblem(odefunc!,u0,(0,10),p)
sol = solve(prob, callback = cb)

```

```julia
julia> sol.u
26-element Vector{Vector{Float64}}:
 [1.0, 2.0]
 [1.0130247068630718, 2.2164863270563178]
 [1.0360292186508027, 2.779573896877542]
 ⋮
 [4.875245836243441, 65.69652980394312]
 [4.875245836243441, 187.0985129901355]

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/2/6232dc2ed217cb9d40fe3a3f3c2bbe1dfca4020f.png)

---

<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:** [December 10, 2023, 1:01pm UTC](https://discourse.julialang.org/t/can-this-type-of-integro-differential-equation-be-solved-somewhere/107286/3 "2023-12-10T13:01:24Z")

</div>

That’s the jumps part. The other part, using previous values, is just a DDE.
