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 Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ 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 URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
