ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 01 Jun 2020 13:12:06 -0500Variable elimination in Sagehttps://ask.sagemath.org/question/51683/variable-elimination-in-sage/ Besides `maxima.eliminate`, are there any other functions in Sage that can be used to eliminate variables in a system of equations? Eg. those that use algorithms other than `Maxima`?mathdude94Mon, 01 Jun 2020 13:12:06 -0500https://ask.sagemath.org/question/51683/Implicitization by symmetric polynomialshttps://ask.sagemath.org/question/51336/implicitization-by-symmetric-polynomials/Let $p_1,\dotsc,p_m$ be real polynomials (although rational can do as well) in $t$ variables.
> What is the most efficient way to compute the smallest degree $d$ such that $s(p_1,\dotsc,p_m) = 0$ for some rational symmetric polynomial $s$ in $m$ variables?
----------
At the moment I am doing this for $t = 1$ by iterating the following simple algorithm over $d \geq 1$:
1. Create a list `Sc` of the Schur functions corresponding to the partitions of $k \leq d$ with at most $m$ parts, which is a linear basis over $\Bbb{Q}$ for the space of symmetric polynomials in $m$ variables with degree up to $d$.
2. Compute the list `Ps` of the evaluations of each element of `Sc` at $(p_1,\dotsc,p_m)$.
3. Convert the elements of `Ps` into vectors and stop if they are linearly dependent, otherwise increase $d$ by one and repeat from 1.
This works reasonably well when the degrees of $p_1,\dotsc,p_m$ are small, but otherwise iterating over each $d$ involves quite a bit of work and it doesn't scale very well.
I know that the equivalent problem for $s \in \Bbb{Q}[X_1,\dotsc,X_m]$ is "readily" solved through variable elimination via Gröbner bases, but I have yet to find a way to make this work for symmetric polynomials. I also thought that I might compute the relevant ideal and then try to find the subset fixed by the symmetric group in $m$ variables, but I couldn't find any facilities in Sage to compute fixed sets under a group action (which I guess is a hard problem in general).
----------
This is my current code:
S = SymmetricFunctions(QQ).s()
R.<x> = QQ[]
def eval_schur(F, d):
"""
Returns the evaluation at a vector F of the Schur functions of degree n.
"""
m = len(F)
schur_polys = ((l, S(l).expand(m)) for l in Partitions(d) if len(l) <= m)
return ((l, sch(*F)) for (l,sch) in schur_polys)
def poly_vectors(polys):
d = max(p.degree() for p in polys)
return (p.padded_list(d+1) for p in polys)
def order_of_symmetric_dependence(F):
schur = [R(1)]
vectors = [1]
d = 0
while not FreeModule(QQ,1).are_linearly_dependent(vectors):
d += 1
schur.extend((s for (_,s) in eval_schur(F,d)))
vectors = poly_vectors(schur)
return d
And here's a sample output:
In [2]: [order_of_symmetric_dependence([x, x^2, x^(2*k)]) for k in range(1,8)]
Out[2]: [4, 5, 8, 11, 12, 12, 12]A.P.Sat, 09 May 2020 04:16:22 -0500https://ask.sagemath.org/question/51336/Is there any easy way to parallel gröbnerbasis computations in sage?https://ask.sagemath.org/question/33534/is-there-any-easy-way-to-parallel-grobnerbasis-computations-in-sage/Hi, I have a problem I am currently working on where I wish to eliminate variables from a system of polynomials. I have managed to do it in several cases, but for large systems to check my hypothesis the memory usage becomes very large, and the computations take a long time. Therefore I wondered if there is any easy way to optimalize the gröbner basis computation in sage. I am currently using the .elimination_ideal([]) environment, but it turns out to be very ineffective in the examples I am computing. I figured out that one of the limitations is that the eliminate function runs on only one core of the computer. So I therefore thought that in order to speed up the computations, then one could parallelize the function. However, it turns out that all current environments on sage including @fork, @parallel and parallelism.set() does not help at all in this case, since the process still runs on only one core.
Any good ideas out there? mathguyTue, 24 May 2016 07:26:36 -0500https://ask.sagemath.org/question/33534/Elimination of variables in polynomial equationhttps://ask.sagemath.org/question/32742/elimination-of-variables-in-polynomial-equation/Hi,
I'm trying to eliminate 5 variables from a system of 6 equations in 7 unknowns, to obtain a planar curve. Am I asking for too much?
This is what I tried:
R.<x,v,c1,c2,c3,c4,c5> = PolynomialRing(QQ)
p0 = -16*c1*c2*c3*c4*c5+16*v
p1 = 16*c1*c2*c3*c4-16*(-c1*c2*c3-(c1*c2-(-c1-c2)*c3)*c4)*c5+40*v
p2 = -16*c1*c2*c3-16*(c1*c2-(-c1-c2)*c3)*c4-16*(c1*c2-(-c1-c2)*c3-(-c1-c2-c3)*c4)*c5+25*v
p3 = 16*c1*c2-16*(-c1-c2)*c3-16*(-c1-c2-c3)*c4-16*(-c1-c2-c3-c4)*c5-25;
p4 = -16*c1-16*c2-16*c3-16*c4-16*c5-40
I = ideal((c1-c3)*(c2-c4)-x*(c1-c4)*(c2-c3),p0,p1,p2,p3,p4)
J = I.elimination_ideal([c1,c2,c3,c4,c5])
Note that the system is symmetric in permutations of c1...c5, except for one equation that says that x is the cross-ratio of c1...c4.
I'm all the more embarrassed because I already computed the solution some time ago, but forgot how: it should be a polynomial J of degree 30 in v and 16 in x.
Many thanks in advance! LaurentlaurentbartholdiWed, 09 Mar 2016 03:48:02 -0600https://ask.sagemath.org/question/32742/Eliminating variables from a system of equations?https://ask.sagemath.org/question/9582/eliminating-variables-from-a-system-of-equations/I'm (very) new to Sage, but am confused about why I can't get it to solve a simple system like this:
var('x, y, z')
eqns = [ x^2 + y^2 == z, x == y]
but solve(eqns, z) gives an empty list back instead of my desired z = 2y^2
PatrickSurryWed, 28 Nov 2012 12:10:00 -0600https://ask.sagemath.org/question/9582/