delierium 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- delierium-1.0.0/LICENSE +21 -0
- delierium-1.0.0/PKG-INFO +253 -0
- delierium-1.0.0/README.md +224 -0
- delierium-1.0.0/pyproject.toml +272 -0
- delierium-1.0.0/pyproject.toml.orig +251 -0
- delierium-1.0.0/src/delierium/__init__.py +83 -0
- delierium-1.0.0/src/delierium/coefficients.py +435 -0
- delierium-1.0.0/src/delierium/derivative_operators.py +165 -0
- delierium-1.0.0/src/delierium/helpers.py +569 -0
- delierium-1.0.0/src/delierium/higher_infinitesimals.py +182 -0
- delierium-1.0.0/src/delierium/infinitesimals.py +966 -0
- delierium-1.0.0/src/delierium/janet_basis.py +1687 -0
- delierium-1.0.0/src/delierium/matrix_order.py +170 -0
- delierium-1.0.0/src/delierium/visualization.py +284 -0
delierium-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 tapir442
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
delierium-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: delierium
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Symmetry Analysis for ODEs and PDEs using SymPy
|
|
5
|
+
Keywords: ODE,PDE,Lie,Symmetry,Janet basis
|
|
6
|
+
Author: tapir
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
|
+
Requires-Dist: gmpy2>=2.3.1
|
|
17
|
+
Requires-Dist: more-itertools>=10
|
|
18
|
+
Requires-Dist: sympy>=1.13
|
|
19
|
+
Requires-Dist: ipython>=8 ; extra == 'jupyter'
|
|
20
|
+
Requires-Dist: matplotlib>=3.8 ; extra == 'plot'
|
|
21
|
+
Requires-Dist: line-profiler>=4 ; extra == 'profile'
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Project-URL: Source, https://github.com/tapir442/delierium
|
|
24
|
+
Project-URL: Issues, https://github.com/tapir442/delierium/issues
|
|
25
|
+
Provides-Extra: jupyter
|
|
26
|
+
Provides-Extra: plot
|
|
27
|
+
Provides-Extra: profile
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# delierium
|
|
31
|
+
<span style="font-size:30px;"><b>D</b>ifferential <b>E</b>quations' <b>LIE</b> symmetries <b>R</b>esearch <b>I</b>nstr<b>UM</b>ent</span>
|
|
32
|
+
|
|
33
|
+
Lie point symmetries of ordinary and partial differential equations with Python and SymPy,
|
|
34
|
+
using Janet bases.
|
|
35
|
+
|
|
36
|
+
# Release 1.0.0
|
|
37
|
+
|
|
38
|
+
Had a hard time debugging and profiling (a Janet base is, after all, a Gröbner base, with all
|
|
39
|
+
its implications during computation), and claude was of great help to find and fix all the
|
|
40
|
+
next-to-last bugs.
|
|
41
|
+
|
|
42
|
+
delierium computes
|
|
43
|
+
|
|
44
|
+
* the **determining equations** of the Lie point symmetries of an ODE, a system of ODEs or a
|
|
45
|
+
scalar PDE,
|
|
46
|
+
* **Janet bases** of linear systems of PDEs, in particular of these determining equations,
|
|
47
|
+
fraction free, with the conditions they assume (factors assumed nonzero, special cases of
|
|
48
|
+
the parameters),
|
|
49
|
+
* from a Janet basis its **rank** (the dimension of the solution space, for determining
|
|
50
|
+
equations the dimension of the Lie algebra of point symmetries), its **parametric** and
|
|
51
|
+
**principal derivatives** and its type,
|
|
52
|
+
* **pictures**: the staircase of a Janet basis, symmetry generators as vector fields with
|
|
53
|
+
solution curves, their flows as animations.
|
|
54
|
+
|
|
55
|
+
A catalogue of about 260 equations with known symmetries from the literature checks it
|
|
56
|
+
(see *Tests*). Solving the determining equations for the infinitesimals themselves is not
|
|
57
|
+
part of this release.
|
|
58
|
+
|
|
59
|
+
# Installation
|
|
60
|
+
|
|
61
|
+
pip install delierium # the package, needs Python 3.12 or newer
|
|
62
|
+
pip install "delierium[plot]" # with matplotlib, for delierium.visualization
|
|
63
|
+
|
|
64
|
+
delierium runs on Python 3.12, 3.13 and 3.14; the whole test suite passes on each of them.
|
|
65
|
+
With uv, choose the version with `--python`, e.g. `uv sync --python 3.12` for the
|
|
66
|
+
environment of the project, or, without touching it,
|
|
67
|
+
|
|
68
|
+
uv run --isolated --python 3.13 --group test pytest
|
|
69
|
+
|
|
70
|
+
From the sources, with [uv](https://docs.astral.sh/uv/):
|
|
71
|
+
|
|
72
|
+
git clone https://github.com/tapir442/delierium.git
|
|
73
|
+
cd delierium
|
|
74
|
+
uv sync # the package and the development tools
|
|
75
|
+
uv sync --group notebooks # also JupyterLab and matplotlib, for the notebooks
|
|
76
|
+
|
|
77
|
+
# How to use
|
|
78
|
+
|
|
79
|
+
### The determining equations of an ODE
|
|
80
|
+
|
|
81
|
+
The Blasius equation `y''' + y y'' = 0`. `lie_derivative_printer` writes them in the notation
|
|
82
|
+
of Lie: `X_xy` is the second derivative of the infinitesimal `X` by `x` and `y`.
|
|
83
|
+
|
|
84
|
+
>>> from sympy import Function, Symbol, diff
|
|
85
|
+
>>> from delierium import lie_derivative_printer, overdetermined_system_ode
|
|
86
|
+
>>> x = Symbol("x")
|
|
87
|
+
>>> y = Function("y")(x)
|
|
88
|
+
>>> ode = diff(y, x, 3) + y * diff(y, x, 2)
|
|
89
|
+
>>> determining = overdetermined_system_ode(ode, [y], [x])
|
|
90
|
+
>>> for e in lie_derivative_printer(determining, [y], [x], output="text"):
|
|
91
|
+
... print(e)
|
|
92
|
+
Y_xx*y + Y_xxx
|
|
93
|
+
-9*X_xy + X_y*y + 3*Y_yy
|
|
94
|
+
-3*X_xyy - X_yy*y + Y_yyy
|
|
95
|
+
-X_xx*y - X_xxx + 3*Y_xxy + 2*Y_xy*y
|
|
96
|
+
-3*X_xxy - 2*X_xy*y + 3*Y_xyy + Y_yy*y
|
|
97
|
+
X_x*y - 3*X_xx + Y + 3*Y_xy
|
|
98
|
+
X_y
|
|
99
|
+
X_yy
|
|
100
|
+
X_yyy
|
|
101
|
+
|
|
102
|
+
In JupyterLab, `lie_derivative_printer` without `output` renders them as formulas, and `ltf`
|
|
103
|
+
does so for a single expression. `overdetermined_system_odes` and `overdetermined_system_pde`
|
|
104
|
+
work the same way for systems of ODEs and for scalar PDEs.
|
|
105
|
+
|
|
106
|
+
### Their Janet basis
|
|
107
|
+
|
|
108
|
+
>>> from delierium import janet_basis_from_ode
|
|
109
|
+
>>> for e in janet_basis_from_ode(ode, y, x):
|
|
110
|
+
... print(e)
|
|
111
|
+
D(X(y(x), x), x) + (1/y(x)) * Y(y(x), x)
|
|
112
|
+
D(X(y(x), x), y(x))
|
|
113
|
+
D(Y(y(x), x), x)
|
|
114
|
+
D(Y(y(x), x), y(x)) + (-1/y(x)) * Y(y(x), x)
|
|
115
|
+
|
|
116
|
+
Every derivative of `X` and `Y` is determined by these four equations, only the values of
|
|
117
|
+
`X` and `Y` themselves are free: the Blasius equation has a two-dimensional Lie algebra of
|
|
118
|
+
point symmetries, `d/dx` and `x d/dx - y d/dy`.
|
|
119
|
+
|
|
120
|
+
### Janet bases of linear systems
|
|
121
|
+
|
|
122
|
+
`JanetBasis` takes a list of linear homogeneous PDEs, the unknown functions and the
|
|
123
|
+
variables (highest first), and optionally a ranking (`Mgrevlex`, the default, `Mgrlex`,
|
|
124
|
+
`Mlex`). Schwarz's system (2.25):
|
|
125
|
+
|
|
126
|
+
>>> from sympy import symbols
|
|
127
|
+
>>> from delierium import JanetBasis
|
|
128
|
+
>>> x, y = symbols("x y")
|
|
129
|
+
>>> z = Function("z")(x, y)
|
|
130
|
+
>>> w = Function("w")(x, y)
|
|
131
|
+
>>> g1 = diff(z, y, y) + diff(z, y) / (2 * y)
|
|
132
|
+
>>> g2 = diff(w, x, x) + 4 * diff(w, y) * y**2 - 8 * y**2 * diff(z, x) - 8 * w * y
|
|
133
|
+
>>> g3 = diff(w, x, y) - diff(z, x, x) / 2 - diff(w, x) / (2 * y) - 6 * y**2 * diff(z, y)
|
|
134
|
+
>>> g4 = diff(w, y, y) - 2 * diff(z, x, y) - diff(w, y) / (2 * y) + w / (2 * y**2)
|
|
135
|
+
>>> janet = JanetBasis([g2, g3, g4, g1], (w, z), (x, y))
|
|
136
|
+
>>> for e in janet.S:
|
|
137
|
+
... print(e)
|
|
138
|
+
D(z(x, y), y)
|
|
139
|
+
D(z(x, y), x) + (1/(2*y)) * w(x, y)
|
|
140
|
+
D(w(x, y), y) + (-1/y) * w(x, y)
|
|
141
|
+
D(w(x, y), x)
|
|
142
|
+
>>> janet.rank()
|
|
143
|
+
2
|
|
144
|
+
>>> print(janet.parametric_derivatives())
|
|
145
|
+
[w(x, y), z(x, y)]
|
|
146
|
+
>>> print(janet.principal_derivatives(1))
|
|
147
|
+
[Derivative(w(x, y), x), Derivative(w(x, y), y), Derivative(z(x, y), x), Derivative(z(x, y), y)]
|
|
148
|
+
|
|
149
|
+
`rank()` is `oo` if there are infinitely many parametric derivatives. `assumed_nonzero()`
|
|
150
|
+
lists the factors the computation divided by: where one of them vanishes, for special
|
|
151
|
+
values of parameters or on singular lines, the Janet basis may differ.
|
|
152
|
+
`parameter_conditions()` gives these special cases of the parameters.
|
|
153
|
+
|
|
154
|
+
### Pictures
|
|
155
|
+
|
|
156
|
+
`delierium.visualization` needs matplotlib (`delierium[plot]`) and is not imported by
|
|
157
|
+
`import delierium`:
|
|
158
|
+
|
|
159
|
+
from delierium.visualization import staircase, vector_fields, ode_solutions, animate_flow
|
|
160
|
+
|
|
161
|
+
staircase(janet) # leading, principal, parametric derivatives
|
|
162
|
+
curves = ode_solutions(ode, y) # solution curves of an ODE
|
|
163
|
+
vector_fields([("1", "0"), ("x", "-y")], symbols("x y"), curves)
|
|
164
|
+
animate_flow(("x", "-y"), symbols("x y"), curves) # in Jupyter: HTML(_.to_jshtml())
|
|
165
|
+
|
|
166
|
+
A generator is a tuple of its components, the independent variables first: `("x", "-y")` is
|
|
167
|
+
`x d/dx - y d/dy`.
|
|
168
|
+
|
|
169
|
+
# The package
|
|
170
|
+
|
|
171
|
+
The public interface is what `delierium` exports; `help(delierium)` lists it:
|
|
172
|
+
|
|
173
|
+
* determining equations: `overdetermined_system_ode`, `overdetermined_system_odes`,
|
|
174
|
+
`overdetermined_system_pde`, `prolongation`, `make_infinitesimal`, `create_infinitesimals`
|
|
175
|
+
* Janet bases: `JanetBasis` (with `rank`, `parametric_derivatives`, `principal_derivatives`,
|
|
176
|
+
`type`, `assumed_nonzero`, `parameter_conditions`, `representation`),
|
|
177
|
+
`janet_basis_from_ode`, `janet_basis_from_odes`, `integrability_conditions`, and checks
|
|
178
|
+
against published bases: `is_janet_basis_of`, `is_janet_basis_of_ode`,
|
|
179
|
+
`is_janet_basis_of_odes`
|
|
180
|
+
* rankings: `Context`, `Mgrevlex`, `Mgrlex`, `Mlex`
|
|
181
|
+
* the notation of Lie: `lie_form`, `ltf`, `lie_derivative_printer`
|
|
182
|
+
* operators: `euler_operator`, `frechet_derivative`, `adjoint_frechet_derivative`,
|
|
183
|
+
`variational_derivative`
|
|
184
|
+
* pictures: the module `delierium.visualization`
|
|
185
|
+
|
|
186
|
+
### Tests and the symmetry catalogue
|
|
187
|
+
|
|
188
|
+
`tests/symmetry_catalog.py` is a catalogue of about 260 ODEs, systems of ODEs and PDEs with
|
|
189
|
+
their known symmetries: Kamke's collection (as classified in Schwarz's Appendix E), the
|
|
190
|
+
examples and exercises of Arrigo, Schwarz, Hydon, Baumann and others, and classical
|
|
191
|
+
equations. For each, the listed generators have to solve the determining equations and the
|
|
192
|
+
rank of their Janet basis has to be the dimension of the symmetry algebra.
|
|
193
|
+
`tests/test_schwarz_examples.py` checks the Janet bases printed in Schwarz's book, coefficients
|
|
194
|
+
included.
|
|
195
|
+
|
|
196
|
+
uv run pytest # the fast tests, including the doctests of this README
|
|
197
|
+
uv run pytest -m slow -n auto # the whole catalogue, about 15 s
|
|
198
|
+
|
|
199
|
+
### Notebooks
|
|
200
|
+
|
|
201
|
+
* `notebooks/Catalogue_template.ipynb`: pick an equation of the catalogue by name; its
|
|
202
|
+
Janet basis and pictures.
|
|
203
|
+
* `notebooks/Arrigo`, `Baumann`, `Schwarz`, `Khare-Timol`: the examples of these books and
|
|
204
|
+
papers, in their order, built the same way.
|
|
205
|
+
* `notebooks/Backlund`: Bäcklund transformations (sine-Gordon, Liouville, Burgers, KdV), and
|
|
206
|
+
the symmetries of their equations.
|
|
207
|
+
|
|
208
|
+
# Open problems
|
|
209
|
+
|
|
210
|
+
Equations delierium cannot handle yet are tests in `tests/test_open_problems.py`, each
|
|
211
|
+
documented in its module docstring: what is asked, what delierium does, why it fails, what
|
|
212
|
+
is known, and ways forward. They are skipped by default; run them with
|
|
213
|
+
|
|
214
|
+
uv run pytest -m too_slow --run-too-slow
|
|
215
|
+
|
|
216
|
+
1. The symmetries of `2 (K(u) u')' + x u' = 0` for an arbitrary `K(u)` (the
|
|
217
|
+
Boltzmann-reduced nonlinear diffusion equation, a group classification problem): the
|
|
218
|
+
Janet basis does not finish, as every differentiation brings in the next derivative of
|
|
219
|
+
`K` as a new generator of the coefficients.
|
|
220
|
+
2. The determining equation of the general second order ODE `u'' = F(x, u, u')` with an
|
|
221
|
+
arbitrary `F`: splitting the symmetry condition fails, as `F` is an arbitrary function of
|
|
222
|
+
the jet variable `u'`.
|
|
223
|
+
3. Kamke 6.171 and 6.219 with symbolic parameters: the Janet basis does not finish in
|
|
224
|
+
reasonable time. The catalogue checks them at random parameter values, which give the
|
|
225
|
+
generic dimension.
|
|
226
|
+
|
|
227
|
+
# Literature
|
|
228
|
+
|
|
229
|
+
* Werner M. Seiler: Involution. The Formal Theory of Differential Equations and its
|
|
230
|
+
Applications in Computer Algebra, Springer Berlin 2010, ISBN 978-3-642-26135-0.
|
|
231
|
+
* Fritz Schwarz: Algorithmic Lie Theory for Solving Ordinary Differential Equations, CRC
|
|
232
|
+
Press 2008, ISBN 978-1-58488-889-5.
|
|
233
|
+
* Fritz Schwarz: Loewy Decomposition of Linear Differential Equations, Springer Wien 2012,
|
|
234
|
+
ISBN 978-3-7091-1687-6.
|
|
235
|
+
* Daniel J. Arrigo: Symmetry Analysis of Differential Equations, Wiley Hoboken/New Jersey
|
|
236
|
+
2015, ISBN 978-1-118-72140-7.
|
|
237
|
+
* Gerd Baumann: Symmetry Analysis of Differential Equations with Mathematica, Springer New
|
|
238
|
+
York Berlin Heidelberg 2000, ISBN 0-387-98552-2.
|
|
239
|
+
* Peter E. Hydon: Symmetry Methods for Differential Equations, Cambridge University Press
|
|
240
|
+
2000.
|
|
241
|
+
* Erich Kamke: Differentialgleichungen. Lösungsmethoden und Lösungen.
|
|
242
|
+
* John Starrett: Solving Differential Equations by Symmetry Groups,
|
|
243
|
+
https://www.researchgate.net/publication/233653257_Solving_Differential_Equations_by_Symmetry_Groups
|
|
244
|
+
* Alexey A. Kasatkin, Aliya A. Gainetdinova: Symbolic and Numerical Methods for Searching
|
|
245
|
+
Symmetries of Ordinary Differential Equations with a Small Parameter and Reducing Its
|
|
246
|
+
Order, https://link.springer.com/chapter/10.1007%2F978-3-030-26831-2_19
|
|
247
|
+
* Vishwas Khare, M. G. Timol: New Algorithm In SageMath To Check Symmetry Of Ode Of First
|
|
248
|
+
Order,
|
|
249
|
+
https://www.researchgate.net/publication/338388495_New_Algorithm_In_SageMath_To_Check_Symmetry_Of_Ode_Of_First_Order
|
|
250
|
+
|
|
251
|
+
# License
|
|
252
|
+
|
|
253
|
+
MIT, see `LICENSE`.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# delierium
|
|
2
|
+
<span style="font-size:30px;"><b>D</b>ifferential <b>E</b>quations' <b>LIE</b> symmetries <b>R</b>esearch <b>I</b>nstr<b>UM</b>ent</span>
|
|
3
|
+
|
|
4
|
+
Lie point symmetries of ordinary and partial differential equations with Python and SymPy,
|
|
5
|
+
using Janet bases.
|
|
6
|
+
|
|
7
|
+
# Release 1.0.0
|
|
8
|
+
|
|
9
|
+
Had a hard time debugging and profiling (a Janet base is, after all, a Gröbner base, with all
|
|
10
|
+
its implications during computation), and claude was of great help to find and fix all the
|
|
11
|
+
next-to-last bugs.
|
|
12
|
+
|
|
13
|
+
delierium computes
|
|
14
|
+
|
|
15
|
+
* the **determining equations** of the Lie point symmetries of an ODE, a system of ODEs or a
|
|
16
|
+
scalar PDE,
|
|
17
|
+
* **Janet bases** of linear systems of PDEs, in particular of these determining equations,
|
|
18
|
+
fraction free, with the conditions they assume (factors assumed nonzero, special cases of
|
|
19
|
+
the parameters),
|
|
20
|
+
* from a Janet basis its **rank** (the dimension of the solution space, for determining
|
|
21
|
+
equations the dimension of the Lie algebra of point symmetries), its **parametric** and
|
|
22
|
+
**principal derivatives** and its type,
|
|
23
|
+
* **pictures**: the staircase of a Janet basis, symmetry generators as vector fields with
|
|
24
|
+
solution curves, their flows as animations.
|
|
25
|
+
|
|
26
|
+
A catalogue of about 260 equations with known symmetries from the literature checks it
|
|
27
|
+
(see *Tests*). Solving the determining equations for the infinitesimals themselves is not
|
|
28
|
+
part of this release.
|
|
29
|
+
|
|
30
|
+
# Installation
|
|
31
|
+
|
|
32
|
+
pip install delierium # the package, needs Python 3.12 or newer
|
|
33
|
+
pip install "delierium[plot]" # with matplotlib, for delierium.visualization
|
|
34
|
+
|
|
35
|
+
delierium runs on Python 3.12, 3.13 and 3.14; the whole test suite passes on each of them.
|
|
36
|
+
With uv, choose the version with `--python`, e.g. `uv sync --python 3.12` for the
|
|
37
|
+
environment of the project, or, without touching it,
|
|
38
|
+
|
|
39
|
+
uv run --isolated --python 3.13 --group test pytest
|
|
40
|
+
|
|
41
|
+
From the sources, with [uv](https://docs.astral.sh/uv/):
|
|
42
|
+
|
|
43
|
+
git clone https://github.com/tapir442/delierium.git
|
|
44
|
+
cd delierium
|
|
45
|
+
uv sync # the package and the development tools
|
|
46
|
+
uv sync --group notebooks # also JupyterLab and matplotlib, for the notebooks
|
|
47
|
+
|
|
48
|
+
# How to use
|
|
49
|
+
|
|
50
|
+
### The determining equations of an ODE
|
|
51
|
+
|
|
52
|
+
The Blasius equation `y''' + y y'' = 0`. `lie_derivative_printer` writes them in the notation
|
|
53
|
+
of Lie: `X_xy` is the second derivative of the infinitesimal `X` by `x` and `y`.
|
|
54
|
+
|
|
55
|
+
>>> from sympy import Function, Symbol, diff
|
|
56
|
+
>>> from delierium import lie_derivative_printer, overdetermined_system_ode
|
|
57
|
+
>>> x = Symbol("x")
|
|
58
|
+
>>> y = Function("y")(x)
|
|
59
|
+
>>> ode = diff(y, x, 3) + y * diff(y, x, 2)
|
|
60
|
+
>>> determining = overdetermined_system_ode(ode, [y], [x])
|
|
61
|
+
>>> for e in lie_derivative_printer(determining, [y], [x], output="text"):
|
|
62
|
+
... print(e)
|
|
63
|
+
Y_xx*y + Y_xxx
|
|
64
|
+
-9*X_xy + X_y*y + 3*Y_yy
|
|
65
|
+
-3*X_xyy - X_yy*y + Y_yyy
|
|
66
|
+
-X_xx*y - X_xxx + 3*Y_xxy + 2*Y_xy*y
|
|
67
|
+
-3*X_xxy - 2*X_xy*y + 3*Y_xyy + Y_yy*y
|
|
68
|
+
X_x*y - 3*X_xx + Y + 3*Y_xy
|
|
69
|
+
X_y
|
|
70
|
+
X_yy
|
|
71
|
+
X_yyy
|
|
72
|
+
|
|
73
|
+
In JupyterLab, `lie_derivative_printer` without `output` renders them as formulas, and `ltf`
|
|
74
|
+
does so for a single expression. `overdetermined_system_odes` and `overdetermined_system_pde`
|
|
75
|
+
work the same way for systems of ODEs and for scalar PDEs.
|
|
76
|
+
|
|
77
|
+
### Their Janet basis
|
|
78
|
+
|
|
79
|
+
>>> from delierium import janet_basis_from_ode
|
|
80
|
+
>>> for e in janet_basis_from_ode(ode, y, x):
|
|
81
|
+
... print(e)
|
|
82
|
+
D(X(y(x), x), x) + (1/y(x)) * Y(y(x), x)
|
|
83
|
+
D(X(y(x), x), y(x))
|
|
84
|
+
D(Y(y(x), x), x)
|
|
85
|
+
D(Y(y(x), x), y(x)) + (-1/y(x)) * Y(y(x), x)
|
|
86
|
+
|
|
87
|
+
Every derivative of `X` and `Y` is determined by these four equations, only the values of
|
|
88
|
+
`X` and `Y` themselves are free: the Blasius equation has a two-dimensional Lie algebra of
|
|
89
|
+
point symmetries, `d/dx` and `x d/dx - y d/dy`.
|
|
90
|
+
|
|
91
|
+
### Janet bases of linear systems
|
|
92
|
+
|
|
93
|
+
`JanetBasis` takes a list of linear homogeneous PDEs, the unknown functions and the
|
|
94
|
+
variables (highest first), and optionally a ranking (`Mgrevlex`, the default, `Mgrlex`,
|
|
95
|
+
`Mlex`). Schwarz's system (2.25):
|
|
96
|
+
|
|
97
|
+
>>> from sympy import symbols
|
|
98
|
+
>>> from delierium import JanetBasis
|
|
99
|
+
>>> x, y = symbols("x y")
|
|
100
|
+
>>> z = Function("z")(x, y)
|
|
101
|
+
>>> w = Function("w")(x, y)
|
|
102
|
+
>>> g1 = diff(z, y, y) + diff(z, y) / (2 * y)
|
|
103
|
+
>>> g2 = diff(w, x, x) + 4 * diff(w, y) * y**2 - 8 * y**2 * diff(z, x) - 8 * w * y
|
|
104
|
+
>>> g3 = diff(w, x, y) - diff(z, x, x) / 2 - diff(w, x) / (2 * y) - 6 * y**2 * diff(z, y)
|
|
105
|
+
>>> g4 = diff(w, y, y) - 2 * diff(z, x, y) - diff(w, y) / (2 * y) + w / (2 * y**2)
|
|
106
|
+
>>> janet = JanetBasis([g2, g3, g4, g1], (w, z), (x, y))
|
|
107
|
+
>>> for e in janet.S:
|
|
108
|
+
... print(e)
|
|
109
|
+
D(z(x, y), y)
|
|
110
|
+
D(z(x, y), x) + (1/(2*y)) * w(x, y)
|
|
111
|
+
D(w(x, y), y) + (-1/y) * w(x, y)
|
|
112
|
+
D(w(x, y), x)
|
|
113
|
+
>>> janet.rank()
|
|
114
|
+
2
|
|
115
|
+
>>> print(janet.parametric_derivatives())
|
|
116
|
+
[w(x, y), z(x, y)]
|
|
117
|
+
>>> print(janet.principal_derivatives(1))
|
|
118
|
+
[Derivative(w(x, y), x), Derivative(w(x, y), y), Derivative(z(x, y), x), Derivative(z(x, y), y)]
|
|
119
|
+
|
|
120
|
+
`rank()` is `oo` if there are infinitely many parametric derivatives. `assumed_nonzero()`
|
|
121
|
+
lists the factors the computation divided by: where one of them vanishes, for special
|
|
122
|
+
values of parameters or on singular lines, the Janet basis may differ.
|
|
123
|
+
`parameter_conditions()` gives these special cases of the parameters.
|
|
124
|
+
|
|
125
|
+
### Pictures
|
|
126
|
+
|
|
127
|
+
`delierium.visualization` needs matplotlib (`delierium[plot]`) and is not imported by
|
|
128
|
+
`import delierium`:
|
|
129
|
+
|
|
130
|
+
from delierium.visualization import staircase, vector_fields, ode_solutions, animate_flow
|
|
131
|
+
|
|
132
|
+
staircase(janet) # leading, principal, parametric derivatives
|
|
133
|
+
curves = ode_solutions(ode, y) # solution curves of an ODE
|
|
134
|
+
vector_fields([("1", "0"), ("x", "-y")], symbols("x y"), curves)
|
|
135
|
+
animate_flow(("x", "-y"), symbols("x y"), curves) # in Jupyter: HTML(_.to_jshtml())
|
|
136
|
+
|
|
137
|
+
A generator is a tuple of its components, the independent variables first: `("x", "-y")` is
|
|
138
|
+
`x d/dx - y d/dy`.
|
|
139
|
+
|
|
140
|
+
# The package
|
|
141
|
+
|
|
142
|
+
The public interface is what `delierium` exports; `help(delierium)` lists it:
|
|
143
|
+
|
|
144
|
+
* determining equations: `overdetermined_system_ode`, `overdetermined_system_odes`,
|
|
145
|
+
`overdetermined_system_pde`, `prolongation`, `make_infinitesimal`, `create_infinitesimals`
|
|
146
|
+
* Janet bases: `JanetBasis` (with `rank`, `parametric_derivatives`, `principal_derivatives`,
|
|
147
|
+
`type`, `assumed_nonzero`, `parameter_conditions`, `representation`),
|
|
148
|
+
`janet_basis_from_ode`, `janet_basis_from_odes`, `integrability_conditions`, and checks
|
|
149
|
+
against published bases: `is_janet_basis_of`, `is_janet_basis_of_ode`,
|
|
150
|
+
`is_janet_basis_of_odes`
|
|
151
|
+
* rankings: `Context`, `Mgrevlex`, `Mgrlex`, `Mlex`
|
|
152
|
+
* the notation of Lie: `lie_form`, `ltf`, `lie_derivative_printer`
|
|
153
|
+
* operators: `euler_operator`, `frechet_derivative`, `adjoint_frechet_derivative`,
|
|
154
|
+
`variational_derivative`
|
|
155
|
+
* pictures: the module `delierium.visualization`
|
|
156
|
+
|
|
157
|
+
### Tests and the symmetry catalogue
|
|
158
|
+
|
|
159
|
+
`tests/symmetry_catalog.py` is a catalogue of about 260 ODEs, systems of ODEs and PDEs with
|
|
160
|
+
their known symmetries: Kamke's collection (as classified in Schwarz's Appendix E), the
|
|
161
|
+
examples and exercises of Arrigo, Schwarz, Hydon, Baumann and others, and classical
|
|
162
|
+
equations. For each, the listed generators have to solve the determining equations and the
|
|
163
|
+
rank of their Janet basis has to be the dimension of the symmetry algebra.
|
|
164
|
+
`tests/test_schwarz_examples.py` checks the Janet bases printed in Schwarz's book, coefficients
|
|
165
|
+
included.
|
|
166
|
+
|
|
167
|
+
uv run pytest # the fast tests, including the doctests of this README
|
|
168
|
+
uv run pytest -m slow -n auto # the whole catalogue, about 15 s
|
|
169
|
+
|
|
170
|
+
### Notebooks
|
|
171
|
+
|
|
172
|
+
* `notebooks/Catalogue_template.ipynb`: pick an equation of the catalogue by name; its
|
|
173
|
+
Janet basis and pictures.
|
|
174
|
+
* `notebooks/Arrigo`, `Baumann`, `Schwarz`, `Khare-Timol`: the examples of these books and
|
|
175
|
+
papers, in their order, built the same way.
|
|
176
|
+
* `notebooks/Backlund`: Bäcklund transformations (sine-Gordon, Liouville, Burgers, KdV), and
|
|
177
|
+
the symmetries of their equations.
|
|
178
|
+
|
|
179
|
+
# Open problems
|
|
180
|
+
|
|
181
|
+
Equations delierium cannot handle yet are tests in `tests/test_open_problems.py`, each
|
|
182
|
+
documented in its module docstring: what is asked, what delierium does, why it fails, what
|
|
183
|
+
is known, and ways forward. They are skipped by default; run them with
|
|
184
|
+
|
|
185
|
+
uv run pytest -m too_slow --run-too-slow
|
|
186
|
+
|
|
187
|
+
1. The symmetries of `2 (K(u) u')' + x u' = 0` for an arbitrary `K(u)` (the
|
|
188
|
+
Boltzmann-reduced nonlinear diffusion equation, a group classification problem): the
|
|
189
|
+
Janet basis does not finish, as every differentiation brings in the next derivative of
|
|
190
|
+
`K` as a new generator of the coefficients.
|
|
191
|
+
2. The determining equation of the general second order ODE `u'' = F(x, u, u')` with an
|
|
192
|
+
arbitrary `F`: splitting the symmetry condition fails, as `F` is an arbitrary function of
|
|
193
|
+
the jet variable `u'`.
|
|
194
|
+
3. Kamke 6.171 and 6.219 with symbolic parameters: the Janet basis does not finish in
|
|
195
|
+
reasonable time. The catalogue checks them at random parameter values, which give the
|
|
196
|
+
generic dimension.
|
|
197
|
+
|
|
198
|
+
# Literature
|
|
199
|
+
|
|
200
|
+
* Werner M. Seiler: Involution. The Formal Theory of Differential Equations and its
|
|
201
|
+
Applications in Computer Algebra, Springer Berlin 2010, ISBN 978-3-642-26135-0.
|
|
202
|
+
* Fritz Schwarz: Algorithmic Lie Theory for Solving Ordinary Differential Equations, CRC
|
|
203
|
+
Press 2008, ISBN 978-1-58488-889-5.
|
|
204
|
+
* Fritz Schwarz: Loewy Decomposition of Linear Differential Equations, Springer Wien 2012,
|
|
205
|
+
ISBN 978-3-7091-1687-6.
|
|
206
|
+
* Daniel J. Arrigo: Symmetry Analysis of Differential Equations, Wiley Hoboken/New Jersey
|
|
207
|
+
2015, ISBN 978-1-118-72140-7.
|
|
208
|
+
* Gerd Baumann: Symmetry Analysis of Differential Equations with Mathematica, Springer New
|
|
209
|
+
York Berlin Heidelberg 2000, ISBN 0-387-98552-2.
|
|
210
|
+
* Peter E. Hydon: Symmetry Methods for Differential Equations, Cambridge University Press
|
|
211
|
+
2000.
|
|
212
|
+
* Erich Kamke: Differentialgleichungen. Lösungsmethoden und Lösungen.
|
|
213
|
+
* John Starrett: Solving Differential Equations by Symmetry Groups,
|
|
214
|
+
https://www.researchgate.net/publication/233653257_Solving_Differential_Equations_by_Symmetry_Groups
|
|
215
|
+
* Alexey A. Kasatkin, Aliya A. Gainetdinova: Symbolic and Numerical Methods for Searching
|
|
216
|
+
Symmetries of Ordinary Differential Equations with a Small Parameter and Reducing Its
|
|
217
|
+
Order, https://link.springer.com/chapter/10.1007%2F978-3-030-26831-2_19
|
|
218
|
+
* Vishwas Khare, M. G. Timol: New Algorithm In SageMath To Check Symmetry Of Ode Of First
|
|
219
|
+
Order,
|
|
220
|
+
https://www.researchgate.net/publication/338388495_New_Algorithm_In_SageMath_To_Check_Symmetry_Of_Ode_Of_First_Order
|
|
221
|
+
|
|
222
|
+
# License
|
|
223
|
+
|
|
224
|
+
MIT, see `LICENSE`.
|