# D-Algebraic Functions in Macaulay2¶

We here provide the Macaulay2 code of our article for computing with D-algebraic functions. Our implementation requires the package Jets. We also provide the examples from the article.

Notice: Our Macaulay2 code on a Jupyter notebook

• The Macaulay2 Jupyter kernel (v0.6.7) has a quite small TIMEOUT (5 to 10 seconds). That is why we only present examples with small CPU time here. However, one does not encounter this limitation on the terminal.

• The code for composition presented here did not run on Jupyter notebook of the versions 3.9.5 and 3.10.8 of Python on Emacs. This notebook was made with Python 3.8.10 on WSL2 with Ubuntu 20.04.4 installed.

[1]:

-- load the Jets package
needsPackage "Jets"


o1 = Jets

o1 : Package


## Sum of D-algebraic functions¶

We first define the differential ring R. The numbers m and n represent the orders of the input differential polynomials.

[4]:

m = 2;
n = 1;
R = QQ[y_0..y_m, z_0..z_n, w_0, MonomialOrder => Lex];





The next cell contains the command to compute an ADE for the sum of two D-algebraic functions $$f$$ and $$g$$, taking differential polynomials $$P$$ and $$Q$$ with $$P(f)=0$$ and $$Q(g)=0$$ as an input.

[5]:

SumDalg = (P, Q) ->(
T = ideal 0_R; N =0;
I = ideal (P, Q, w_0 - z_0 - y_0);
while  T == ideal 0_R do (
N = N + 1;
J = jets(N, I);
(RingJets,iota) = flattenRing ring(J);
factorialMap = map(RingJets, RingJets,
gens RingJets / ( i-> i => i/(value(substring(1, toString first baseName i)))! ));
F = factorialMap iota J;
R = QQ[y_0..y_(N+m), z_0..z_(N+n), w_0..w_N, MonomialOrder => Lex];
idxList = gens RingJets/(i->(last baseName i)+value((toString first baseName i)_(-1)));
letterList = gens RingJets / (i -> (toString first baseName i)_0);
mapList = apply(letterList, idxList, (i,j) -> value( i | "_" | toString(j)));
phi = map(R, RingJets, mapList);
L = splice(toList (y_0..y_(N+m), z_0..z_(N+n)));
T = eliminate(L,  phi F);
);
return T;
);


For other operations such as taking products or fractions, one can use the same previous fuction and change the ideal $$I$$ with the corresponding generators. In case of non-autonomus differential equations we add a variable $$x_0, x_1$$ and in $$I$$ we add the equation $$x_1 -1$$.

### Example 5.1¶

[11]:

m = 1;
n = 1;
R = QQ[y_0..y_m, z_0..z_n, w_0, MonomialOrder => Lex];
P = y_1^3 + y_0 + 1 ;
Q = z_1^2 - z_0 -1;
SumDalg(P,Q)



2 4       2 3       2 2       2        2         3 4
o11 = ideal (432w w  - 864w w  + 648w w  - 216w w  + 27w  + 432w w w  -
0 2       0 2       0 2       0 2      0       0 1 2
--------------------------------------------------------------------------
3 3         3 2         3          3         2 4         2 3
864w w w  + 648w w w  - 216w w w  + 27w w  - 432w w w  + 864w w w  -
0 1 2       0 1 2       0 1 2      0 1       0 1 2       0 1 2
--------------------------------------------------------------------------
2 2         2          2           3           2
648w w w  + 216w w w  - 27w w  - 288w w w  + 432w w w  - 216w w w  +
0 1 2       0 1 2      0 1       0 1 2       0 1 2       0 1 2
--------------------------------------------------------------------------
4          3          2                         5 4
36w w  + 1728w w  - 3456w w  + 2544w w  - 832w w  + 104w  - 432w w  +
0 1        0 2        0 2        0 2       0 2       0       1 2
--------------------------------------------------------------------------
5 3       5 2       5        5       4 3       4 2       4        4
864w w  - 648w w  + 216w w  - 27w  - 288w w  + 432w w  - 216w w  + 36w  +
1 2       1 2       1 2      1       1 2       1 2       1 2      1
--------------------------------------------------------------------------
3 4        3 3        3 2       3        3       2 4        2 3
864w w  - 1728w w  + 1248w w  - 400w w  + 50w  - 864w w  + 1728w w  -
1 2        1 2        1 2       1 2      1       1 2        1 2
--------------------------------------------------------------------------
2 2       2        2         3         2                         4
1296w w  + 432w w  - 54w  - 576w w  + 864w w  - 432w w  + 72w  + 1728w  -
1 2       1 2      1       1 2       1 2       1 2      1        2
--------------------------------------------------------------------------
3        2                     2 6         2 5         2 3
3456w  + 2496w  - 800w  + 100, 7776w w  - 19440w w  + 29160w w  -
2        2       2             0 2         0 2         0 2
--------------------------------------------------------------------------
2 2        2          2           3 4           3 3           3 2
26730w w  + 9477w w  - 1215w  - 19440w w w  + 38880w w w  - 29160w w w  +
0 2        0 2        0         0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
3            3          2 6           2 5           2 4
9720w w w  - 1215w w  - 7776w w w  + 14256w w w  + 11664w w w  -
0 1 2        0 1        0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
2 3           2 2           2            2            5
39528w w w  + 31266w w w  - 10449w w w  + 1296w w  - 5184w w w  +
0 1 2         0 1 2         0 1 2        0 1        0 1 2
--------------------------------------------------------------------------
4            3             2                                   6
9504w w w  + 6912w w w  - 18144w w w  + 9828w w w  - 1674w w  + 31104w w
0 1 2        0 1 2         0 1 2        0 1 2        0 1         0 2
--------------------------------------------------------------------------
5         4            3            2
- 77760w w  - 864w w  + 117648w w  - 105120w w  + 36504w w  - 4680w  +
0 2       0 2          0 2          0 2         0 2        0
--------------------------------------------------------------------------
5 4         5 3         5 2        5          5        4 5
19440w w  - 38880w w  + 29160w w  - 9720w w  + 1215w  + 5184w w  -
1 2         1 2         1 2        1 2        1        1 2
--------------------------------------------------------------------------
4 4         4 3         4 2         4          4         3 4
11664w w  + 23328w w  - 23976w w  + 10692w w  - 1701w  - 34560w w  +
1 2         1 2         1 2         1 2        1         1 2
--------------------------------------------------------------------------
3 3         3 2         3          3         2 6         2 5
69984w w  - 50976w w  + 16488w w  - 2088w  - 15552w w  + 28512w w  +
1 2         1 2         1 2        1         1 2         1 2
--------------------------------------------------------------------------
2 4         2 3         2 2         2          2           5
23328w w  - 77904w w  + 61140w w  - 20322w w  + 2508w  - 10368w w  +
1 2         1 2         1 2         1 2        1         1 2
--------------------------------------------------------------------------
4           3           2                              6         5
19008w w  + 13824w w  - 36192w w  + 19592w w  - 3340w  + 31104w  - 77760w
1 2         1 2         1 2         1 2        1         2         2
--------------------------------------------------------------------------
4          3          2                        3 5        3 4
- 1728w  + 118656w  - 103320w  + 35100w  - 4500, 3888w w  - 7776w w  +
2          2          2         2              0 2        0 2
--------------------------------------------------------------------------
3 3        3 2       3          2 2 5        2 2 4        2 2 3
5832w w  - 1944w w  + 243w w  - 3888w w w  + 5184w w w  - 1296w w w  -
0 2        0 2       0 2        0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
2 2 2       2 2        2 2        2   5         2   4        2   3
972w w w  + 567w w w  - 81w w  + 3888w w w  - 10368w w w  + 9936w w w  -
0 1 2       0 1 2      0 1        0 1 2         0 1 2        0 1 2
--------------------------------------------------------------------------
2   2       2          2           2 5         2 3         2 2
4212w w w  + 729w w w  - 27w w  + 23328w w  - 58320w w  + 57960w w  -
0 1 2       0 1 2      0 1         0 2         0 2         0 2
--------------------------------------------------------------------------
2          2          4 4          4 3          4 2         4
21582w w  + 2862w  + 2592w w w  - 3888w w w  + 1944w w w  - 324w w w  -
0 2        0        0 1 2        0 1 2        0 1 2       0 1 2
--------------------------------------------------------------------------
3 5           3 4           3 3           3 2           3
3888w w w  + 51840w w w  - 92664w w w  + 66528w w w  - 21735w w w  +
0 1 2         0 1 2         0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
3           2 5           2 4           2 3           2 2
2700w w  - 15552w w w  - 28512w w w  + 91152w w w  - 74376w w w  +
0 1         0 1 2         0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
2            2             5             4            3
25296w w w  - 3156w w  + 15552w w w  - 41472w w w  + 8208w w w  +
0 1 2        0 1         0 1 2         0 1 2        0 1 2
--------------------------------------------------------------------------
2                                    5           4            3
29808w w w  - 20184w w w  + 3712w w  + 46656w w  + 93312w w  - 303264w w
0 1 2         0 1 2        0 1         0 2         0 2          0 2
--------------------------------------------------------------------------
2                             6 3       6 2       6        6
+ 249984w w  - 85836w w  + 11024w  - 648w w  + 972w w  - 486w w  + 81w  -
0 2         0 2         0       1 2       1 2       1 2      1
--------------------------------------------------------------------------
5 4         5 3         5 2         5          5        4 4
44064w w  + 88344w w  - 66852w w  + 22626w w  - 2889w  + 5184w w  -
1 2         1 2         1 2         1 2        1        1 2
--------------------------------------------------------------------------
4 3         4 2         4          4        3 5          3 4
36720w w  + 47448w w  - 22572w w  + 3666w  - 7776w w  + 103680w w  -
1 2         1 2         1 2        1        1 2          1 2
--------------------------------------------------------------------------
3 3          3 2         3          3         2 5         2 4
185328w w  + 128448w w  - 40470w w  + 5060w  - 15552w w  - 77760w w  +
1 2          1 2         1 2        1         1 2         1 2
--------------------------------------------------------------------------
2 3          2 2         2          2           5           4
187488w w  - 144864w w  + 48372w w  - 5996w  + 15552w w  - 41472w w  -
1 2          1 2         1 2        1         1 2         1 2
--------------------------------------------------------------------------
3           2                              5          4          3
23328w w  + 76464w w  - 43284w w  + 7532w  + 31104w  + 124416w  - 326592w
1 2         1 2         1 2        1         2          2          2
--------------------------------------------------------------------------
2                         2 2 5        2 2 4        2 2 3
+ 252576w  - 83400w  + 10600, 3888w w w  - 7776w w w  + 5832w w w  -
2         2               0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
2 2 2       2 2          2   5        2   3        2   2        2
1944w w w  + 243w w w  + 3888w w w  - 9072w w w  + 8748w w w  - 3159w w w
0 1 2       0 1 2        0 1 2        0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
2         2 3       2 2       2        2          4 5           4 4
+ 405w w  + 432w w  - 648w w  + 324w w  - 54w  - 3888w w w  + 12960w w w
0 1       0 2       0 2       0 2      0        0 1 2         0 1 2
--------------------------------------------------------------------------
4 3          4 2          4           4          3 5
- 16200w w w  + 9720w w w  - 2835w w w  + 324w w  - 3888w w w  -
0 1 2        0 1 2        0 1 2       0 1        0 1 2
--------------------------------------------------------------------------
3 4           3 3           3 2          3           3
5184w w w  + 17496w w w  - 13608w w w  + 4293w w w  - 486w w  +
0 1 2         0 1 2         0 1 2        0 1 2       0 1
--------------------------------------------------------------------------
2 5           2 4           2 3         2 2          2           2
15552w w w  - 33696w w w  + 20736w w w  - 792w w w  - 2844w w w  + 648w w
0 1 2         0 1 2         0 1 2       0 1 2        0 1 2       0 1
--------------------------------------------------------------------------
5             3             2
+ 15552w w w  - 36720w w w  + 34128w w w  - 11880w w w  + 1488w w  +
0 1 2         0 1 2         0 1 2         0 1 2        0 1
--------------------------------------------------------------------------
3          2                           6 4         6 3        6 2
1728w w  - 2592w w  + 1248w w  - 208w  - 5184w w  + 10368w w  - 7776w w  +
0 2        0 2        0 2       0        1 2         1 2        1 2
--------------------------------------------------------------------------
6         6        5 4        5 3        5 2        5         5
2592w w  - 324w  + 2592w w  - 7992w w  + 8100w w  - 3402w w  + 513w  -
1 2       1        1 2        1 2        1 2        1 2       1
--------------------------------------------------------------------------
4 5         4 4         4 3         4 2        4         4        3 5
7776w w  + 25920w w  - 30240w w  + 16056w w  - 4098w w  + 438w  - 7776w w
1 2         1 2         1 2         1 2        1 2       1        1 2
--------------------------------------------------------------------------
3 4         3 3         3 2        3         3         2 5
- 10368w w  + 34992w w  - 26640w w  + 8178w w  - 888w  + 15552w w  -
1 2         1 2         1 2        1 2       1         1 2
--------------------------------------------------------------------------
2 4         2 3        2 2        2          2           5
36288w w  + 18144w w  + 6192w w  - 6612w w  + 1288w  + 15552w w  -
1 2         1 2        1 2        1 2        1         1 2
--------------------------------------------------------------------------
3           2                             3        2
37152w w  + 33264w w  - 11124w w  + 1356w  + 1728w  - 2592w  + 1200w  -
1 2         1 2         1 2        1        2        2        2
--------------------------------------------------------------------------
3 3       3 2       3        3       2 3 3       2 3 2
200, 216w w  - 324w w  + 162w w  - 27w  + 216w w w  - 324w w w  +
0 2       0 2       0 2      0       0 1 2       0 1 2
--------------------------------------------------------------------------
2 3        2 3       2 2 3       2 2 2       2 2        2 2
162w w w  - 27w w  - 432w w w  + 648w w w  - 324w w w  + 54w w  -
0 1 2      0 1       0 1 2       0 1 2       0 1 2      0 1
--------------------------------------------------------------------------
2   2       2          2          2 3        2 2       2         2
144w w w  + 144w w w  - 36w w  + 1296w w  - 1944w w  + 948w w  - 158w  -
0 1 2       0 1 2      0 1        0 2        0 2       0 2       0
--------------------------------------------------------------------------
5 3         5 2         5          5         4 3         4 2
432w w w  + 648w w w  - 324w w w  + 54w w  + 216w w w  - 468w w w  +
0 1 2       0 1 2       0 1 2      0 1       0 1 2       0 1 2
--------------------------------------------------------------------------
4          4         3 3          3 2         3          3
306w w w  - 63w w  + 864w w w  - 1152w w w  + 480w w w  - 68w w  -
0 1 2      0 1       0 1 2        0 1 2       0 1 2      0 1
--------------------------------------------------------------------------
2 3          2 2          2           2           2
1728w w w  + 2592w w w  - 1272w w w  + 212w w  - 576w w w  + 576w w w  -
0 1 2        0 1 2        0 1 2       0 1       0 1 2       0 1 2
--------------------------------------------------------------------------
3          2                          7 3       7 2
144w w  + 2592w w  - 3888w w  + 1848w w  - 308w  + 216w w  - 324w w  +
0 1        0 2        0 2        0 2       0       1 2       1 2
--------------------------------------------------------------------------
7        7       6 2       6        6       5 3        5 2       5
162w w  - 27w  + 144w w  - 144w w  + 36w  - 864w w  + 1296w w  - 624w w  +
1 2      1       1 2       1 2      1       1 2        1 2       1 2
--------------------------------------------------------------------------
5       4 3       4 2       4         4       3 3        3 2       3
104w  + 432w w  - 936w w  + 612w w  - 126w  + 864w w  - 1008w w  + 312w w
1       1 2       1 2       1 2       1       1 2        1 2       1 2
--------------------------------------------------------------------------
3        2 3        2 2        2         2         2
- 28w  - 1728w w  + 2592w w  - 1248w w  + 208w  - 576w w  + 576w w  -
1        1 2        1 2        1 2       1       1 2       1 2
--------------------------------------------------------------------------
3        2                        3 6           3 5
144w  + 1728w  - 2592w  + 1200w  - 200, 7776w w w  - 19440w w w  +
1        2        2        2             0 1 2         0 1 2
--------------------------------------------------------------------------
3 4          3 3          3 2         3            2 5
19440w w w  - 9720w w w  + 2430w w w  - 243w w w  + 5184w w w  -
0 1 2        0 1 2        0 1 2       0 1 2        0 1 2
--------------------------------------------------------------------------
2 4           2 3          2 2         2          2           4
11664w w w  + 10368w w w  - 4536w w w  + 972w w w  - 81w w  + 864w w w  -
0 1 2         0 1 2        0 1 2       0 1 2      0 1       0 1 2
--------------------------------------------------------------------------
3            2                             5 6         5 5
1728w w w  + 1296w w w  - 432w w w  + 54w w  - 7776w w  + 19440w w  -
0 1 2        0 1 2       0 1 2      0 1        1 2         1 2
--------------------------------------------------------------------------
5 4        5 3        5 2       5           4 5         4 4
19440w w  + 9720w w  - 2430w w  + 243w w  - 10368w w  + 22032w w  -
1 2        1 2        1 2       1 2         1 2         1 2
--------------------------------------------------------------------------
4 3        4 2        4        4         3 6         3 5         3 4
18144w w  + 7128w w  - 1296w w  + 81w  + 15552w w  - 38880w w  + 33696w w
1 2        1 2        1 2      1         1 2         1 2         1 2
--------------------------------------------------------------------------
3 3       3 2        3         3         2 5         2 4
- 10656w w  - 684w w  + 1062w w  - 162w  + 10368w w  - 23328w w  +
1 2       1 2        1 2       1         1 2         1 2
--------------------------------------------------------------------------
2 3        2 2        2        2          4          3          2
19584w w  - 7680w w  + 1368w w  - 78w  + 1728w w  - 3456w w  + 2496w w  -
1 2        1 2        1 2      1        1 2        1 2        1 2
--------------------------------------------------------------------------
2 8           2 7           2 6           2 5
800w w  + 100w , 15552w w w  - 46656w w w  + 58320w w w  - 38880w w w  +
1 2       1        0 1 2         0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
2 4          2 3         2 2             7             6
14580w w w  - 2916w w w  + 243w w w  + 10368w w w  - 28512w w w  +
0 1 2        0 1 2       0 1 2         0 1 2         0 1 2
--------------------------------------------------------------------------
5             4            3            2                     6
32400w w w  - 19440w w w  + 6480w w w  - 1134w w w  + 81w w w  + 1728w w
0 1 2         0 1 2        0 1 2        0 1 2      0 1 2        0 2
--------------------------------------------------------------------------
5          4          3         2                  4 8
- 4320w w  + 4320w w  - 2160w w  + 540w w  - 54w w  - 15552w w  +
0 2        0 2        0 2       0 2      0 2         1 2
--------------------------------------------------------------------------
4 7         4 6         4 5         4 4        4 3       4 2
46656w w  - 58320w w  + 38880w w  - 14580w w  + 2916w w  - 243w w  -
1 2         1 2         1 2         1 2        1 2       1 2
--------------------------------------------------------------------------
3 7         3 6         3 5         3 4        3 3        3 2
20736w w  + 54432w w  - 58320w w  + 32400w w  - 9720w w  + 1458w w  -
1 2         1 2         1 2         1 2        1 2        1 2
--------------------------------------------------------------------------
3           2 8         2 7          2 6         2 5        2 4
81w w  + 31104w w  - 93312w w  + 106272w w  - 55008w w  + 9288w w  +
1 2         1 2         1 2          1 2         1 2        1 2
--------------------------------------------------------------------------
2 3        2 2       2             7           6           5
2808w w  - 1386w w  + 162w w  + 20736w w  - 57024w w  + 62496w w  -
1 2        1 2       1 2         1 2         1 2         1 2
--------------------------------------------------------------------------
4           3          2                 6        5        4
34944w w  + 10416w w  - 1524w w  + 78w w  + 3456w  - 8640w  + 8448w  -
1 2         1 2        1 2      1 2        2        2        2
--------------------------------------------------------------------------
3        2              2   3       2   2       2          2
4096w  + 1000w  - 100w , 648w w w  - 972w w w  + 486w w w  - 81w w  +
2        2       2      0 1 2       0 1 2       0 1 2      0 1
--------------------------------------------------------------------------
2 3       2 2       2        2          5 5          5 4          5 3
432w w  - 648w w  + 324w w  - 54w  - 3888w w w  + 7776w w w  - 5832w w w
0 2       0 2       0 2      0        0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
5 2         5            4 5          4 4         4 3
+ 1944w w w  - 243w w w  - 3888w w w  + 5184w w w  - 648w w w  -
0 1 2       0 1 2        0 1 2        0 1 2       0 1 2
--------------------------------------------------------------------------
4 2          4           4          3 4          3 3          3 2
1944w w w  + 1053w w w  - 162w w  - 2592w w w  + 3888w w w  - 1944w w w  +
0 1 2        0 1 2       0 1        0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
3           2 3         2 2         2              3            2
324w w w  - 864w w w  + 864w w w  - 216w w w  + 2592w w w  - 4176w w w  +
0 1 2       0 1 2       0 1 2       0 1 2        0 1 2        0 1 2
--------------------------------------------------------------------------
3          2                           7 5
2160w w w  - 384w w  + 1728w w  - 2592w w  + 1248w w  - 208w  + 3888w w  -
0 1 2       0 1        0 2        0 2        0 2       0        1 2
--------------------------------------------------------------------------
7 4        7 3        7 2       7          6 5        6 4        6 3
7776w w  + 5832w w  - 1944w w  + 243w w  + 3888w w  - 2592w w  - 3240w w
1 2        1 2        1 2       1 2        1 2        1 2        1 2
--------------------------------------------------------------------------
6 2        6         6        5 5         5 4         5 3
+ 3888w w  - 1377w w  + 162w  - 7776w w  + 20736w w  - 17928w w  +
1 2        1 2       1        1 2         1 2         1 2
--------------------------------------------------------------------------
5 2       5         5        4 5         4 4        4 3        4 2
5868w w  - 288w w  - 135w  - 7776w w  + 10368w w  + 1296w w  - 6696w w  +
1 2       1 2       1        1 2         1 2        1 2        1 2
--------------------------------------------------------------------------
4         4        3 4        3 3        3 2       3        3
3138w w  - 462w  - 5184w w  + 7776w w  - 3312w w  + 240w w  + 84w  -
1 2       1        1 2        1 2        1 2       1 2      1
--------------------------------------------------------------------------
2 3        2 2       2       2          3          2
1728w w  + 1728w w  - 384w w  - 8w  + 2592w w  - 4464w w  + 2376w w  -
1 2        1 2       1 2     1        1 2        1 2        1 2
--------------------------------------------------------------------------
3        2
444w  + 1728w  - 2592w  + 1200w  - 200)
1        2        2        2

o11 : Ideal of R


### Reciprocal of D-algebraic functions¶

[12]:

InvDalg = (P) ->(
T = ideal 0_R; N =0;
I = ideal (P, w_0 *y_0 - 1 );
while  T == ideal 0_R do (
N = N + 1;
J = jets(N, I);
(RingJets,iota) = flattenRing ring(J);
factorialMap = map(RingJets, RingJets,
gens RingJets / ( i-> i => i/(value(substring(1, toString first baseName i)))! ));
F = factorialMap iota J;
R = QQ[y_0..y_(N+m), z_0..z_(N+n), w_0..w_N, MonomialOrder => Lex];
idxList = gens RingJets/(i->(last baseName i)+value((toString first baseName i)_(-1)));
letterList = gens RingJets / (i -> (toString first baseName i)_0);
mapList = apply(letterList, idxList, (i,j) -> value( i | "_" | toString(j)));
phi = map(R, RingJets, mapList);
L = splice(toList (y_0..y_(N+m), z_0..z_(N+n)));
T = eliminate(L,  phi F);
);
return T;
);


### Example 2.3¶

[16]:

m =2;
R = QQ[y_0..y_m, w_0, MonomialOrder => Lex];
P = y_2 - y_0;
InvDalg(P)



2            2
o16 = ideal(w  + w w  - 2w )
0    0 2     1

o16 : Ideal of R


### Product abd square of D-algebraic functions¶

[19]:

m = 2;
n = 2;
R = QQ[y_0..y_m, z_0..z_n, w_0, x_0..x_1, MonomialOrder => Lex];




[21]:

ProdDalg = (P, Q) ->(
T = ideal 0_R;
N =0;
I = ideal (P, Q, w_0 - z_0 * y_0, x_1 -1 );
while  T == ideal 0_R do (
N = N + 1;
J = jets(N, I);
(RingJets,iota) = flattenRing ring(J);
factorialMap = map(RingJets, RingJets, gens RingJets / ( i-> i => i/(value(substring(1, toString first baseName i)))! ));
F = factorialMap iota J;
R = QQ[y_0..y_(N+m), z_0..z_(N+n), w_0..w_N, x_0..x_(N+1), MonomialOrder => Lex];
idxList = gens RingJets/(i->(last baseName i)+value((toString first baseName i)_(-1)));
letterList = gens RingJets / (i -> (toString first baseName i)_0);
mapList = apply(letterList, idxList, (i,j) -> value( i | "_" | toString(j)));
phi = map(R, RingJets, mapList);
L = splice(toList (y_0..y_(N+m),z_0..z_(N+n), x_1..x_(N+1)));
T = eliminate(L,  phi F);
);
return T;
);

SquarDalg = (P) ->(
T = ideal 0_R;
N =0;
I = ideal (P, w_0 -  y_0^2, x_1 -1 );
while  T == ideal 0_R do (
N = N + 1;
J = jets(N, I);
(RingJets,iota) = flattenRing ring(J);
factorialMap = map(RingJets, RingJets, gens RingJets / ( i-> i => i/(value(substring(1, toString first baseName i)))! ));
F = factorialMap iota J;
R = QQ[y_0..y_(N+m), w_0..w_N, x_0..x_(N+1), MonomialOrder => Lex];
idxList = gens RingJets/(i->(last baseName i)+value((toString first baseName i)_(-1)));
letterList = gens RingJets / (i -> (toString first baseName i)_0);
mapList = apply(letterList, idxList, (i,j) -> value( i | "_" | toString(j)));
phi = map(R, RingJets, mapList);
L = splice(toList (y_0..y_(N+m), x_1..x_(N+1)));
T = eliminate(L,  phi F);
);
return T;
);

D



### Toy Example for the product¶

[27]:

m = 2;
n = 2;
R = QQ[y_0..y_m, z_0..z_n, w_0, x_0..x_1, MonomialOrder => Lex];
P = y_2 + y_0;
Q = z_2 + z_0;
ProdDalg(P,Q)



o27 = ideal(4w  + w )
1    3

o27 : Ideal of R


### Example 2.8¶

The following lines compute an ADE for the square of the Painlevé transcendent of type I.

[31]:

m = 2;
R = QQ[y_0..y_m, w_0, x_0..x_1, MonomialOrder => Lex];
P = y_2 - 6*y_0^2 - x_0;
SquarDalg(P)



5       4        3 2     2 2       2      4
o31 = ideal(576w  + 192w x  + 16w x  - 4w w  + 4w w w  - w )
0       0 0      0 0     0 2     0 1 2    1

o31 : Ideal of R


## Composition of D-algebraic functions¶

The next functions are used to construct the polynomials S_i of Equation (4.12) from the paper.

[32]:

-- For Monomials
SpecialDifMonomials  = ( M ) ->(
if isUnit M == true or M == 0 then
return 0
else (
for i from 0 when i < N + 2 do (
if M % z_i == 0 then (return z_(i + 1) * M // z_i + z_i * SpecialDifMonomials ( M // z_i););
if M % y_i == 0 then (return y_(i + 1) * z_1 * M // y_i + y_i * SpecialDifMonomials( M // y_i);)
);
);
);

[33]:

-- For Polynomials
SpecialDifPoly = ( M) ->(
L = terms (M);
S = {0};
for i from 0 when i < length L do ( S = append( S, SpecialDifMonomials(L_i)));
return sum S;
);

[34]:

-- Applying the previous function several times
HigherDif = (M, n) -> (
if n == 0 then return M;
if n == 1 then (
return (SpecialDifPoly(M));
);
return HigherDif(HigherDif (M, 1), n - 1);
);

[35]:

CompDalg = (P,Q) -> (
I = ideal(P , Q , x_1 - 1);
T = ideal 0_R ; N =0;
while T == ideal 0_R do (
N = N +1;
-- Constructing the differential ideal using Jets
J = jets(N, I); (RingJets,iota) = flattenRing ring(J);
factorialMap = map(RingJets, RingJets,
gens RingJets / ( i-> i => i / (value(substring(1, toString first baseName i)))! ));
-- Substituting the variables with factorials in the coefficients to make the ideal differential
F = factorialMap iota J;
-- Changing the ring from the ring of Jets to a new ring
R = QQ[w_0..w_(N + min(m,n)), y_0..y_(N + m), z_0..z_(N+ n), x_0..x_(N+1), MonomialOrder => Lex];
idxList = gens RingJets/(i->(last baseName i)+value((toString first baseName i)_(-1)));
letterList = gens RingJets / (i -> (toString first baseName i)_0);
mapList = apply(letterList, idxList, (i,j) -> value( i | "_" | toString(j)));
phi = map(R, RingJets, mapList);
H = phi F; -- Constructing the ideal containing the differential equation for the composition
for i from 0 when i < N + 2 do (
H = H + ideal( w_i - HigherDif(y_0, i) );
);
L = splice(toList (y_0..y_(N+m),z_0..z_(N+n), x_1..x_(N+1)));
T = eliminate(L, H); -- Eliminating the respective variables
);
return T;
);


### Example 4.4¶

[41]:

m =1;
n =1;
R = QQ[y_0..y_m, z_0 ..z_n,w_0,x_0..x_1, MonomialOrder => Lex];
P = y_1 - y_0;
Q= 2*z_1 + z_0^2;
CompDalg(P,Q)



2 2       3       2      4
o41 = ideal(w w  + 2w w  - 2w w w  + w )
0 2     0 1     0 1 2    1

o41 : Ideal of R


### Example 4.5¶

[47]:

m = 2;
n = 1;
R = QQ[y_0..y_m, z_0 ..z_n, x_0..x_1, MonomialOrder => Lex];
P = y_2 - y_0;
Q = z_1 - x_0*z_0;
CompDalg(P,Q)



4         2                 3                  2    2 3    2
o47 = ideal(2w w x  + 3w w x  + 3w w  - 3w w x  - 3w w x  + w w x  + w x  + w x
0 1 0     0 1 0     0 1     0 2 0     0 2 0    0 3 0    1 0    1 0
--------------------------------------------------------------------------
2
- w w x )
1 2 0

o47 : Ideal of R


### Example 5.7¶

[53]:

m = 1;
n = 2;
R = QQ[y_0..y_m, z_0 ..z_n, x_0..x_1, MonomialOrder => Lex];
P = y_1 - y_0; Q = z_2 - 6*z_0^2 - x_0;
CompDalg(P,Q)



6     5        4 2       4        4 2     3 3      3 2
o53 = ideal(w  - 2w w  + 24w w x  + 6w w w  + w w  - 4w w  - 24w w w  -
0     0 3      0 1 0     0 1 2    0 3     0 1      0 1 2
--------------------------------------------------------------------------
3            2 4     2 3       2 2 2        4       6
6w w w w  + 24w w  + 4w w w  + 9w w w  - 12w w w  + 4w )
0 1 2 3      0 1     0 1 3     0 1 2      0 1 2     1

o53 : Ideal of R

[59]:

m = 1;
n = 2;
R = QQ[y_0..y_m, z_0 ..z_n, x_0..x_1, MonomialOrder => Lex];
P = 2*x_0*y_1 - y_0; Q = z_2 - 6*z_0^2 - x_0;
CompDalg(P,Q)



4     3          2 2 3      2           2 2 2         2   3
o59 = ideal(w  - 4w w x  + 96w w x  - 12w w w x  + 4w w x  - 192w w w x  +
0     0 3 0      0 1 0      0 1 2 0     0 3 0       0 1 2 0
--------------------------------------------------------------------------
2       4 3      2 2 2
24w w w w x  - 192w x  + 36w w x )
0 1 2 3 0       1 0      1 2 0

o59 : Ideal of R