Hi Nicolas Learned a little about the Categories setup Next step is to override the __repr__ method
Is the "B[word: ....]" string formed in a __str__ or __repr__ method? If so, Im trying to work out where it is (so I can base the new code on it) I ran these... sage: C = AlgebrasWithBasis(QQ) sage: A = C.example(('p','q','r')) sage: (P,Q,R) = A.algebra_generators() sage: P.__repr__() 'B[word: p]' sage: P.__repr__?? # showed me code from devel/sage/sage/structure/sage_object.pyx sage: A.categories() [Category of algebras with basis over Rational Field, Category of modules with basis over Rational Field, Category of vector spaces over Rational Field, Category of algebras over Rational Field, Category of rings, Category of rngs, Category of monoids, Category of semigroups, Category of modules over Rational Field, Category of bimodules over Rational Field on the left and Rational Field on the right, Category of left modules over Rational Field, Category of right modules over Rational Field, Category of commutative additive groups, Category of commutative additive monoids, Category of commutative additive semigroups, Category of sets, Category of objects] Im guessing the code to make the "B[word: ....]" string may have been in a python file that corresponded to one of the Categories above but couldnt find it Appreciate any help thanks! Ross On Sat, Apr 10, 2010 at 6:12 AM, Nicolas M. Thiery <nicolas.thi...@u-psud.fr> wrote: > On Thu, Apr 01, 2010 at 04:41:53PM -0700, Ross Kyprianou wrote: >> Id like to write a package that can do "pure"/"abstract" matrix >> expressions such as in the following examples >> >> ... >> >> This isnt a full specification - there are many issues not addressed >> and note we are considering "pure matrix" expressions only (i.e. no >> matrix components). Also the matrix size "N" is arbitrary - doesnt >> ever need to be assigned a value. I can think of two ways of doing >> this and just asking for peoples gut feeling which direction I should >> go in to implement this within Sage. >> >> Possibility 1) We consider this a noncommutative algebra and look at >> GAP (are there other possiblilities?) > > You may want to look at: > > sage: A = AlgebrasWithBasis(QQ).example() > sage: A? > > For how to easily implement things like free commutative algebras. > Here your basis could typically be indexed by a triple of the form: > > (name, nrows, ncols) > > where name is a string, and nrows / ncols integer or anything else. > This triple should probably be wrapped as a python object in some new > class for nicer output. > > Then the product of two such triples would just check equality of > ncols w.r.t. nrows, and throw an error if not (ok because of that, you > don't quite get an algebra, but that's good enough as a starter). > > Feel free to ask for help if needed! > > Best, > Nicolas > -- > Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> > http://Nicolas.Thiery.name/ > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > > To unsubscribe, reply using "remove me" as the subject. > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org