Ask Your Question

MadPidgeon's profile - activity

2018-06-27 11:43:31 +0100 commented answer Pari error when factoring polynomial

Thanks! I will look into it.

2018-06-26 21:58:15 +0100 asked a question Pari error when factoring polynomial

I ran the following code to factor a polynomial over a number field:

U.<z> = CyclotomicField(32)
P.<x> = PolynomialRing(U)
f = x^16-256
print f.factor()

This code works for all substitutions of 256 by another value I have tried, but this one gives an error:

Traceback (most recent call last):
File "p_is_2_test.sage.py", line 10, in <module>
print f.factor()
File "sage/rings/polynomial/polynomial_element.pyx", line 4199, in sage.rings.polynomial.polynomial_element.Polynomial.factor (build/cythonized/sage/rings/polynomial/polynomial_element.c:39418)
File "cypari2/auto_gen.pxi", line 17246, in cypari2.gen.Gen_auto.nffactor
File "cypari2/handle_error.pyx", line 196, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: inconsistent concatenation t_COL (8 elts) , t_VEC (8 elts)

This seems like some bug in sage, but I am not quite sure what to make of the error. Does anyone know how to deal with this error and to properly let sage factor this polynomial?

2018-06-26 21:50:25 +0100 received badge  Scholar (source)
2018-06-26 21:44:16 +0100 received badge  Supporter (source)
2018-06-19 12:36:08 +0100 received badge  Nice Question (source)
2018-06-17 16:10:17 +0100 commented answer Possible bug with identity morphism

Is there any way to coerce the formal composite map to one of the former type? I compute the product of O(n) morphisms as f = one and for phi in l: f = phi*f, and the latter becomes an unreadable block of composite maps when I print the result, and it doesn't help the algorithmic complexity either when trying to evaluate the function I presume. I can work around this by reverse iterating the list and doing right multiplication with phi instead, but this feels like a hack. Furthermore, my question was whether any piece of documentation justifies this counter intuitive result.

2018-06-17 12:47:03 +0100 asked a question Possible bug with identity morphism

I have a number field U for which I consider its automorphisms through Hom(U,U). The identity one=Hom(U,U).identity() behaves weirdly under right multiplication:

U = CyclotomicField(3)
f = Hom(U,U)[1]
print f
print "--------------------"
one = Hom(U,U).identity()
print f*one
print "--------------------"
print one*f
print "--------------------"
print f*f

When I run this code, I expect f to be printed thrice, followed by the identity morphism. However, while the first and third output do in fact both print f, the second prints

Composite map:
  From: Cyclotomic Field of order 3 and degree 2
  To:   Cyclotomic Field of order 3 and degree 2
  Defn:   Identity endomorphism of Cyclotomic Field of order 3 and degree 2
        then
          Ring endomorphism of Cyclotomic Field of order 3 and degree 2
          Defn: zeta3 |--> -zeta3 - 1

Is this a bug or is this this behaviour explained somewhere in the documentation?

2018-01-28 02:03:02 +0100 received badge  Student (source)
2018-01-27 12:42:28 +0100 commented answer Computation of homomorphisms of number fields

Maybe I should have included this, but at `print K.gens(), L.gens()' sage answers with

(gen1, zeta3) (gen2, zeta3)

so clearly K has two generators, I think? Secondly, how does it decide where to send zeta3? In this case there is little room, but if we take

P.<X> = PolynomialRing(QQ)
R.<s2> = QQ.extension(X^2-2)
K.<s3> = R.extension(X^2-3)
print K.gens()
H = K.hom( [-s3,-s2], K )
print H

this should also give a valid morphism instead of the one returned by K.hom([-s3]) that maps s2 to itself.

2018-01-27 12:25:40 +0100 asked a question Computation of homomorphisms of number fields

Given two number fields, I want to construct a morphism between them. For this I tried to use the hom member-function of the NumberField object as follows:

R.<zeta3> = CyclotomicField(3)
P.<X> = PolynomialRing(R)
K.<gen1> = R.extension(X^3-zeta3)
L.<gen2> = R.extension(X^3-zeta3^2)
print K.gens(), L.gens()
H = K.hom( [gen2,zeta3^2], L )
print H

The help page of hom specifies:

Return the unique homomorphism from self to codomain that sends self.gens() to the entries of im_gens. Raises a TypeError if there is no such homomorphism.

However, instead of TypeError, I get an incomprehensible error:

File "/home/sage/bin/sage2/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py", line 1670, in _element_constructor_ raise ValueError("Length must be equal to the degree of this number field") ValueError: Length must be equal to the degree of this number field

What am I doing wrong? Is there a better way to define this morphism?