You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorials/change_independent_variable.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,11 @@ sol = solve(prob, Tsit5())
64
64
plot(sol; idxs = M2.y) # must index by M2.y = y(x); not M1.y = y(t)!
65
65
```
66
66
67
+
!!! tip "Usage tips"
68
+
Look up the documentation of [`change_independent_variable`](@ref) for tips on how to use it.
69
+
70
+
For example, if you also need $t(x)$, you can tell it to add a differential equation for the old independent variable in terms of the new one using the [inverse function rule](https://en.wikipedia.org/wiki/Inverse_function_rule) (here $\mathrm{d}t/\mathrm{d}x = 1 / (\mathrm{d}x/\mathrm{d}t)$). If you know an analytical expression between the independent variables (here $t = x/v$), you can also pass it directly to the function to avoid the extra differential equation.
71
+
67
72
## 2. Alleviating stiffness by changing to logarithmic time
68
73
69
74
In cosmology, the [Friedmann equations](https://en.wikipedia.org/wiki/Friedmann_equations) describe the expansion of the universe.
Transform the independent variable (e.g. ``t``) of the ODE system `sys` to a dependent variable `iv` (e.g. ``u(t)``).
57
57
An equation in `sys` must define the rate of change of the new independent variable (e.g. ``du(t)/dt``).
@@ -63,6 +63,7 @@ This is satisfied if one is a strictly increasing function of the other (e.g. ``
63
63
# Keyword arguments
64
64
65
65
- `dummies`: Whether derivatives of the new independent variable with respect to the old one are expressed through dummy equations or explicitly inserted into the equations.
66
+
- `add_old_diff`: Whether to add a differential equation for the old independent variable in terms of the new one using the inverse function rule.
66
67
- `simplify`: Whether expanded derivative expressions are simplified. This can give a tidier transformation.
67
68
- `fold`: Whether internal substitutions will evaluate numerical expressions.
68
69
Additional keyword arguments `kwargs...` are forwarded to the constructor that rebuilds `sys`.
0 commit comments