Skip to content

Commit 3e38927

Browse files
Merge pull request #612 from SciML/add-missing-docstrings
Add missing docstrings for IICommutative, IILevyArea, and improve PCEuler documentation
2 parents 93d28c0 + 3478c14 commit 3e38927

File tree

1 file changed

+114
-17
lines changed

1 file changed

+114
-17
lines changed

src/algorithms.jl

Lines changed: 114 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,74 @@ abstract type StochasticDiffEqJumpDiffusionAdaptiveAlgorithm <: StochasticDiffEq
1818
abstract type StochasticDiffEqJumpNewtonDiffusionAdaptiveAlgorithm{CS,AD,FDT,ST,CJ,Controller} <: StochasticDiffEqJumpDiffusionAdaptiveAlgorithm end
1919

2020
abstract type IteratedIntegralApprox end
21+
22+
"""
23+
IICommutative <: IteratedIntegralApprox
24+
25+
Iterated integral approximation for commutative noise.
26+
27+
This approximation method is used when the noise terms commute, allowing for simplified
28+
computation of iterated stochastic integrals. For commutative noise, only simple stochastic
29+
integrals ∫₀ᵗ dWₛ are needed, and the Lévy area terms vanish.
30+
31+
## When to Use
32+
- When noise terms satisfy the commutativity condition: `g_i * ∂g_j/∂x_i = g_j * ∂g_i/∂x_j`
33+
- For diagonal noise SDEs where cross-terms are zero
34+
- When computational efficiency is more important than handling general non-commutative noise
35+
36+
## Algorithm Properties
37+
- Assumes zero Lévy area (A_ij = 0 for i ≠ j)
38+
- Only computes simple stochastic integrals
39+
- Exact for truly commutative noise structures
40+
41+
!!! warning
42+
If used on a non-commutative noise problem, this will limit the strong convergence to 0.5,
43+
regardless of the chosen solver's theoretical order.
44+
45+
## References
46+
- Kloeden, P.E., Platen, E., "Numerical Solution of Stochastic Differential Equations", Springer (1992)
47+
- Added in PR #459 with the integration of LevyArea.jl package
48+
"""
2149
struct IICommutative <: IteratedIntegralApprox end
50+
51+
"""
52+
IILevyArea <: IteratedIntegralApprox
53+
54+
Iterated integral approximation using full Lévy area calculation.
55+
56+
This method computes the full Lévy area terms for non-commutative noise, including the
57+
double integrals ∫₀ᵗ ∫₀ˢ dWᵤdWₛ required for higher-order methods. Uses the LevyArea.jl
58+
package which automatically selects optimal algorithms based on problem characteristics.
59+
60+
## When to Use
61+
- For general non-commutative noise problems
62+
- When high accuracy is required for methods of strong order > 0.5
63+
- For problems where noise terms do not commute
64+
- With RKMilGeneral and other high-order methods
65+
66+
## Algorithm Properties
67+
- Computes full Lévy area terms A_ij via double stochastic integrals
68+
- Automatically selects optimal algorithm: Fourier(), Milstein(), Wiktorsson(), or MronRoe()
69+
- Selection based on Brownian process dimension and step size
70+
- Required for achieving theoretical convergence rates with non-commutative noise
71+
72+
## Computational Cost
73+
- More expensive than IICommutative due to Lévy area calculations
74+
- Cost scales with the number of Brownian motions
75+
- Optimized algorithm selection minimizes computational overhead
76+
77+
!!! caution
78+
May introduce bias with adaptive time-stepping methods due to the dependency of
79+
random number generation on the step size. Use with fixed-step methods when
80+
maximum accuracy is required.
81+
82+
## References
83+
- Kastner, F. and Rößler, A., "LevyArea.jl: Lévy area simulation in Julia",
84+
Journal of Open Source Software (2023)
85+
- Wiktorsson, M. "Joint characteristic function and simultaneous simulation of
86+
iterated Itô integrals for multiple independent Brownian motions" (2001)
87+
- Implemented via LevyArea.jl package integration (PR #459)
88+
"""
2289
struct IILevyArea <: IteratedIntegralApprox end
2390

2491
################################################################################
@@ -766,23 +833,53 @@ end
766833
"""
767834
PCEuler(ggprime; theta=1/2, eta=1/2)
768835
769-
Predictor Corrector Euler
770-
771-
# Arguments
772-
- `ggprime::Function`:
773-
For scalar problems, `ggprime` ``= b\\partial_x(b)``
774-
For multi-dimensional problems
775-
`bbprime_k` ``= \\sum_{j=1...M, i=1...D} b^(j)_i \\partial_i b^(j)_k``
776-
where ``b^(j)`` correspond to the noise vector due to the j'th noise channel.
777-
If problem is in place - a in place ggprime should be supplied - and
778-
vice versa for not in place speicification of problem.
779-
- `theta::Real`:
780-
Degree of implicitness in the drift term. Set to 0.5 by default.
781-
- `eta::Real`:
782-
Degree of implicitness in the diffusion term. Set to 0.5 by default.
783-
784-
Reference: Stochastics and Dynamics, Vol. 8, No. 3 (2008) 561–581
785-
Note that the original paper has a typo in the definition of ggprime...
836+
**PCEuler: Predictor-Corrector Euler Method (Nonstiff)**
837+
838+
A predictor-corrector variant of the Euler-Maruyama method requiring analytic derivatives
839+
of the diffusion term, with adjustable implicitness parameters for drift-diffusion coupling.
840+
841+
## Method Properties
842+
- **Strong Order**: 0.5 (in the Itô sense)
843+
- **Weak Order**: 1.0
844+
- **Time stepping**: Fixed time step only
845+
- **Noise types**: General noise with available derivative information
846+
- **SDE interpretation**: Itô only
847+
848+
## Parameters
849+
- `ggprime::Function`: The required derivative of the diffusion term
850+
- For scalar problems: `ggprime = g * ∂g/∂x`
851+
- For multi-dimensional problems: `ggprime_k = Σ_{j=1...M, i=1...D} g^(j)_i * ∂g^(j)_k/∂x_i`
852+
- where `g^(j)` corresponds to the noise vector due to the j-th noise channel
853+
- Must match the in-place/out-of-place specification of the problem
854+
- `theta::Real = 0.5`: Degree of implicitness in the drift term (default: 0.5)
855+
- `eta::Real = 0.5`: Degree of implicitness in the diffusion term (default: 0.5)
856+
857+
## When to Use
858+
- Problems requiring specific drift-diffusion coupling
859+
- When analytical ggprime function is available
860+
- Specialized predictor-corrector applications
861+
- When the derivative `g*g'` provides stability or accuracy benefits
862+
863+
## Algorithm Description
864+
The method uses a predictor-corrector approach with the specific requirement of
865+
computing the derivative of the diffusion coefficient. This additional information
866+
allows for improved handling of drift-diffusion interactions through the adjustable
867+
parameters θ and η.
868+
869+
## Limitations
870+
- Requires analytical computation of ggprime (cannot be approximated)
871+
- Fixed time step only (no adaptive versions available)
872+
- Limited to Itô interpretation
873+
874+
## References
875+
- Jentzen, A., Kloeden, P.E., "The numerical approximation of stochastic partial differential equations",
876+
Milan J. Math. 77, 205–244 (2009). https://doi.org/10.1007/s00032-009-0100-0
877+
- Originally introduced in PR #88 (commit 42e2510) by Tatsuhiro Onodera (2018)
878+
879+
!!! warning
880+
The derivative `ggprime` must be computed analytically for correctness.
881+
The original paper contains a typo in the definition of ggprime - this
882+
implementation follows the corrected formulation.
786883
"""
787884
PCEuler(ggprime; theta=1/2, eta=1/2) = PCEuler(theta,eta,ggprime)
788885

0 commit comments

Comments
 (0)