On Jun 11, 2010, at 11:23 PM, Rolandb wrote:
Hi,
I have a small (nonsense) example of a program I would like to be able
to convert to cython. But I don't know how to convert:
"R.<A,B,C>=QQ[]", ".factor()", ".unit()" and
".factor(proof=False,limit=10^5)". I could not find anything in the
documentation about for instance handling elements of R.<A,B,C>=QQ[],
thus
sage
.rings
.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.
R.<A,B,C>=QQ[]
def test(trio,expr=(A,B,C)):
(a,b,c)=sorted(map(lambda x: abs(x(trio)),expr))
basis=prod(expr).factor()
te_ontbinden=[abs(w[0](trio)) for w in basis]+[QQ(basis.unit())]
radl=abs(prod(uniq([p for g in te_ontbinden for p,_ in
ZZ(g).factor(proof=False,limit=10^5)])))
return radl
test((1,8,9),(A^2,C^2-A^2,C^2))
30
Any help is appreciated! Roland
Sage is preparsed. To see what comes out, do
sage: preparse("3.factor()")
'Integer(3).factor()'
sage: print preparse("""
R.<A,B,C>=QQ[]
def test(trio,expr=(A,B,C)):
(a,b,c)=sorted(map(lambda x: abs(x(trio)),expr))
basis=prod(expr).factor()
te_ontbinden=[abs(w[0](trio)) for w in basis]+[QQ(basis.unit())]
radl=abs(prod(uniq([p for g in te_ontbinden for p,_ in
ZZ(g).factor(proof=False,limit=10^5)])))
return radl
""")
R = QQ['A, B, C']; (A, B, C,) = R._first_ngens(3)
def test(trio,expr=(A,B,C)):
(a,b,c)=sorted(map(lambda x: abs(x(trio)),expr))
basis=prod(expr).factor()
te_ontbinden=[abs(w[Integer(0)](trio)) for w in basis]+
[QQ(basis.unit())]
radl=abs(prod(uniq([p for g in te_ontbinden for p,_ in
ZZ(g).factor(proof=False,limit=Integer(10)**Integer(5))])))
return radl
- Robert
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org