Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dsagolla/nssvie


https://github.com/dsagolla/nssvie

mathematics numerical python sde stochastic stochastic-differential-equations volterra-integral-equations

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

        

nssvie
******

|tests| |build| |docs| |pypi| |pyversions| |licence| |linter|

.. |stochastic-volterra-integral-equation| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/stochastic-volterra-integral-equation.svg
.. |X-t| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/X-t.svg
.. |f| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/f.svg
.. |k-1-k-2| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/k-1-k-2.svg
.. |B-t| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/B-t.svg
.. |ito-integral| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/ito-integral.svg
.. |example-1-eq| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/example-1-eq.svg
.. |example-1-f| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main/docs/source/images/example-1-f.svg
.. |example-1-k-1| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/example-1-k-1.svg
.. |example-1-k-2| image:: https://raw.githubusercontent.com/dsagolla/nssvie/main//docs/source/images/example-1-k-2.svg

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

|stochastic-volterra-integral-equation|

where

+ |X-t| is an unknown process,
+ |f| is a continuous function,
+ |k-1-k-2| are continuous and square integrable functions,
+ |B-t| is the Brownian motion (see `Wiener process `_) and
+ |ito-integral| 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]_.

+ `Documentation `_
+ `API Reference `_
+ `Source Code `_
+ `Bug reports `_

``nssvie`` is distributed under the terms of the `GNU GPLv3 `_ license.

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``

.. code-block:: bash

pip install nssvie

2. Install from Source
~~~~~~~~~~~~~~~~~~~~~~

|release| |licence|

Install directly from the source code by

.. code-block:: bash

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

|example-1-eq|

so

+ |example-1-f| ,
+ |example-1-k-1| and
+ |example-1-k-2|.

.. code-block:: python

from nssvie import SVIE
import matplotlib.pyplot as plt

# 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 = SVIE(
function_f=f, kernel_2=k1, kernel_1=k2, endpoint=0.5
)
# Calculate numerical solution with m=20 intervals
approximative_solution = svie.solve_numerical(
intervals=20
)
fig, ax = plt.subplots()
times = [i * 0.5/20 for i in range(21)]
ax.step(times, approximative_solution, c='k')
plt.show()

.. image:: https://raw.githubusercontent.com/dsagolla/nssvie/main/docs/source/images/example.png
:align: center

The parameters are

+ ``function_f``: the function |f|.
+ ``kernel_1``, ``kernel_2``: the kernels |k-1-k-2|.
+ ``endpoint``: the right hand side of :math:`[0,T)` (default is ``1.0``),
+ ``intervals``: the number of intervals to divide :math:`[0,T)` (default is ``50``)

for the stochastic Volterra integral equation above.

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. |maleknejad-et-al-2012-doi|

.. |licence| image:: https://img.shields.io/github/license/dsagolla/nssvie
:target: https://www.gnu.org/licenses/gpl-3.0.en.html
.. |pypi| image:: https://img.shields.io/pypi/v/nssvie
:target: https://pypi.org/project/nssvie
.. |release| image:: https://img.shields.io/github/v/release/dsagolla/nssvie?display_name=release&sort=semver
:target: https://github.com/dsagolla/nssvie/releases
.. |format| image:: https://img.shields.io/pypi/format/nssvie
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/nssvie
:target: https://www.python.org/
.. |maleknejad-et-al-2012-doi| image:: https://img.shields.io/badge/DOI-10.1016%2Fj.mcm.2011.08.053-blue
:target: https://doi.org/10.1016/j.mcm.2011.08.053
:alt: doi: 10.1016/j.mcm.2011.08.053
.. |docs| image:: https://readthedocs.org/projects/nssvie/badge/?version=latest
:target: https://nssvie.readthedocs.io/en/latest/?badge=latest
.. |build| image:: https://github.com/dsagolla/nssvie/actions/workflows/build.yml/badge.svg
:target: https://github.com/dsagolla/nssvie/actions/workflows/build.yml
.. |tests| image:: https://github.com/dsagolla/nssvie/actions/workflows/tests.yml/badge.svg
:target: https://github.com/dsagolla/nssvie/actions/workflows/tests.yml
.. |linter| image:: https://warehouse-camo.ingress.cmh1.psfhosted.org/d6d741fdb0ae96663fc5e9fbfb16b9ee24d52dfd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e74696e672d70796c696e742d79656c6c6f77677265656e
:target: https://github.com/pylint-dev/pylint