leif wrote:
Stephen Kauffman wrote:
I'm trying to become cognizant of your caveats about conversion. What
I've tried to write is a recursive function to convert polynomials
(statements) in the Free BooleanPolynomialRing() to corresponding
probability polynomials (statements) over QQ. I haven't convinced
myself that it's correct, but it checks out with some examples and
also for basic forms however what I've just discovered is that as in
below

EX7.<P,Q,R,S,V,W> = BooleanPolynomialRing(6,order='lex')
Prob(P + Q + R + S).ring() #yields an error message -- it doesn't seem
to know that it's parent ring should be ProbRing

Traceback (most recent call last):
   File
"/projects/5511fe15-8085-4d1d-bdc7-c6bf6c99e693/.sagemathcloud/sage_server.py",
line 733, in execute
     exec compile(block+'\n', '', 'single') in namespace, locals
   File "", line 1, in <module>
   File "element.pyx", line 344, in
sage.structure.element.Element.__getattr__
(sage/structure/element.c:4022)
   File "misc.pyx", line 257, in
sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1775)
AttributeError:
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'
object has no attribute 'ring'
 > [BIG SNIP]

You can use foo.parent() or parent(foo) instead.

P.S.:

sage: FOO.<P,Q,R,S,V,W> = BooleanPolynomialRing(6,order='lex')
sage: FOO.gens()
(P, Q, R, S, V, W)
sage: bar_gens_str = ','.join([ str(g).lower() for g in FOO.gens() ])
sage: BAR = PolynomialRing(QQ, bar_gens_str)
sage: BAR
Multivariate Polynomial Ring in p, q, r, s, v, w over Rational Field


sage: FOO('P + Q').parent() # of course works without quotes as well
Boolean PolynomialRing in P, Q, R, S, V, W

sage: BAR('p + q').parent()
Multivariate Polynomial Ring in p, q, r, s, v, w over Rational Field


-leif

--
() The ASCII Ribbon Campaign
/\   Help Cure HTML E-Mail

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to