nssvie#

tests build docs pypi pyversions licence

A python package for computing a numerical solution of stochastic Volterra integral equations.

card-img-top
GitHub
card-img-top
PyPi
card-img-top
Theory
card-img-top
API Reference

Overview#

A python package for computing a numerical solution of stochastic Volterra integral equations of the second kind

(1)#\[X_t = f(t) + \int\limits_0^t k_1(s,t) X_s \ ds + \int\limits_0^t k_2(s,t) X_s \ dB_s \qquad t \in [0,T),\]

where

  • \(X_t\) is an unknown process,

  • \(f \in L^2([0,T))\) is a continuous function,

  • \(k_1, \ k_2 \in L^2([0,T) \times [0,T))\) are continuous and square integrable functions,

  • \(B_t\) is the Brownian motion (see Wiener process) and

  • \(\int_0^t k_2(s,t) X_s dB_s\) is the Itô-integral (see Itô calculus)

by a stochastic operational matrix based on block pulse functions as suggested in Maleknejad et. al (2012) 1.

Install#

Install using either of the following two methods.

1. Install from PyPi#

pypi pyversions format

The nssvie package is available on PyPi and can be installed using pip

pip install nssvie

2. Install from Source#

release licence

Install directly from the source code by

git clone https://github.com/dsagolla/nssvie.git
cd nssvie
pip install .

Dependencies#

nssvie uses

  • NumPy for many calculations,

  • SciPy for computing the block pulse coefficients and

  • stochastic for sampling the Brownian Motion

Usage#

Consider the following example of a stochastic Volterra integral equation

\[X_t = 1 + \int\limits_0^t s^2 X_s \ ds + \int\limits_0^t s X_s \ dB_s \qquad t \in [0,T),\]

so \(f \equiv 1\), \(k_1(s,t) = s^2\) and \(k_2(s,t) = s\) in (1).

from nssvie import StochasticVolterraIntegralEquations

# Define the function and the kernels of the stochastic Volterra
# integral equation
def f(t):
        return 1.0

def k1(s,t):
        return s**2

def k2(s,t):
        return s

# Generate the stochastic Volterra integral equation
svie = StochasticVolterraIntegralEquations(
        f=f, kernel_1=k1, kernel_2=k2, T=0.5
)

# Calculate numerical solution with m=50 intervals
svie_solution = svie.solve_method(m=50, solve_method="bpf")

The parameters are

  • f: the function \(f\).

  • kernel_1, kernel_2: the kernels \(k_1\) and \(k_2\).

  • T: the right hand side of \([0,T)\). Default is 1.0.

  • m: the number of intervals to divide \([0,T)\). Default is 50.

  • solve_method: the choosen method based on orthogonal functions. Default is bpf.

for the stochastic Volterra integral equation in (1).

Citation#

1

Maleknejad, K., Khodabin, M., & Rostami, M. (2012). Numerical solution of stochastic Volterra integral equations by a stochastic operational matrix based on block pulse functions. Mathematical and computer Modelling, 55(3-4), 791-800. doi: 10.1016/j.mcm.2011.08.053