phd_numerical_schemes_sdes

Numerical schemes to find solutions of SDEs

https://github.com/lmcj-xyz/phd_numerical_schemes_sdes

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary

Keywords

euler-maruyama-scheme numerical-methods probability sde stochastic-differential-equations
Last synced: 6 months ago · JSON representation ·

Repository

Numerical schemes to find solutions of SDEs

Basic Info
  • Host: GitHub
  • Owner: lmcj-xyz
  • License: gpl-3.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 1.22 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
euler-maruyama-scheme numerical-methods probability sde stochastic-differential-equations
Created over 2 years ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

Numerical schemes for SDEs

DOI

Some numerical schemes for SDEs with irregular coefficients.

Work by

These is the implementation of the numerical methods discussed in the following work:

L. M. Chaparro Jáquez, E. Issoglio, and J. Palczewski, ‘Convergence rate of numerical scheme for SDEs with a distributional drift in Besov space’. arXiv, Sep. 20, 2023. doi: 10.48550/arXiv.2309.11396.

Brief theory

We are concerned with the equation

$$ dXt = b(t, Xt) dt + W_t, $$

where $W$ is a Brownian motion, and $b$ is a distribution living in the Hölder-Zygmund space $C_T \mathcal C^{-\beta}(\mathbb R)$ for some $\beta \in (0, 1/2)$. For the numerical methods we consider the drift to be time homogeneous, i.e: $\hat b \in \mathcal C^{-\beta}(\mathbb R)$.

Since the drift coefficient is a distribution the numerical approximation is not trivial and has to be addressed by finding functions which converge to the appropriate distribution. The way we solve this problem by observing we can take functions $C_T \mathcal C^{1 - \beta}$ and compute their generalised derivative and then perform some smoothing procedure on the result of this. Effectively, the approximated solution of the SDE will be the result of performing the Euler-Maruyama method over the SDE

$$ dXt = Ph [\partialx B(t, Xt)] dt + W_t, $$

where $B(t, Xt) \in CT \mathcal C^{1-\beta}$, and $P_h$ is the heat semigroup with variance $h$.

In particular we are interested in some function $B$ with a rough behaviour in an $\mathbb R$, although for practical purposes we want a said function defined on an interval $[-L, L]$. One such function is a single sample path of the well known fractional Brownian motion (fBm) denoted by $B^H$, where $H$ is the so called Hurst parameter. It is known that for $H>0$, the function $B^H(\cdot, x)$ is $\alpha$-Hölder continuos for any $\alpha < H$.

Notice that $Ph \partial_x B^H = ph \ast \partial_x B^H = [\partialx ph] \ast B^H(y)$, so we can compute the approximated distributional drift by finding the derivative of the heat kernel, which is a very smooth function, and then performing the confolution of the result of it with the fBm we generate.

Once the drift is found, we can proceeed by performing the Euler scheme.

Usage

There are three main files here:

  • dsdes.py where all the functions are defined
  • error.py where we can test the functions in the file above
  • plots.py which creates the plots of the paper

If you want to test the numerical methods you could just run the file error.py. The output you will get is the plot of the convergence rate for the Euler-Maruyama scheme.

Using this file I would recommend to just change the parameter beta to whichever parameter you want to explore, recall that in theory $\beta \in (0, 1/2)$, so any results you can get with $\beta$ out of that range are potentially nonsense.

You can also modify the dictionary time_steps in order to have different amounts of time steps or add more approximations, just have the following in mind:

  • The point here is that we need to use the Euler-Maruyama method to approximate the real solution of the SDE because there is not an closed form solution to this SDE, so the first key of the dictionary is real, this corresponds to the amount of time steps we will use to compute our proxy of the real solutions.
  • The following keys are approx1, approx2, etc. This is for the amount of approximations that you want to compute. So if you want an extra approximation you must modify three tuples, namely keys, time_steps and error on lines 21, 23, 26 and then go to line 112 and add an extra computation of error just as they are added there. You can see the example of this below.

Example: Adding an extra approximation

```{python}

Change lines 21, 23 and 26 for the following

keys = ('real', 'approx1', 'approx2', 'approx3', 'approx4', 'approx5', 'approx6') # line 21

timestepstuple = (215, 28, 29, 210, 211, 212, 213, 214) # line 23

error_keys = ('e1', 'e2', 'e3', 'e4', 'e5', 'e6') # line 26

Then go to line 112 and add a new line with the following

strong_error['e6'] = np.abs(solution['real'] - solution['approx6']) # this will be line 113 ```

Those changes should allow you to run the code and get an extra approximation, optionally you can also change the first element from the time_stesp_tuple from 2**15 to 2**16 to have a finer real solution.

Owner

  • Name: Luis Mario Chaparro Jáquez
  • Login: lmcj-xyz
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  Implementation of the Numerical Methods from ''Convergence
  rate of numerical solutions to SDEs with distributional
  drifts in Besov spaces''
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Luis Mario
    family-names: Chaparro Jáquez
    email: mmlmcj@leeds.ac.uk
    affiliation: University of Leeds
    orcid: 'https://orcid.org/0000-0003-3913-4869'
  - given-names: Elena
    family-names: Issoglio
    affiliation: Università degli Studi di Torino
    email: elena.issoglio@unito.it
    orcid: 'https://orcid.org/0000-0003-3035-2712'
  - given-names: Jan
    family-names: Palczewski
    email: J.Palczewski@leeds.ac.uk
    affiliation: University of Leeds
    orcid: 'https://orcid.org/0000-0003-0235-8746'
identifiers:
  - type: doi
    value: 10.5281/zenodo.8239428
    description: The concept DOI of the work.
  - type: url
    value: >-
      https://github.com/lmcj-xyz/PhD_Numerical_Schemes_SDEs/releases/tag/v1.0
    description: The URL of version 1.0 of the software
  - type: url
    value: >-
      https://codeberg.org/lmcj/PhD_Numerical_Schemes_SDEs/releases/tag/v1.0
    description: Alternative URL of version 1.0 of the software
repository-code: 'https://github.com/lmcj-xyz/PhD_Numerical_Schemes_SDEs'
repository: 'https://codeberg.org/lmcj/PhD_Numerical_Schemes_SDEs'
abstract: Numerical methods for SDEs with distributional drift.
keywords:
  - euler-maruyama-scheme
  - numerical-methods
  - probability
  - sde
  - stochastic-differential-equations
license: GPL-3.0
commit: aab1225510805eaebea3e8c7a9cb49c57375525c
version: v1.0
date-released: '2023-08-11'

GitHub Events

Total
  • Push event: 2
Last Year
  • Push event: 2

Dependencies

requirements.txt pypi
  • Babel ==2.12.1
  • Cython ==0.29.34
  • Jinja2 ==3.1.2
  • MarkupSafe ==2.1.2
  • Pillow ==9.5.0
  • PyQt5 ==5.15.9
  • PyQt5-Qt5 ==5.15.2
  • PyQt5-sip ==12.11.1
  • PyQtWebEngine ==5.15.6
  • PyQtWebEngine-Qt5 ==5.15.2
  • PyYAML ==6.0
  • Pygments ==2.15.1
  • QDarkStyle ==3.1
  • QtAwesome ==1.2.3
  • QtPy ==2.3.1
  • Rtree ==1.0.1
  • SecretStorage ==3.3.3
  • Send2Trash ==1.8.0
  • Sphinx ==6.1.3
  • aiofiles ==22.1.0
  • aiosqlite ==0.18.0
  • alabaster ==0.7.13
  • anyio ==3.6.2
  • argon2-cffi ==21.3.0
  • argon2-cffi-bindings ==21.2.0
  • arrow ==1.2.3
  • astroid ==2.15.2
  • asttokens ==2.2.1
  • atomicwrites ==1.4.1
  • attrs ==22.2.0
  • autopep8 ==2.0.2
  • backcall ==0.2.0
  • beautifulsoup4 ==4.12.0
  • binaryornot ==0.4.4
  • black ==23.3.0
  • bleach ==6.0.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • chardet ==5.1.0
  • charset-normalizer ==3.1.0
  • click ==8.1.3
  • cloudpickle ==2.2.1
  • comm ==0.1.3
  • contourpy ==1.0.7
  • cookiecutter ==2.1.1
  • cryptography ==40.0.1
  • cycler ==0.11.0
  • debugpy ==1.6.6
  • decorator ==5.1.1
  • defusedxml ==0.7.1
  • diff-match-patch ==20200713
  • dill ==0.3.6
  • docstring-to-markdown ==0.12
  • docutils ==0.19
  • entrypoints ==0.4
  • executing ==1.2.0
  • fastjsonschema ==2.16.3
  • flake8 ==6.0.0
  • fonttools ==4.39.3
  • fqdn ==1.5.1
  • idna ==3.4
  • imagesize ==1.4.1
  • importlib-metadata ==6.1.0
  • inflection ==0.5.1
  • intervaltree ==3.1.0
  • ipykernel ==6.22.0
  • ipython ==8.13.2
  • ipython-genutils ==0.2.0
  • isoduration ==20.11.0
  • isort ==5.12.0
  • jaraco.classes ==3.2.3
  • jedi ==0.18.2
  • jeepney ==0.8.0
  • jellyfish ==0.11.2
  • jinja2-time ==0.2.0
  • joblib ==1.2.0
  • json5 ==0.9.11
  • jsonpointer ==2.3
  • jsonschema ==4.17.3
  • jupyter-events ==0.6.3
  • jupyter-ydoc ==0.2.3
  • jupyter_client ==7.4.9
  • jupyter_core ==5.3.0
  • jupyter_server ==2.5.0
  • jupyter_server_fileid ==0.8.0
  • jupyter_server_terminals ==0.4.4
  • jupyter_server_ydoc ==0.8.0
  • jupyterlab ==3.6.3
  • jupyterlab-language-pack-es-ES ==3.6.post2
  • jupyterlab-pygments ==0.2.2
  • jupyterlab-vim ==0.16.0
  • jupyterlab_server ==2.22.0
  • keyring ==23.13.1
  • kiwisolver ==1.4.4
  • lazy-object-proxy ==1.9.0
  • matplotlib ==3.7.1
  • matplotlib-inline ==0.1.6
  • mccabe ==0.7.0
  • mistune ==2.0.5
  • more-itertools ==9.1.0
  • mpmath ==1.3.0
  • mypy ==1.4.1
  • mypy-extensions ==1.0.0
  • nbclassic ==0.5.5
  • nbclient ==0.7.3
  • nbconvert ==7.3.0
  • nbformat ==5.8.0
  • nest-asyncio ==1.5.6
  • notebook ==6.5.3
  • notebook_shim ==0.2.2
  • numpy ==1.24.2
  • numpydoc ==1.5.0
  • packaging ==23.0
  • pandas ==2.0.0
  • pandocfilters ==1.5.0
  • parso ==0.8.3
  • pathspec ==0.11.1
  • pexpect ==4.8.0
  • pickleshare ==0.7.5
  • platformdirs ==3.2.0
  • pluggy ==1.0.0
  • prometheus-client ==0.16.0
  • prompt-toolkit ==3.0.38
  • psutil ==5.9.4
  • ptyprocess ==0.7.0
  • pure-eval ==0.2.2
  • pycodestyle ==2.10.0
  • pycparser ==2.21
  • pydocstyle ==6.3.0
  • pyflakes ==3.0.1
  • pylint ==2.17.2
  • pylint-venv ==3.0.1
  • pyls-spyder ==0.4.0
  • pyparsing ==3.0.9
  • pyrsistent ==0.19.3
  • python-dateutil ==2.8.2
  • python-json-logger ==2.0.7
  • python-lsp-black ==1.2.1
  • python-lsp-jsonrpc ==1.0.0
  • python-lsp-server ==1.7.2
  • python-slugify ==8.0.1
  • pytoolconfig ==1.2.5
  • pytz ==2023.3
  • pyxdg ==0.28
  • pyzmq ==25.0.2
  • qstylizer ==0.2.2
  • qtconsole ==5.4.2
  • requests ==2.28.2
  • rfc3339-validator ==0.1.4
  • rfc3986-validator ==0.1.1
  • rope ==1.7.0
  • scikit-learn ==1.2.2
  • scipy ==1.10.1
  • six ==1.16.0
  • sniffio ==1.3.0
  • snowballstemmer ==2.2.0
  • sortedcontainers ==2.4.0
  • soupsieve ==2.4
  • sphinxcontrib-applehelp ==1.0.4
  • sphinxcontrib-devhelp ==1.0.2
  • sphinxcontrib-htmlhelp ==2.0.1
  • sphinxcontrib-jsmath ==1.0.1
  • sphinxcontrib-qthelp ==1.0.3
  • sphinxcontrib-serializinghtml ==1.1.5
  • spyder ==5.4.3
  • spyder-kernels ==2.4.3
  • stack-data ==0.6.2
  • sympy ==1.11.1
  • terminado ==0.17.1
  • text-unidecode ==1.3
  • textdistance ==4.5.0
  • threadpoolctl ==3.1.0
  • three-merge ==0.1.1
  • tinycss2 ==1.2.1
  • toml ==0.10.2
  • tomlkit ==0.11.7
  • tornado ==6.2
  • traitlets ==5.9.0
  • typing_extensions ==4.7.1
  • tzdata ==2023.3
  • ujson ==5.7.0
  • uri-template ==1.2.0
  • urllib3 ==1.26.15
  • watchdog ==3.0.0
  • wcwidth ==0.2.6
  • webcolors ==1.13
  • webencodings ==0.5.1
  • websocket-client ==1.5.1
  • whatthepatch ==1.0.4
  • wrapt ==1.15.0
  • wurlitzer ==3.0.3
  • y-py ==0.5.9
  • yapf ==0.32.0
  • ypy-websocket ==0.8.2
  • zipp ==3.15.0