RKkit 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.5
2
+ Name: RKkit
3
+ Version: 0.1.0
4
+ Summary: Playing with Runge-Kutta methods
5
+ Project-URL: Homepage, https://github.com/Thierry-Dumont/RKkit
6
+ Project-URL: Issues, https://github.com/Thierry-Dumont/RKkit/issues
7
+ Author-email: Thierry Dumont <tdumont50@math.cnrs.fr>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.13
13
+ Provides-Extra: passagemath
14
+ Requires-Dist: passagemath-categories; extra == 'passagemath'
15
+ Requires-Dist: passagemath-combinat; extra == 'passagemath'
16
+ Requires-Dist: passagemath-environment; extra == 'passagemath'
17
+ Requires-Dist: passagemath-flint; extra == 'passagemath'
18
+ Requires-Dist: passagemath-plot; extra == 'passagemath'
19
+ Requires-Dist: passagemath-singular; extra == 'passagemath'
20
+ Requires-Dist: passagemath-standard; extra == 'passagemath'
21
+ Requires-Dist: passagemath-symbolics; extra == 'passagemath'
22
+ Description-Content-Type: text/markdown
23
+
24
+
25
+
26
+ # Playing with Runge-Kutta methods and SageMath. #
27
+
28
+ ## Installation
29
+
30
+ You can install this package in sage and in passagemath.
31
+
32
+ With sage do:
33
+
34
+ `sage -pip install RKkit`
35
+
36
+ With passagemath:
37
+
38
+ 1- Install passagemath in a virtualenv
39
+
40
+ 2- Once passagemath in installed, activate the virtualenv if necessary
41
+ and then do:
42
+
43
+ `pip install RKkit`
44
+
45
+
46
+
47
+ Then if you clone this repository you can
48
+ run the python scripts in PythonExamples/
49
+ with sage or passagemath/sage and, il you use
50
+ passagemath you can run them with ipython or in a python script.
51
+
52
+ To run the jupyter
53
+ notebooks of Notebooks/ with passagemath/sage you need to install
54
+ jupyter or jupyterlab (using `pip install`).
55
+
56
+ ## Goal of the code:
57
+
58
+ The goal of this code is to verify different properties of a given Runge--Kutta method, defined by it's Butcher array (all the notions used here are defined in the _Bible_, see below).
59
+
60
+ * With SageMath, it is possible to make *exact* computations in some
61
+ useful sets of numbers, and thus we make the hypothesis that the
62
+ coefficients of the methods live in the set of (real) algebraic
63
+ numbers (called *AA* in SageMath); this is not a really restrictive
64
+ hypothesis. But then, the result obtained are *proofs* (if both my
65
+ codes and SageMath are correct!).
66
+
67
+ * To compute the order of a Runge-Kutta method, one use the so called
68
+ _rooted_ _trees_ for which we have a SageMath implementation, coded
69
+ by [Florent
70
+ Hivert](http://doc.sagemath.org/html/en/reference/combinat/sage/combinat/rooted_tree.html).
71
+
72
+ * We also provide a function to compute the Butcher array of a method
73
+ defined by collocation. A classical application is the set of
74
+ Gaussian Runge-Kutta methods.
75
+
76
+ Some sage/jupyter notebooks are provided: they probably provide the
77
+ best way to learn and to test this code.
78
+
79
+ Note that the cost of the computation grows very fast with tne
80
+ number of steps of the method; also, the rooted_tree machinery in
81
+ sage is quite slow.
82
+
83
+ #### References: ####
84
+
85
+ * To learn about Ordinary Differential Equations solvers, you should read the
86
+ _Bible_:
87
+
88
+ 1- Solving Ordinary Differential Equations I, by Hairer, Nørsett,,
89
+ Wanner (HNW),
90
+
91
+ 2- Solving Ordinary Differential Equations II Stiff and Differential-Algebraic
92
+ Problems by Hairer and Wanner (HW),
93
+
94
+ 3- Geometric Numerical Integration by Hairer, Lubich and Wanner (HLW).
95
+
96
+ _If you want to learn and to understand rooted trees and B-series, I
97
+ recommend to start first by reading reference 3. Being the latest
98
+ book, things have become much easier to understand than in reference
99
+ 1._
100
+
101
+ * If you want to learn _SageMath_, you can read the book _Mathematical Computation
102
+ with Sage_ (which now is available in French, English and German), and
103
+ for which freely available pdf files can be [downloaded
104
+ here](https://members.loria.fr/PZimmermann/sagebook/english.html) and
105
+ [there](http://sagebook.gforge.inria.fr/).
106
+
107
+
108
+ ## _Using the code_
109
+
110
+ * __First__, you must define a Runge--Kutta method. To do this you
111
+ must write a (simple) python _class_: have a look at _formulas.py_
112
+ in methods/ to undestand what to do.
113
+
114
+ The class must derive from the "RungeKutta" class and include a
115
+ constructor.
116
+
117
+ The constructor must:
118
+
119
+
120
+ 1- Define the arrays A and B of the Butcher array (the C part is generally
121
+ not necessary).
122
+
123
+ 2- Give a title.
124
+
125
+ 3- Call the base RungeKutta class constructor.
126
+
127
+ Remember that the "formula.py" file in methods/ give examples of such classes.
128
+
129
+ __Be careful:__ The coefficients of A and B *must* be algebraic numbers
130
+ (AA or QQbar) or rational numbers (QQ). This is not absolutely trivial
131
+ since, in sage:
132
+
133
+ 2/3, for example, is directly evaluated as a float (0.66666...). This
134
+ is a Python intrinsic, and cannot be avoided. So as you need to enter
135
+ an algebraic (real) number or a rational, you _must_ write QQ(2/3) or
136
+ AA(2/3) or 2/QQ(3) or 2/AA(3) instead of 2/3. Again, have a look at
137
+ methods/formula.py.
138
+
139
+ Have a look at "GoodAndBad.ipynb": this notebook shows this more in
140
+ details.
141
+
142
+
143
+ * __Then__, the best is to look at the notebook _Example1.ipynb_ and
144
+ adapt it to your needs. For this, launch sage like this:
145
+
146
+ `>sage -n jupyter`
147
+
148
+ or
149
+
150
+ `>sage -n jupyterlab`
151
+
152
+ and then, launch the notebook _Exemple1.ipynb_from Notebooks.
153
+
154
+
155
+
156
+ ## Gaussian formulas (and other methods obtained by collocation) ##
157
+
158
+ Gausian formulae with n steps are obtained by collocation at the roots of the Legendre P polynomials of degree n, shifted from [-1,1] to [0,1].
159
+
160
+ RKcolloc.colloc computes the Butcher arrays, given collocation points
161
+ in [0,1] and returns a Runge-Kutta method class (note that
162
+ collocation points are not necessary Gaussian points).
163
+
164
+ See the notebook _Gaussian.ipynb._
165
+
166
+ For the fun, formulas obtained by collocation at roots of Tchebychev
167
+ polynomials are computed in "Tchebychev.ipynb" (they certainly have
168
+ no interesting application).
169
+
170
+
171
+ ### Notebooks ###
172
+
173
+ All are Sage/Jupyter notebooks. Launch Sage by typing:
174
+
175
+ `sage -n jupyter`
176
+
177
+ or
178
+
179
+ `sage -n jupyterlab`
180
+
181
+ if you use passagemath, you can install jupyter in the virtualenv:
182
+
183
+ `pip install notebook` (once the vitualenv is activated).
184
+
185
+ 1. _Example.ipynb_ : a tour of the system.
186
+
187
+ 2. _Gaussian.ipynb_: construct and test some of the Gauss methods.
188
+
189
+ 3. _AllProperties.ipynb_: show how to compute all possible properties of a method.
190
+
191
+ 4. _Test.ipynb_ : just testing that everything works fine on a set of formulas.
192
+
193
+ 5. _RadauByCollocation.ipynb_ : Radau methods are collocation methods. Play with this.
194
+
195
+ 6. _GoodAndBad.ipynb_ : is supposed to show what to do and what not to
196
+ do when coding a Runge-Kutta formula.
197
+
198
+
199
+ #### Implementation: ####
200
+
201
+ * The code uses a decorator @_persistance to avoid recomputing known properties (which is often expensive).
202
+
203
+ A precedent version was using Sage's
204
+ [@lazy_attribute](http://doc.sagemath.org/html/en/reference/misc/sage/misc/lazy_attribute.html)
205
+ decorator, which could be disturbing.
@@ -0,0 +1,14 @@
1
+ RKkit/README.md,sha256=aS9Rg6g115dKHNwHupiwx1erkboeYxlTFybMMm_WYW8,20
2
+ RKkit/RKExceptions.py,sha256=qKT490ge3FJ6ZRiGUfuBU9J9Xb6oxegWapL-DLoySbU,2184
3
+ RKkit/RKPolutilities.py,sha256=kR4OnYHz0gsIlAlKpoRE6SVzBpLPnQ-GVBeMSmZtKGQ,1458
4
+ RKkit/RKRungeKutta.py,sha256=rsoeD9NyB0vUakwlNGJvK2o_obEQnJ4Lq5toPHCKZC8,1100
5
+ RKkit/RKTrees.py,sha256=t9S3vD1j96VjyO5WRuZmI18iyQNlWL5XMWzQ6pIjiKY,3761
6
+ RKkit/RKcolloc.py,sha256=tbhAO_NinzxUJgA-DaQDRY4f17AwXl-83KIi14TtSuA,2189
7
+ RKkit/RKformula.py,sha256=nEsgoSr4cmJLtAUoIn9TjSEuwQHjLST_WijUtu5XtqI,13867
8
+ RKkit/RKplot.py,sha256=BwO7eEdRYKWuz3YglfqIN5CxbmvkqLO7gZz12bPqB2E,3209
9
+ RKkit/__init__.py,sha256=u87X3NrPWtZKHK4rFTEVJoEBJrNqz-YBSZqW_pvzPys,288
10
+ RKkit/formulas.py,sha256=qYFXT55dmWYTlfVdX9pWxhAc7iKDqLxgLeYEfntfFXM,3124
11
+ rkkit-0.1.0.dist-info/METADATA,sha256=yDsMSzgeLVw9-1f7Dr-x2-YeR5dXyXo8w0anJxzitWU,6881
12
+ rkkit-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
13
+ rkkit-0.1.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
+ rkkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any