SciML / DiffEqNoiseProcess.jl

A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
https://docs.sciml.ai/DiffEqNoiseProcess/stable/
Other
63 stars 29 forks source link

Throw an error if a one-dimensional noise process is used on a n-dimensional SDE #155

Closed linusheck closed 1 year ago

linusheck commented 1 year ago

Hi! I fell into a bit of a quirk after making an error and getting incorrect numerical results but not an error message:

Suppose I initialise a Wiener process like this:

WienerProcess(0f0, 0f0)

and then use it to solve a 5-dimensional SDE. The noise will be one-dimensional, I guess it will "scale" the diffusion? So there will be results, but weird ones.

What I would usually mean if I type that is:

WienerProcess(0f0, fill(0f0, 5))

So the noise will happily work but it isn't really what my intention would be - not sure if there is a usecase for the first Wiener process in a 5-dimensional SDE.

ChrisRackauckas commented 1 year ago

and then use it to solve a 5-dimensional SDE. The noise will be one-dimensional, I guess it will "scale" the diffusion? So there will be results, but weird ones.

What I would usually mean if I type that is:

I'm not sure about the subjective terms "weird" and "usually" here. It's a scalar noise SDE. It's a very common model used in lots of applications from mathematical finance to biological systems. It has a specific mention in the tutorial (https://docs.sciml.ai/DiffEqDocs/stable/tutorials/sde_example/#Example-3:-Systems-of-SDEs-with-Scalar-Noise) and much of the literature on SDE solvers specifically handles scalar noise SDEs with specialized methods (for example, Rossler's addresses the case). Our solves then specialize on scalar noise SDEs as well and some methods mention their improved convergence rates for this category of methods (https://docs.sciml.ai/DiffEqDocs/stable/solvers/sde_solve/#Nonstiff-Methods).

linusheck commented 1 year ago

I did not know that! So I just used the wrong type of SDE.