Hi John!
On Wed, May 12, 2010 at 08:31:38AM -0700, Mike Hansen wrote:
> ---------- Forwarded message ----------
> From: John H Palmieri <[email protected]>
>
> I have some (hashable) Sage objects, elements of a particular algebra,
> and I want to view them as the basis of a vector space. Call the
> objects a, b, c. I think the way to do this in Sage is
>
> sage: V = CombinatorialFreeModule(QQ, [a,b,c])
>
> Suppose I have another such vector space:
>
> sage: W = CombinatorialFreeModule(QQ, [e,f])
>
> and I define a map between them:
>
> sage: B = W.basis()
> sage: g = V.hom([2*B[e]-B[f], B[e]+B[f], 0], QQ)
>
> How do I compute the kernel of this map, or the matrix associated to
> it (with respect to the chosen bases), or evaluate it on elements of
> V? For example:
>
> sage: BB = V.basis()
> sage: g(BB[a])
>
> produces an error. So how should I be performing these kinds of
> calculations?
To construct a morphism of module, please use
V.module_morphism(on_basis = {a:2*B[e]=B[f], b: ...}.__getitem__, codomain
= W)
Note: the above call could be simplified to not require the
__getitem__, and guess what the codomain is.
I have no idea what V.hom is currently doing; it should eventually
call module_morphism but that will have to wait the big homsets &
categories overhaul (tm).
There is a patch under development in the Sage-Combinat queue which
implements the matrix of a morphism between two finite dimensional
spaces. See:
http://combinat.sagemath.org/patches/file/tip/trac_8678-module_morphisms-nt.patch
I am not sure when I will get to finalize this and merge it into Sage
though. Volunteers to take this patch over are welcome.
As for the kernel: this almost got implemented during Sage Days 20.5,
but finally we dropped this for a shortcut. We definitely need this
feature, and a patch would be most welcome; I can give directions :-)
Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <[email protected]>
http://Nicolas.Thiery.name/
--
You received this message because you are subscribed to the Google Groups
"sage-combinat-devel" 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-combinat-devel?hl=en.