Skip to main content

Solve various integral equations using numerical methods.

Project description

Solve Volterra and Fredholm integral equations

This Python package estimates Volterra and Fredholm integral equations using known techniques.

Volterra

plot generated by package

This package provides the function SolveVolterra which approximates the solution, g(x), to the Volterra Integral Equation of the first kind:

f(s) = \int_a^s K(s,y) g(y) dy

using the method in Betto and Thomas (2021).

See the "Trapezoid and Midpoint Rules" section for a discussion of these two rules.

Parameters

k : function
    The kernel function that takes two arguments.
f : function 
    The left hand side (free) function with f(a) = 0.
a : float
    Lower bound of the integral, defaults to 0.
b : float
    Upper bound of the estimate, defaults to 1.
num : int
    Number of estimation points between zero and `b`.
method : string
    Use either the 'midpoint' (default) or 'trapezoid' rule.

Returns

grid : 2-D array
    Input values are in the first row and output values are in the second row.

Fredholm

Fredholm plot generated by package

This package provides the function SolveFredholm which approximates the solution, g(x), to the Fredholm Integral Equation of the first kind:

f(s) = \int_a^b K(s,y) g(y) dy

using the method described in Twomey (1963). It will return a smooth curve that is an approximate solution. However, it may not be a good approximate to the true solution.

Parameters

k : function
    The kernel function that takes two arguments.
f : function 
    The left hand side (free) function that takes one argument.
a : float
    Lower bound of the of the Fredholm definite integral, defaults to -1.
b : float
    Upper bound of the of the Fredholm definite integral, defaults to 1.
num : int
    Number of estimation points between zero and `b`.
smin : float
    Optional. Lower bound of enforcement values for s.
smax : float
    Optional. Upper bound of enforcement values for s.
snum : int
    Optional. Number of enforcement points for s.

Returns

grid : 2-D array
    Input values are in the first row and output values are in the second row.

Trapezoid and Midpoint Rules

Volterra integral equations are typically solved using the midpoint rule. However, the trapezoid rule often converges faster. See below an example of the trapezoid rule performing well with just six grid points.

example of trapezoid rule converging faster

Thus, the trapezoid rule typically performs better. However, the trapezoid rule is less stable than the midpoint rule. An example where this this instability is an issue is provided below.

example of trapezoid rule having issues

This can be remedied by smoothing the function. For example, with inteq.helpers.smooth().

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inteq-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

inteq-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file inteq-0.2.0.tar.gz.

File metadata

  • Download URL: inteq-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.6

File hashes

Hashes for inteq-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c6d00dd2eb53d4bfb473a38aeca63272f8fe9530a3b408152e4c0d67ddd771b1
MD5 a040d3e6ba1de9bcb490badaf6ef52b4
BLAKE2b-256 9733b8ded3cfb1653b9803a1558cb9528194a32a5bbdfd2a97e429a18d24de7f

See more details on using hashes here.

File details

Details for the file inteq-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: inteq-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.6

File hashes

Hashes for inteq-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86bd212ecb02950d5900cdf7d9c81ad9d3c6950662983a5e8c290675b30ae69a
MD5 7c5bf641c07d4910502f5159412f8cd3
BLAKE2b-256 eb1b127be039595b12ed1e19557042237eca876463cad636fb64c84194fcf140

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page