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, 30 May 2024 21:00:41 +0200Polynomial division on non usual ring.https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/Hello everyone, I hope you are well.
I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.
The idea is to do the division in the following ring `R`:
UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.
But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.
I try this method in [Ask Sage question 50406](https://ask.sagemath.org/question/50406)
but Sage can't do the math.
Thank you for your attention.Tue, 15 Feb 2022 04:47:11 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/Comment by FrédéricC for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=77700#post-id-77700A workaround is
sage: a = E(3)*x+y
sage: (libgap(a)/a).sage().parent()
Univariate Polynomial Ring in x over Integer Ring
sage: (libgap(a)/a).sage()
1Thu, 30 May 2024 21:00:41 +0200https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=77700#post-id-77700Comment by rafael for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61114#post-id-61114for example, when i try to do:
UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
(E(3)*x+y)/(E(3)*x+y)
the output is symbolic:
(E(3)*x+y)/(E(3)*x+y)
and i need the output:
1.Tue, 15 Feb 2022 19:39:53 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61114#post-id-61114Comment by mwageringel for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61210#post-id-61210Maybe you could use `QQbar` instead of `UCF`?Fri, 18 Feb 2022 23:50:19 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61210#post-id-61210Comment by Max Alekseyev for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61117#post-id-61117Can you illustrate how "Sage can't do the math" ?Tue, 15 Feb 2022 20:53:46 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61117#post-id-61117Comment by FrédéricC for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61110#post-id-61110Please give us a concrete example.Tue, 15 Feb 2022 11:23:41 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61110#post-id-61110Comment by rafael for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61106#post-id-61106i dont know what the // double slashes do. Anyway, this return a error: KeyError: '_PolynomialRing_singular_repr__singular'Tue, 15 Feb 2022 05:30:31 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61106#post-id-61106Comment by rburing for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61104#post-id-61104Do you just want `q = f // g`? Note the double slashes.Tue, 15 Feb 2022 05:03:20 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?comment=61104#post-id-61104Answer by FrédéricC for <p>Hello everyone, I hope you are well.</p>
<p>I'm trying to do the algorithm of division between polynomials in an unusual ring and I'm having problems. I searched in some forums and couldn't find anything on the subject.</p>
<p>The idea is to do the division in the following ring <code>R</code>:</p>
<pre><code>UCF = UniversalCyclotomicField()
R.<x,y> = PolynomialRing(UCF,2,'x','y', order='lex')
</code></pre>
<p>The idea is to get the coefficient between $f/g=q$, with $f$, $g \in R[x,y]$.</p>
<p>But overall the result of $f/g$ is just giving $f/g$, even in the case where $f=g$.</p>
<p>I try this method in <a href="https://ask.sagemath.org/question/50406">Ask Sage question 50406</a>
but Sage can't do the math.</p>
<p>Thank you for your attention.</p>
https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?answer=61119#post-id-61119Here is the traceback
sage: UCF = UniversalCyclotomicField()
sage: R.<x,y> = PolynomialRing(UCF,order='lex')
sage: a=(E(3)*x+y)/(E(3)*x+y)
sage: a.reduce()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/category_object.pyx in sage.structure.category_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure/category_object.c:7152)()
838 try:
--> 839 return self.__cached_methods[name]
840 except KeyError:
KeyError: '_PolynomialRing_singular_repr__singular'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/polynomial/polynomial_singular_interface.py in _singular_(self, singular)
210 try:
--> 211 R = self.__singular
212 if not (R.parent() is singular):
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/category_object.pyx in sage.structure.category_object.CategoryObject.__getattr__ (build/cythonized/sage/structure/category_object.c:7071)()
832 """
--> 833 return self.getattr_from_category(name)
834
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/category_object.pyx in sage.structure.category_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure/category_object.c:7237)()
847
--> 848 attr = getattr_from_other_class(self, cls, name)
849 self.__cached_methods[name] = attr
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2630)()
355 dummy_error_message.name = name
--> 356 raise AttributeError(dummy_error_message)
357 cdef PyObject* attr = instance_getattr(cls, name)
AttributeError: 'MPolynomialRing_polydict_domain_with_category' object has no attribute '_PolynomialRing_singular_repr__singular'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/fraction_field_element.pyx in sage.rings.fraction_field_element.FractionFieldElement.reduce (build/cythonized/sage/rings/fraction_field_element.c:3823)()
198 if not g.is_unit():
--> 199 self.__numerator //= g
200 self.__denominator //= g
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__floordiv__ (build/cythonized/sage/structure/element.c:13680)()
1836 if HAVE_SAME_PARENT(cl):
-> 1837 return (<Element>left)._floordiv_(right)
1838 if BOTH_ARE_ELEMENT(cl):
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/element.pyx in sage.structure.element.Element._floordiv_ (build/cythonized/sage/structure/element.c:13940)()
1873 else:
-> 1874 return python_op(other)
1875
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/polynomial/multi_polynomial_element.py in _floordiv_(self, right)
1616
-> 1617 Q, _ = self.quo_rem(right)
1618 return Q
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/element.pyx in sage.structure.element.coerce_binop.new_method (build/cythonized/sage/structure/element.c:28122)()
4422 if have_same_parent(self, other):
-> 4423 return method(self, other, *args, **kwargs)
4424 else:
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/qqbar_decorators.py in wrapper(*args, **kwds)
95 and isinstance(a.ring().base_ring(), AlgebraicField_common) for a in args):
---> 96 return func(*args, **kwds)
97
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/polynomial/multi_polynomial_element.py in quo_rem(self, right)
1986 try:
-> 1987 R._singular_().set_ring()
1988 except TypeError:
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/polynomial/polynomial_singular_interface.py in _singular_(self, singular)
225 except (AttributeError, ValueError):
--> 226 return self._singular_init_(singular)
227
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/polynomial/polynomial_singular_interface.py in _singular_init_(self, singular)
242 if not can_convert_to_singular(self):
--> 243 raise TypeError("no conversion of this ring to a Singular ring defined")
244
TypeError: no conversion of this ring to a Singular ring defined
During handling of the above exception, another exception occurred:
ArithmeticError Traceback (most recent call last)
<ipython-input-14-8982e4e20a4a> in <module>
----> 1 a.reduce()
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/fraction_field_element.pyx in sage.rings.fraction_field_element.FractionFieldElement.reduce (build/cythonized/sage/rings/fraction_field_element.c:4260)()
162 return codomain.coerce(nnum/nden)
163
--> 164 cpdef reduce(self):
165 """
166 Reduce this fraction.
~/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/fraction_field_element.pyx in sage.rings.fraction_field_element.FractionFieldElement.reduce (build/cythonized/sage/rings/fraction_field_element.c:3937)()
203 raise ArithmeticError("unable to reduce because lack of gcd or quo_rem algorithm")
204 except TypeError:
--> 205 raise ArithmeticError("unable to reduce because gcd algorithm doesn't work on input")
206 except NotImplementedError:
207 raise ArithmeticError("unable to reduce because gcd algorithm not implemented on input")
ArithmeticError: unable to reduce because gcd algorithm doesn't work on input
Tue, 15 Feb 2022 21:28:31 +0100https://ask.sagemath.org/question/61101/polynomial-division-on-non-usual-ring/?answer=61119#post-id-61119