# Solving a non-linear P(I)DE - neural field equation

**URL:** https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678
**Category:** Numerics
**Tags:** pde
**Created:** [September 26, 2025, 2:51pm UTC](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678 "2025-09-26T14:51:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jucheval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jucheval/32/213961_2.png) [@jucheval](https://discourse.julialang.org/u/jucheval)
#### Post date: [September 26, 2025, 2:51pm UTC](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678/1 "2025-09-26T14:51:57Z")

</div>

Hi everyone !

I am searching for some way to solve the following non linear P(I)DE, known as the neural field equation:

\frac{\partial}{\partial\_t} u(t,x) = -\alpha u(t,x) + \int w(y,x) f(u(t,y)) dy,

for some scalar \alpha and functions w,f. The parameters I used in the script below are \alpha=1, f(u) = \min(u,1) and w(y,x) = \exp(-|y-x|).

I tried `MethodOfLines.jl` and in particular this [doc](https://docs.sciml.ai/MethodOfLines/dev/tutorials/PIDE/), but did not succeed. Here is the script I tried inspired from the doc.

```julia-auto
using MethodOfLines, ModelingToolkit, DomainSets, OrdinaryDiffEq, Plots

# Parameters of the PDE and initial condition
tmin = 0.0
tmax = 200.0
α = 1.0
f(u) = (u < 1.0) * u + (u >= 1.0) * 1.0
w(y,x) = exp(-abs(y-x))
xmin = -10.0
xmax = 10.0
u_in(x) = 1.0 * (-1.0 < x) * (x < 1.0)

# Parameters, variables, derivatives and integral
@parameters t x y
@variables u(..) integrand(..)
Dt = Differential(t)

Iy = Integral(y in DomainSets.ClosedInterval(xmin, xmax))

eqs = [
    Dt(u(t, x)) + α * u(t, x) ~ Iy(integrand(t, x, y))
    integrand(t, x, y) ~ w(y, x) * f(u(t, y))
]

bcs = [
    u(0, x) ~ u_in(x),
    integrand(0, x, y) ~ w(y, x) * f(u_in(y))
]

domains = [
    t ∈ Interval(tmin, tmax),
    x ∈ Interval(xmin, xmax),
    y ∈ Interval(xmin, xmax)
]

@named pde_system = PDESystem(eqs, bcs, domains, [t, x, y], [u(t, x), integrand(t, x, y)])

# Method of lines discretization
discretization = MOLFiniteDifference([x => 100, y => 100], t)
prob = discretize(pde_system, discretization)

```

At this point, the following error is raised:

```julia-auto
ERROR: AssertionError: There must be the same number of equations and unknowns, got 2 equations and 3 unknowns

```

I don’t understand what “unknowns” means here. I thought it was the number of objects created by `@variables`…

I recently posted this [related topic](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de/132677).

---

<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: [September 26, 2025, 8:04pm UTC](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678/2 "2025-09-26T20:04:15Z")

</div>

Unknowns is the number of dependent variables. You have one too many constraints given the integral condition is both an algebraic equation and a BC. It shouldn’t be repeated. I would think

---

<div class="post-metadata">

### Author: ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)
#### Post date: [September 26, 2025, 9:47pm UTC](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678/4 "2025-09-26T21:47:40Z")

</div>

If you use a Riemann sum for the integral, you can write this as

\frac{du}{dt} = -u + W\cdot S(u)

and it is easy to solve this using DifferentialEquations.jl.

You can also use more precise integration scheme like Simpson.

Actually, for your kernel, Id say that the linear operator has finite rank (2?) and you can find a 2?d ODE equivalent to your NFE.

---

<div class="post-metadata">

### Author: ![jucheval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jucheval/32/213961_2.png) [@jucheval](https://discourse.julialang.org/u/jucheval)
#### Post date: [September 29, 2025, 8:53am UTC](https://discourse.julialang.org/t/solving-a-non-linear-p-i-de-neural-field-equation/132678/5 "2025-09-29T08:53:16Z")

</div>

Thank you both !  
I will have a look at your ideas.
