Skip to content

Commit 66266e4

Browse files
committed
better comments
1 parent 9aaf04a commit 66266e4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,19 @@ variables and equations, don't add them when they already exist.
337337
338338
Documenting the differences to structural simplification for discrete systems:
339339
340-
In discrete systems the lowest-order term is Shift(t, k)(x(t)), instead of x(t).
341-
We want to substitute the k-1 lowest order terms instead of the k-1 highest order terms.
340+
In discrete systems everything gets shifted forward a timestep by `shift_discrete_system`
341+
in order to properly generate the difference equations.
342+
343+
In the system x(k) ~ x(k-1) + x(k-2), becomes Shift(t, 1)(x(t)) ~ x(t) + Shift(t, -1)(x(t))
344+
345+
The lowest-order term is Shift(t, k)(x(t)), instead of x(t).
346+
As such we actually want dummy variables for the k-1 lowest order terms instead of the k-1 highest order terms.
342347
343-
In the system x(k) ~ x(k-1) + x(k-2), we want to lower
344348
Shift(t, -1)(x(t)) -> x\_{t-1}(t)
349+
350+
Since Shift(t, -1)(x) is not a derivative, it is directly substituted in `fullvars`. No equation or variable is added for it.
351+
352+
For ODESystems D(D(D(x))) in equations is recursively substituted as D(x) ~ x_t, D(x_t) ~ x_tt, etc. The analogue for discrete systems, Shift(t, 1)(Shift(t,1)(Shift(t,1)(Shift(t, -3)(x(t))))) does not actually appear. So `total_sub` in generate_system_equations` is directly initialized with all of the lowered variables `Shift(t, -3)(x) -> x_t-3(t)`, etc.
345353
=#
346354
"""
347355
Generate new derivative variables for the system.

0 commit comments

Comments
 (0)