Skip to content

Commit 05f1a54

Browse files
update docstring
1 parent c46d4b6 commit 05f1a54

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/systems/diffeqs/basic_transformations.jl

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,38 @@ $(TYPEDSIGNATURES)
44
Generates the Liouville transformed set of ODEs, which is the original
55
ODE system with a new variable `trJ` appended, corresponding to the
66
-tr(Jacobian). This variable is used for properties like uncertainty
7-
propagation and should be used with a zero initial condition.
7+
propagation from a given initial distribution density.
88
9+
For example, if ``u'=p*u`` and `p` follows a probability distribution
10+
``f(p)``, then the probability density of a future value with a given
11+
choice of ``p`` is computed by setting the inital `trJ = f(p)`, and
12+
the final value of `trJ` is the probability of ``u(t)``.
913
14+
Example:
15+
16+
```julia
17+
using ModelingToolkit, OrdinaryDiffEq, Test
18+
19+
@parameters t α β γ δ
20+
@variables x(t) y(t)
21+
@derivatives D'~t
22+
23+
eqs = [D(x) ~ α*x - β*x*y,
24+
D(y) ~ -δ*y + γ*x*y]
25+
26+
sys = ODESystem(eqs)
27+
sys2 = liouville_transform(sys)
28+
@variables trJ
29+
30+
u0 = [x => 1.0,
31+
y => 1.0,
32+
trJ => 1.0]
33+
34+
prob = ODEProblem(sys2,u0,tspan,p)
35+
sol = solve(prob,Tsit5())
36+
```
37+
38+
Where `sol[3,:]` is the evolution of `trJ` over time.
1039
1140
Sources:
1241
@@ -15,8 +44,6 @@ Optimal Transport Approach
1544
1645
Abhishek Halder, Kooktae Lee, and Raktim Bhattacharya
1746
https://abhishekhalder.bitbucket.io/F16ACC2013Final.pdf
18-
19-
2047
"""
2148
function liouville_transform(sys)
2249
t = independent_variable(sys)

0 commit comments

Comments
 (0)