ok, let me remake my question: how can i define a boolean matrix?
sure it is not over a ring, but in fact over a semi-ring.
let me quote a previous post:
"the key thing is to compute the reachability matrix of a digraph. an
awkward way to do it would be by computing the power series A+A^2+
\dots
+A^n, where n is the #vertices and A adjacency matrix, and replace
every nonzero element by 1."

so, that seems to be not a several-lines command on sage.

i submitted this to sage-edu because this came from my effort on
pushing sage in my university, on a very specific class. but giving it
a second thought, this should have gone to the sage-supp. sorry about
that.

pedro


On 14 Maio, 15:17, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, May 14, 2008 at 6:57 AM, David Joyner <[EMAIL PROTECTED]> wrote:
>
> > On Wed, May 14, 2008 at 8:54 AM, Pedro Patricio <[EMAIL PROTECTED]> wrote:
>
> >>  nope, booleans means 1+1=1.
> >>  take + as OR and * as AND in the propositional calculus.
>
> So 1+1 = 1 and 1*1 = 1 and 1*0 = 0 and 1+0 = 1 and 0+0=0?
> That's *not* a ring, so you shouldn't make matrices over it in
> Sage, since in Sage all matrices are over rings.
>
> You could "fake things" by creating a new "the booleans" data
> type but then you are asking for trouble since they aren't a ring.
>
> You could also just make a very simple boolean type with
> the properties you want and make a numpy matrix with
> entries that type.  What do you actually want to *do* with
> your boolean matrix?
>
>
>
> > I was afraid you were going to say that:-)
>
> > Does this help any?
>
> > sage: B = BooleanPolynomialRing(1,'x')
>
> I think this has little to do with what the original poster
> called "the booleans".   A boolean ring is by definition
> a ring R where y^2 = y for every y in R.    "The booleans"
> as defined by the original poster isn't even a ring.
>
>
>
> > sage: x = B.gen()
> > sage: x*x
> > x
> > sage: x*1
> > x
> > sage: x*B(0)
> > 0
> > sage: x+B(0)
> > x
> > sage: A = M([[x,0],[0,x]])
> > sage: A
>
> > [x 0]
> > [0 x]
> > sage: A*A
>
> > [x 0]
> > [0 x]
>
> > If not, I don't know what do to. Perhaps you should ask Michael 
> > Brickenstein,
> > who worked on the PolyBoRi interface.
> >http://opensourcemath.org/sage/doc/html/ref/node300.html#l2h-7751
>
> > In fact, you are actually asking on the wrong list. This list is for
> > using SAGE in teaching and it seems your question is how do you
> > construct the Boolean ring as a ring of coefficients for a matrix.
> > Therefore, I'm ccing the sage-support list on this. Maybe someone
> > there can help you better.
>
> >>  the key thing is to compute the reachability matrix of a digraph. an
> >>  awkward way to do it would be by computing the power series A+A^2+\dots
> >>  +A^n, where n is the #vertices and A adjacency matrix, and replace
> >>  every nonzero element by 1.
> >>  but i would like to take A over the booleans right from the begining.
>
> >>  thanks
> >>  pedro
>
> >>  On 14 Maio, 13:20, [EMAIL PROTECTED] wrote:
> >>  > David Joyner wrote:
>
> >> > > On Wed, May 14, 2008 at 6:29 AM, Pedro Patricio <[EMAIL PROTECTED]> 
> >> > > wrote:
>
> >>  > >>  hi all... i am sure you can easily help me with this one.
>
> >>  > >>  how can i define a matrix over the booleans? i know this is 
> >> trivially
> >>  > >>  done over ZZ and so forth.
>
> >>  > > If by booleans you mean GF(2), then just replace ZZ by GF(2) in the
> >>  > > construction you know over ZZ. Is that what you meant?
>
> >>  > Also, if you already have a matrix, you can convert it to a matrix over
> >>  > GF(2) by doing:
>
> >>  > m.change_ring(GF(2))
>
> >>  > Jason
>
> --
> William Stein
> Associate Professor of Mathematics
> University of Washingtonhttp://wstein.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
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-edu?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to