ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 14 Jul 2020 10:00:35 +0200One point from infinity varietyhttps://ask.sagemath.org/question/52460/one-point-from-infinity-variety/ Given an ideal, I want to compute a non-zero point in the variety of that ideal. This can be done with `.variety()` if the ideal has 0-dimension. How can I get a non-zero point in the variety if the ideal is not 0-dimensional?
Example:
R.<x,y> = PolynomialRing(QQ)
I = R.ideal([x^2-y^2])
I.variety()
yields an error. How can I get a point like (1,1) which lies in the variety?
Thanks!philipp7Tue, 14 Jul 2020 10:00:35 +0200https://ask.sagemath.org/question/52460/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 11:16:22 +0200https://ask.sagemath.org/question/51336/The number of solutions of a polynomial system using a Gröbner basishttps://ask.sagemath.org/question/49683/the-number-of-solutions-of-a-polynomial-system-using-a-grobner-basis/The following extract from [this Wikipedia page](https://en.wikipedia.org/wiki/Gr%C3%B6bner_basis#Solutions_of_a_system_of_algebraic_equations) explains that we can easily deduce the number of solutions of a polynomial system using Gröbner basis:
> Given the Gröbner basis G of an ideal
> I, it has only a finite number of
> zeros, if and only if, for each
> variable x, G contains a polynomial
> with a leading monomial that is a
> power of x (without any other variable
> appearing in the leading term). If it
> is the case **the number of zeros**,
> counted with multiplicity, is equal to
> the number of monomials that are not
> multiple of any leading monomial of G.
> This number is called the degree of
> the ideal.
*Question*: Is there a function in Sage computing this number of zeros from a given Gröbner basis?Sébastien PalcouxSun, 26 Jan 2020 11:38:10 +0100https://ask.sagemath.org/question/49683/Getting the error message: The dimension of the ideal is 1, but it should be 0https://ask.sagemath.org/question/40404/getting-the-error-message-the-dimension-of-the-ideal-is-1-but-it-should-be-0/I'm trying to solve a system of 5 polynomial equations.
Here's the code I tried to run:
P.<b, qa, qb, qc, qd>=PolynomialRing(QQ,order='degrevlex')
eq1=P(-25997.02495*qc+73589.75314*qa+19275.89428*qb^3+42024.09724*qc^3-35275.79436*qd^3+31409.96375*qd-22475.53767*qb+11165.49567*qc*qa*qd+38392.81504*qd*qb*qc-5354.736466*qc*qa*qb-40769.13796*qd*qb*qa-50708.36034*qc^2*qa-67780.84581*qd*qb^2+39326.95066*qd^2*qb+5359.28038*qb^2*qa-35437.12402*qd*qc^2+48529.90789*qd^2*qc-6801.32966*qb^2*qc+13747.85604*qc^2*qb+9197.21841*qd^2*qa+2*b*qa)
eq2=-P(1938.516702*qc-9153.752714*qa-15279.24300*qb^3+8131.520743*qc^3+35208.27094*qd^3-25334.07110*qd+71321.57867*qb+38392.81500*qc*qa*qd-48554.44832*qd*qb*qc-64028.43710*qc*qa*qb-58696.44966*qd*qb*qa+2*b*qb+426.071103*qc^2*qa+26980.57949*qd*qb^2-29944.11326*qd^2*qb+4540.542985*qb^2*qa-1130.66934*qd*qc^2-8809.128406*qd^2*qc-9514.136166*qb^2*qc-21010.04302*qc^2*qb+26005.16567*qd^2*qa)
eq3=P(1938.516702*qc-9153.752714*qa-15279.24300*qb^3+8131.520743*qc^3+35208.27094*qd^3-25334.07110*qd+71321.57867*qb+38392.81500*qc*qa*qd-48554.44832*qd*qb*qc-64028.43710*qc*qa*qb-58696.44966*qd*qb*qa+2*b*qb+426.071103*qc^2*qa+26980.57949*qd*qb^2-29944.11326*qd^2*qb+4540.542985*qb^2*qa-1130.66934*qd*qc^2-8809.128406*qd^2*qc-9514.136166*qb^2*qc-21010.04302*qc^2*qb+26005.16567*qd^2*qa)
eq4=P(2123.141846*qc+5788.216407*qa+22583.23914*qb^3-8500.597767*qc^3-9489.15234*qd^3+75013.55778*qd-25334.07110*qb+46634.03800*qc*qa*qd-22972.99327*qd*qb*qc+38392.81504*qc*qa*qb+38688.54642*qd*qb*qa+2*b*qd-9815.37666*qc^2*qa-33782.05127*qd*qb^2+64855.67483*qd^2*qb-42159.09845*qb^2*qa-35072.07256*qd*qc^2-8694.617828*qd^2*qc-29859.97200*qb^2*qc-1130.66933*qc^2*qb-3340.393775*qd^2*qa)
eq5= P(qa^2+qb^2+qc^2+qd^2-1)
I = Ideal(eq1, eq2, eq3, eq4, eq5)
I.groebner_basis('libsingular:std')
I.variety(RR)
At the last line of code:
I.variety(RR)
I get this error:
The dimension of the ideal is 1, but it should be 0
Anyone knows why? or alternatively, how to get the solutions of the equations?
Thanksdavid_cSun, 31 Dec 2017 23:24:09 +0100https://ask.sagemath.org/question/40404/