1 | initial version |
You may evaluate the list L
of rational functions at various random points to get a matrix of at most nrows
:
sage: def to_matrix(L, nrows):
....: rows = []
....: for _ in range(nrows):
....: (a,b,c,d) = (QQ^4).random_element()
....: if all(p.denominator().subs(x=a,y=b,z=c,w=d)!=0 for p in L):
....: rows.append([p.subs(x=a,y=b,z=c,w=d) for p in L])
....: return matrix(rows)
and then, if you have a list L
of let's say 5 rational functions,
sage: K = Frac(PolynomialRing(QQ,'x,y,z,w'))
sage: L = [K.random_element() for _ in range(5)]
sage: L
[(-5*x*z - 2*y*z - 1/4*w^2 + z - 2)/(y*z + 1/5*z^2 - w^2 + 1/9*x - 4/95*y),
(97/12*y*z - z^2 + 7*y + 1/114*w + 1/2)/(2*x*y - x*z + 4/5*y*z + 2*x*w + 3*z),
(4/3*y^2 - 2*z^2 + 3*x*w - 19/12*z)/(-1/5*y*z + 28/3*y*w + z*w - 4*x + 2*z),
(-x*y - 5/2*x*z + 1/4*z + 1/12)/(1/9*x*y - 4*z^2 - 137/2*z + w),
(x*y + 1/4*x*z + 1/14*y*z - 1/2*y*w + 33*w^2)/(x*w + 1/14*z)]
You may evaluate each of the rational function at let's say m>5
different random points, giving you a m x 5
matrix. If m=8
, it may be:
sage: M = to_matrix(L, 8)
sage: M
[ -403845/186844 136275/60268 78217/2968 -603/107 18217/83]
[ 28215/5516 -1709/228 -17/4 -39/22 15]
[ 2465820/159503 37355/21804 6298795/15641408 124689/1572500 2553/361]
[ -725/124 -341/2052 -43/26 -1/217 77/6]
[ 1133825/1135924 -2781755/1123584 -58215/205502 -1056/20131 169723/1552]
[ -30305/16636 -104315/1368 505/561 -4/873 165/8]
[ 2375/5764 -3055/684 695/13764 -1/339 -29403]
[ -2028915/161732 70027/69084 7073/2275 -2022/79555 -3072/169]
Then, the space of coefficients you are looking for must live inside of the right kernel of the matrix M
:
sage: M.right_kernel()
Vector space of degree 5 and dimension 0 over Rational Field
Basis matrix:
[]
If the dimension of the right kernel is 0, then you got your answer. If M.right_kernel()
is not of dimension 0, then you should retry again after increasing the number m
of rows to make sure this is not an artefact.
2 | No.2 Revision |
You may evaluate the list L
of rational functions at various random points to get a matrix of at most nrows
:
sage: def to_matrix(L, nrows):
....: rows = []
....: for _ in range(nrows):
....: (a,b,c,d) = (QQ^4).random_element()
....: if all(p.denominator().subs(x=a,y=b,z=c,w=d)!=0 for p in L):
....: rows.append([p.subs(x=a,y=b,z=c,w=d) for p in L])
....: return matrix(rows)
and then, if you have a list L
of let's say 5 rational functions,
sage: K = Frac(PolynomialRing(QQ,'x,y,z,w'))
sage: L = [K.random_element() for _ in range(5)]
sage: L
[(-5*x*z - 2*y*z - 1/4*w^2 + z - 2)/(y*z + 1/5*z^2 - w^2 + 1/9*x - 4/95*y),
(97/12*y*z - z^2 + 7*y + 1/114*w + 1/2)/(2*x*y - x*z + 4/5*y*z + 2*x*w + 3*z),
(4/3*y^2 - 2*z^2 + 3*x*w - 19/12*z)/(-1/5*y*z + 28/3*y*w + z*w - 4*x + 2*z),
(-x*y - 5/2*x*z + 1/4*z + 1/12)/(1/9*x*y - 4*z^2 - 137/2*z + w),
(x*y + 1/4*x*z + 1/14*y*z - 1/2*y*w + 33*w^2)/(x*w + 1/14*z)]
You may evaluate each of the rational function at let's say m>5
different random points, giving you a m x 5
matrix. If m=8
, it may be:
sage: M = to_matrix(L, 8)
sage: M
[ -403845/186844 136275/60268 78217/2968 -603/107 18217/83]
[ 28215/5516 -1709/228 -17/4 -39/22 15]
[ 2465820/159503 37355/21804 6298795/15641408 124689/1572500 2553/361]
[ -725/124 -341/2052 -43/26 -1/217 77/6]
[ 1133825/1135924 -2781755/1123584 -58215/205502 -1056/20131 169723/1552]
[ -30305/16636 -104315/1368 505/561 -4/873 165/8]
[ 2375/5764 -3055/684 695/13764 -1/339 -29403]
[ -2028915/161732 70027/69084 7073/2275 -2022/79555 -3072/169]
Then, the space of coefficients you are looking for must live inside of the right kernel of the matrix M
:
sage: M.right_kernel()
Vector space of degree 5 and dimension 0 over Rational Field
Basis matrix:
[]
If the dimension of the right kernel is 0, then you got your answer. If M.right_kernel()
is not of dimension 0, then you should retry again after increasing the number m
of rows to make sure this is not an artefact.artefact in which case the space of explicit solutions will be given by the basis matrix.