Ask Your Question

Onox's profile - activity

2021-03-26 09:27:32 +0200 received badge  Famous Question (source)
2021-03-26 09:27:32 +0200 received badge  Notable Question (source)
2015-12-06 17:59:17 +0200 received badge  Popular Question (source)
2015-12-05 22:13:04 +0200 received badge  Student (source)
2015-12-05 21:28:35 +0200 asked a question Polynomials with coefficients in Zp - python SyntaxError

Hi,

I am trying to create ℤₚ[x], the set of polynomials with coefficients in ℤₚ, with the following syntax :
Zp = Integers(p)
PRZp.<x> = Zp[]

This works fine in the sage interpreter, but in a python file I get a syntax error at the "<" character. How can I solve this ? I've tried alternatives, like PRZp = PolynomialRing(Zp, 'x'), but this fails too with a "NameError: name 'x' is not defined" when I define a polynomial expression after that.

2015-09-26 17:00:01 +0200 asked a question How to cast a string with an exponent from sys.argv to an Integer ?

Hi,

For an exercise, I have written a Python script that takes an integer argument. Of course, the input in sys.argv is of type 'str', so I cast it to an Integer. It works, but I am supposed to accept numbers written like '123^1237' too, with a hat for the exponent. And I cannot find how to do that. In the sage interpreter, I can type "n = Integer(123^1237)" without any problem, but in my script it fails with a "TypeError: unable to convert '123^1237' to an integer". Thanks