# Integro-differential equation and 2nd order differential equation

I’m very new to Julia and want to convert from Python to Julia. I have a system of equations that I want to solve numerically in Julia. The system is

where f(r)=S*exp(-r^2/b^2), S, b and m_π are constants. In Python I used a general-purpose numerical integro-differential equation solver, IDEsolver – but this approach is very slow.
Any suggestions as to how this can be done using DifferentialEquations.jl?
Thanks

I would recommand ApproxFun

2 Likes

I will look into it. How would you use it?

Basically, ApproxFun allows you to represent both the integral and derivative operators as matrices in your equation (see ApproxFun: Operators). Then you can just rearrange your equation into \phi = (\mbox{some operator}) \backslash f.

I’m not sure offhand which function space you should use here, given the 1/r singularity at the origin or the fact that you want to go to r = \infty. The latter would seem to suggest a Laguerre space, but that won’t get rid of the origin singularity. What are your boundary conditions on \phi? (Maybe you can do a change of variables.)

1 Like

Sorry @ChrisRackauckas

I saved you from a technical answer though

On second glance, it’s not that simple, unfortunately, because your equation is nonlinear in \phi.

However, you can linearize it in \phi + \delta\phi, solve the linearized equations for \delta\phi given some \phi, and then perform Newton iterations.

Oh no, this is the right answer. Another answer could be NeuralPDE.jl, here’s a Physics-Informed Neural Network Integro-Differential Equation tutorial:

https://neuralpde.sciml.ai/dev/pinn/integro_diff/

that said, PINNs are a very slow method, especially at lower dimensions. This will be an easy but not efficient way of doing it.

1 Like

Another possible approach:

Given any value of E, you can solve your differential equation to find the corresponding \phi[E]. Conversely, given any \phi(r), you can perform the integral to compute E[\phi]. The combination of these is the fixed-point equation:

E[\phi[\mathcal{E}]] = \mathcal{E}

which is a nonlinear equation in a single variable that can be solved easily by a variety of root-finding algorithms.

The advantage of this is that you don’t need to implement an integro-differential solver directly — you just need an integration code for E[\phi] and a linear-ODE boundary-value solver for \phi[E], and then throw them at a root-finding algorithm.

1 Like

That’s the approach I initially used in Python and it works out. I wanted to solve the same problem using DifferentialEquations.jl but turns out the problem is harder than I thought