Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector of Wiener processes #355

Open
julianiacoponi opened this issue Jan 12, 2024 · 2 comments
Open

Vector of Wiener processes #355

julianiacoponi opened this issue Jan 12, 2024 · 2 comments
Labels
question User queries

Comments

@julianiacoponi
Copy link

I want to try and use diffrax to simulate some correlated ("directional") noise in a 3D oscillator i.e. solving the following SDEs

image

I couldn’t parse from the docs what kind of solver would treat the noise term as a matrix and the dW term as a vector of Wiener processes, at the same time.

Does diffrax have such a solver / can I build one from what diffrax offers?

@hsimonfroy
Copy link

hsimonfroy commented Jan 19, 2024

Hi!

You could try something like:

drift = lambda t, y, args: F  # F is a jnp array of shape (6)
diffusion = lambda t, y, args: G # G is a jnp array of shape (6,4)
brownian_motion = VirtualBrownianTree(t0, t1, tol=dt/2, shape=(4), key=seed)
terms = MultiTerm(ODETerm(drift), ControlTerm(diffusion, brownian_motion))

It wasn't clear to me, but for a drift function $f$ and a diffusion function $g$, what diffrax actually implements is: $dX = f \odot dt + g \cdot dW$, where $\odot$ is piecewise product and $\cdot$ is a tensor dot product (sum over all the dimensions of dW).

@patrick-kidger
Copy link
Owner

Yup! diffrax.ControlTerm is the way to implement a matrix-valued diffusion with vector-valued noise.

If this is unclear then I'd definitely be happy to consider a PR improving the documentation. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question User queries
Projects
None yet
Development

No branches or pull requests

3 participants