On Sep 7, 2010, at 08:57 , andrew ewart wrote:
ah found why got that missed brqacket on end of g.unit()
now by using g.factor
how do i express the factors of a polynomial in a list
eg
g=x^2+x
g.factor= x(x+1)
so want something that does
list(g)
giving output
[x,x+1]
g.factor() returns someth
ah found why got that missed brqacket on end of g.unit()
now by using g.factor
how do i express the factors of a polynomial in a list
eg
g=x^2+x
g.factor= x(x+1)
so want something that does
list(g)
giving output
[x,x+1]
>
>
--
To post to this group, send email to sage-support@googlegroups.com
T
when i try that i get these errors
Traceback (most recent call last):
File "quickfact2.py", line 21, in
ef=poly_ran()
File "quickfact2.py", line 13, in poly_ran
if g[_sage_const_0 ][_sage_const_0 ]*g.unit==f:
File "element.pyx", line 1436, in
sage.structure.element.RingElement.__mul_
On 9/7/10 9:36 AM, andrew ewart wrote:
ef is the resultant of poly_ran
Ah. So you need to make that assignment (outside of the function):
ef=polyran()
quickfactor(ef)
or even shorter:
quickfactor(polyran())
Note that the ef defined inside of polyran is local to that function; it
is not v
ef is the resultant of poly_ran
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemat
On 9/7/10 9:19 AM, andrew ewart wrote:
code
S=GF(5)
R.=PolynomialRing(S, 2, "z")
T.=PolynomialRing(S)
def poly_ran():
ef=R(1)
eye=0
if eye<10:
f=R.random_element()
g=f.factor(proof=false)
if g[0][0]*g.unit==f:
ef=ef*f
eye=eye+1
code
S=GF(5)
R.=PolynomialRing(S, 2, "z")
T.=PolynomialRing(S)
def poly_ran():
ef=R(1)
eye=0
if eye<10:
f=R.random_element()
g=f.factor(proof=false)
if g[0][0]*g.unit==f:
ef=ef*f
eye=eye+1
else:
eye=eye
else:
On 9/7/10 8:52 AM, andrew ewart wrote:
suppose i have a funciton
def_f1(f)
f=2
return f
how do i then make the output f the input of a antother function
def_eg1(f)
g=f^2
return g
as at the moment its telling me that f isnt defined
Can you include a complete code