Dear Andrew, dear Éric,

On Tue, Nov 11, 2014 at 12:33:35AM -0800, Andrew wrote:
>    My comment wasn't intended as a criticism of the code or of anyone:

No worry, there was no ambiguity :-)

>    Down the track, what I would like to see is a way of dynamically
>    adding bases to a CombinatorialFreeModule without these new bases
>    having to be part of the sage source code. For example, it is
>    possible to do this in chevie.

Is this close enough from what you would want?

    sage: F = CombinatorialFreeModule(QQ, [1,2,3])
    sage: G = CombinatorialFreeModule(QQ, [4,5,6])
    sage: phi = F.module_morphism(lambda i: G.monomial(i+3), codomain=G)
    sage: psi = G.module_morphism(lambda i: F.monomial(i-3), codomain=F)
    sage: phi.register_as_coercion()
    sage: psi.register_as_coercion()

    sage: F(G.an_element())
    2*B[1] + 2*B[2] + 3*B[3]
    sage: G(F.an_element())
    2*B[4] + 2*B[5] + 3*B[6]
    sage: F.an_element() + G.an_element()
    4*B[1] + 4*B[2] + 6*B[3]

There are more details in the Sage-Combinat tutorial «Implementing
Algebraic Structures»:

        
http://combinat.sagemath.org/doc/thematic_tutorials/tutorial-implementing-algebraic-structures.html#tutorial-implementing-algebraic-structures

There is one main limitation: if F and G are algebras, you need to
define explicitly the product on both sides (possibly trivially by
doing the back and forth with the other side). In MuPAD, the coercion
system did automatically the right thing ...

>    From my quick look at the manifold code, it seems that it allows
>    something in this direction.

I added Eric Gourgoulhon in CC to point him to this thread.

Cheers,
                                Nicolas
--
Nicolas M. Thiéry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

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

Reply via email to