GSoC 2021 NumFOCUS: Adding Symbolic Integral

This summer I was selected for Google Summer of Code 2021 with NumFOCUS. My project is "Adding Integro Differential Equations and Improving symbolic representation of geometry in PINNs". My mentors for the project are Chris Rackauckas and Kirill Zubov. The community bonding period was spent in deciding the path of the project and starting to add the symbolic integral part.

The blog series is divided into three blogs.

  1. This blog explains about the addition of Symbolic Integral to the ModelingToolkit.jl system

  2. Second Blog : Takes through the numeric evaluation of the integral

  3. Third Blog: Goes through the evaluation of multi dimensional integrals and final addition of the integro-differential equations to the PINNs Solver

For adding support for Integro Differential Equations in NeuralPDE.jl, the first step was to add a symbolic integral in Symbolics.jl

This blog will cover the use of symbolic integral and how the derivative of an integral is handled.

The code and pull request for this feature can be found here

We start by adding a few packages.

using Pkg
Pkg.develop("Symbolics")
Pkg.add("DomainSets")
using Symbolics
using DomainSets

To define a symbolic integral we need two parameters: A symbol for the integrating variable, and the domain on which the integrand will be integrated. We use DomainSets.jl for using the pre defined domains.

@variables x
I = Integral(x in ClosedInterval(1, 5))

We can also define a variable domain

@variables y v(..)
I = Integral(y in ClosedInterval(1, v(x)))

There is also a need to define the derivative of an integral. According to Lebiniz Integral Rule we can express the derivative of integral as:

In order to handle this the expand_derivatives function that expands the existing symbolic differential needed to change. Upon calling expand_derivatives on an expression that contains a derivative of integral, it should change it to the above mentioned expression. We can check this as:

@variables u(..)
D = Differential(x)
I = Integral(y in ClosedInterval(1, v(x)))
eq = D((I(u(x,y)))) ~ 0
expand_derivatives(eq.lhs)

Aside from the integral and inside the integral the functioning of expand_derivatives remains the same. It expands the derivatives inside the integral and outside the integral, once the expression is changed.

eq = D((I(u(x,y)^2))) ~ 0
expand_derivatives(eq.lhs)

Helper functions and features can be added and built around this in coming time.

What's Next?

  • Adding support for Integral in NeuralPDE.jl internal representation

  • Add function for numerical evaluation of the integral

Go to next blog

Runtimes (1)