sumiya11 / ParamPunPam.jl

Poudre de perlimpinpin
MIT License
2 stars 0 forks source link

Clarify when to use ParamPunPam.jl vs Groebner.jl #4

Open nsajko opened 7 months ago

nsajko commented 7 months ago

Could you clarify when should one vs the other package be used? That is, what exactly is the distinction between a variable and a parameter? I guess that if some variables are known to be real, it makes sense to consider them as a parameter and use ParamPunPam instead of Groebner?

sumiya11 commented 7 months ago

That's an interesting question !

To quote my scientific advisor, parameters would typically represent some quantities which are assumed to be known. In other words, one would use parametric Groebner bases if one is interested in solving the equations by expressing the variables in terms of parameters.

Formally, the difference between parameters and variables is not large. The choice between ParamPunPam and Groebner will probably depend on the specific task at hand.

To illustrate what I mean, I bring the following example. Say, we want to solve this linear system in $x,y$:

$$ \begin{pmatrix} a & a + b \ a - b & a^2 \end{pmatrix} \times \begin{pmatrix} x\ y \end{pmatrix} \= \begin{pmatrix} b^2\ a^2 \end{pmatrix} $$

We can easily cast this problem into a setting of parametric Groebner bases:

using Nemo, ParamPunPam
R_param, (a, b) = QQ["a", "b"]
R, (x,y) = FractionField(R_param)["x","y"]

paramgb([
    a*x  + (a+b)*y  - b^2,
    (a-b)*x + a^2*y - a^2
])

Running this will give you the solutions in $x$ and $y$, e.g., we get $y = -(-a^3 + a b^2 - b^3)/(a^3 - a^2 + b^2)$.

Now note that the same result can be obtained with Groebner, if we use $\mathbb{Q}[x,y,a,b]$ with $a,b < x,y$, instead of the parametric $\mathbb{Q}(a,b)[x,y]$. Indeed, in this basis

using Nemo, Groebner
R, (x,y,a,b) = QQ["x","y","a","b"]

groebner([
    a*x + (a+b)*y   - b^2,
    (a-b)*x + a^2*y - a^2
])
# returns
3-element Vector{QQMPolyRingElem}:
 y*a^3 - y*a^2 + y*b^2 - a^3 + a*b^2 - b^3
 x*b - y*a^2 + y*a + y*b + a^2 - b^2
 x*a + y*a + y*b - b^2

if we group the terms in the first polynomial, we get $y (a^3 - a^2 + b^2) = -(-a^3 + a b^2 - b^3)$. It is the same result we obtained when using parametric bases, if we divide by $(a^3 - a^2 + b^2)$.

To sum up, parametric Groebner bases and usual Groebner bases are two sides of the same coin; which to use depends on your task and imagination :)