# NeuralPDE.jl slow with integro diff. equations

**URL:** <https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511>\
**Category:** Machine Learning\
**Tags:** pde, neural-network\
**Created:** [November 11, 2024, 7:05pm UTC](https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511 "2024-11-11T19:05:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nico/32/211667_2.png) [@nico](https://discourse.julialang.org/u/nico)\
**Post date:** [November 11, 2024, 7:05pm UTC](https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511/1 "2024-11-11T19:05:11Z")

</div>

Is there a reason why with integro-differential equations NeuralPDE.jl becomes very slow?  
Is there a better way to deal with integrals than with, e.g.,

```julia
Ii = Symbolics.Integral(t in DomainSets.ClosedInterval(0, t))

```

?

---

<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:** [November 11, 2024, 7:11pm UTC](https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511/2 "2024-11-11T19:11:56Z")

</div>

It’s kind of inherent to the method, though we could make it 100x faster than it currently is. It just needs work.

---

<div class="post-metadata">

**Author:** ![nico](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nico/32/211667_2.png) [@nico](https://discourse.julialang.org/u/nico)\
**Post date:** [November 11, 2024, 7:25pm UTC](https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511/3 "2024-11-11T19:25:20Z")

</div>

Hi Chris, thank you for your time and response.

To clarify, my message wasn’t intended as a complaint. I was simply trying to understand if there is a more efficient way to add or use integrals within the NeuralPDE.jl framework.

Would it be more practical to construct a standard PINN using Lux or Flux and numerically compute the integrals over discrete sampling points, similar to what one woudl have to do in JAX, PyTorch, etc.?

---

<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:** [November 11, 2024, 8:42pm UTC](https://discourse.julialang.org/t/neuralpde-jl-slow-with-integro-diff-equations/122511/4 "2024-11-11T20:42:40Z")

</div>

NeuralPDE.jl just isn’t building it well. If you setup Lux.jl with Gauss points and Reactant you can probably to it a bit faster. Though Integrals.jl works inside of the loss function so you can just use that directly. We just need to update NeuralPDE.jl to use our more modern tooling.
