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.Thu, 13 May 2021 02:54:44 +0200Singularity Typehttps://ask.sagemath.org/question/57095/singularity-type/ Hello, so in Singular, there is a way to give an affine equation and determine the singularity type. For example, if we just take the standard equation, x^(2)+y^(2)+z^(2), the singularity is an ordinary double point (type A1 if you like). If we take x^(2)+y^(2)+z^(3), this gives an A2 singularity. Is there a function on Sage that gives the singularity type, maybe assuming the singularity is at origin.
So like is there something like f.singularitytype()
and then Sage returns like A1 or A2.whatupmattThu, 13 May 2021 02:54:44 +0200https://ask.sagemath.org/question/57095/substitution of variable in the result of monomials()https://ask.sagemath.org/question/49089/substitution-of-variable-in-the-result-of-monomials/Given a polynomial in n variables, I'd like to extract the list of its monomials, and then manipulate that list by substituting certain variables for others.
Simple example: in $Z[x,y]$ consider the polynomial $1+x+y^2$; the list of its monomials (in some ordering) is $(1,x,y^2)$. My function should be able e.g. to take that list and substitute $y$ with $x$, namely return $[1,x,x^2]$.
At the moment, my code gives error, but I do not understand how to fix it.
N.<x1,x2> = PolynomialRing(ZZ, 2)
f = 1+x1+x2
g = f.monomials()
for i in range(3):
g[i] = g[i].substitute_expression(x2==x1)
Namely, how do I make a variable in the polynomial ring also have the substitute attribute? or is there a better way to achieve this?rue82Thu, 19 Dec 2019 20:18:18 +0100https://ask.sagemath.org/question/49089/multivariate polynomials, libsingular and polydicthttps://ask.sagemath.org/question/48329/multivariate-polynomials-libsingular-and-polydict/When defining mutlivariate polynomial in two different ways, I cannot compare them because they seem to have a different type. On the one hand I have
R = PolynomialRing(QQ,'x', 3); x = R.gens()
f = x[0] + x[1] + x[2]
type(f)
which gives <ππ’ππ'ππππ.πππππ.ππππ’ππππππ.πππππβ―ππππ’ππππππβ―πππππππππππ.πΌπΏπππ’ππππππβ―πππππππππππ'>.
On the other hand I define what is (to me) the same polynomial:
SF = SymmetricFunctions(F); SF.inject_shorthands(verbose=False)
g = h[1].expand(3, alphabet = R.gens())
type(g)
which gives <πππππ'ππππ.πππππ.ππππ’ππππππ.πππππβ―ππππ’ππππππβ―πππππππ.πΌπΏπππ’ππππππβ―ππππ’ππππ'>
Thus when comparing `f == g` it gives false. How can get these two modules to talk to each other?
AnnavwMon, 14 Oct 2019 14:22:36 +0200https://ask.sagemath.org/question/48329/How to access variables from libsingular?https://ask.sagemath.org/question/42413/how-to-access-variables-from-libsingular/I have some Sage code that works using the expect interface, and I'm trying to port it to `libsingular`.
The Singular function in question (`absFactorize`) returns a ring with an associated variable. In the expect interface, we `setring` the returned ring, then evaluate the variable name, i.e:
R = norm_f._singular_().absFactorize()
singular.setring(R)
L = singular('absolute_factors')
Anybody know how to do this with `libsingular`?BrentBaccalaWed, 23 May 2018 23:47:38 +0200https://ask.sagemath.org/question/42413/Using Singular's solve.libhttps://ask.sagemath.org/question/40490/using-singulars-solvelib/ I am trying to use Singular's `solve.lib` from Sage, but I am running into issues with getting the result out of Singular. I tried using the Singular interface and was able to make it this far:
sage: singular.lib('solve.lib')
sage: r = singular.ring('complex', '(x,y)', 'lp')
sage: I = singular.ideal('(x-5)*y/32', 'y^2-x^3-5*x-10')
sage: R = singular.fglm_solve(I)
sage: singular.setring(R)
at which point the result is stored in a list `rlist` inside of `R`. I can do `singular.eval('rlist')` and see the answer, but in order to get it back into Sage I would have to parse the resulting string. Is there a better way to get `rlist`?
Alternatively, I tried to use `libSingular` as follows:
sage: from sage.libs.singular.function import singular_function, lib
sage: lib('solve.lib')
sage: fglm_solve = singular_function('fglm_solve')
sage: P = PolynomialRing(QQ,'x,y',order='lex'); x,y = P.gens()
sage: I = Ideal((x-5)*y/32, y^2-x^3-5*x-10)
sage: R = fglm_solve(I)
// 'fglm_solve' created a ring, in which a list rlist of numbers (the
// complex solutions) is stored.
// To access the list of complex solutions, type (if the name R was assigned
// to the return value):
setring R; rlist;
<RingWrap>
But then `R` is a `<RingWrap>` instance and this time I don't even know how to go about seeing the answer. Also, I would prefer to work over the complex field, but I couldn't get `fglm_solve` to accept an ideal in `CC['x,y']`
Any help in either direction would be greatly appreciated.jaebondSat, 06 Jan 2018 04:35:56 +0100https://ask.sagemath.org/question/40490/vdim(std(I)) and vdim(I) returning different answers - Singularhttps://ask.sagemath.org/question/39756/vdimstdi-and-vdimi-returning-different-answers-singular/I thought std just put the ideal in a nicer format, so the answer should be independent. In this case I have 2 larger equation f_1, f_2 and I = jacob((f_1, f_2)). So it ends up being around 18 equations.
I get vdim(std(I)) is the expected answer while vdim(I) the answer is a bit to big.
Any help would be appreciated.
Ed CalFri, 24 Nov 2017 02:41:38 +0100https://ask.sagemath.org/question/39756/Restricted usability of Singular after upgradehttps://ask.sagemath.org/question/36480/restricted-usability-of-singular-after-upgrade/Today I upgraded SageMath from 7.3 to 7.5.1, then I tried to continue yesterday's work: generating a sparse univariate polynomial using Singular, the polynomial has degree beyond that of toy polynomials. Yesterday, this worked fine,
today I get the error message
exponent overflow (117649)
How can this happen? And what can I do to get the previous facilities of Singular (possibly, this means the previous facilities of SageMath)?
Thanks in advance
wjansenTue, 07 Feb 2017 19:28:01 +0100https://ask.sagemath.org/question/36480/Checking an ideal over $\overline{\mathbb Q}$ for primalityhttps://ask.sagemath.org/question/25104/checking-an-ideal-over-overlinemathbb-q-for-primality/I'm trying to check an ideal in a multivariate polynomial ring over $\overline{\mathbb Q}$ for primality.
Using just a single variable, I can type
R.<x> = PolynomialRing(QQ.algebraic_closure())
print Ideal([x^2+2]).is_prime()
and Sage tells me that $\langle x^2+2\rangle$ is not prime in $\overline{\mathbb Q}[x]$, as expected.
However, as soon as I add another variable, e.g. `R.<x,y> = ...` I get the following output:
<pre>
verbose 0 (3539: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-c0542a5be0f8> in <module>()
----> 1 print Ideal([x**Integer(2)+Integer(2)]).is_prime()
/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in is_prime(self, **kwds)
1265 if not self.ring().base_ring().is_field():
1266 raise NotImplementedError
-> 1267 CPD = self.complete_primary_decomposition(**kwds)
1268 if len(CPD) != 1:
1269 return False
/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in __call__(self, *args, **kwds)
602 if not R.base_ring().is_field():
603 raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__))
--> 604 return self.f(self._instance, *args, **kwds)
605
606 require_field = RequireField
/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in wrapper(*args, **kwds)
503 """
504 with LibSingularDefaultContext():
--> 505 return func(*args, **kwds)
506 return wrapper
507
/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in complete_primary_decomposition(self, algorithm)
1079 if algorithm == 'sy':
1080 primdecSY = sage.libs.singular.ff.primdec__lib.primdecSY
-> 1081 P = primdecSY(self)
1082 elif algorithm == 'gtz':
1083 primdecGTZ = sage.libs.singular.ff.primdec__lib.primdecGTZ
/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/libs/singular/function.so in sage.libs.singular.function.SingularFunction.__call__ (build/cythonized/sage/libs/singular/function.cpp:13788)()
TypeError: Cannot call Singular function 'primdecSY' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</pre>
Is there a way to work around this or is there really no implementation for primality checks in $\overline{\mathbb Q}[x_1,\dots,x_n]$?pegelWed, 03 Dec 2014 23:28:13 +0100https://ask.sagemath.org/question/25104/libSingular Groebner basis computation time limithttps://ask.sagemath.org/question/10401/libsingular-groebner-basis-computation-time-limit/I would like to put a time limit on computation of Groebner basis in libSingular, but I have trouble finding out how to do that.
I know Singular command *groebner* takes a second argument, which would do exactly that, but I don't know how to pass it there from SAGE.
Is there a way to do that?blishkoFri, 02 Aug 2013 04:03:30 +0200https://ask.sagemath.org/question/10401/