On May 5, 10:21 am, Volker Braun <vbraun.n...@gmail.com> wrote: > Thats a bug. Its tricky because it involves homs from a FreeModule to a > FGP_Module. If you stay within FGP_Modules then it works:
Great! That has almost everything on it that I need. Intersection and sum of submodules don't seem to exist yet, though. Should we implement those somewhere? I think the following two functions do the trick. Suggestions on improvements and/or naming and/or where they should go? I would guess they should be methods on sage.modules.fg_pid.fgp_module.FGP_Module_class def intersect_submodules(M,S1,S2): Q1=M/S1 Q2=M/S2 R12=Q1.relations().direct_sum(Q2.relations()) R12ambient=R12.ambient_module() Q12=R12ambient/R12 return M.hom([Q12(R12ambient(list(Q1(b).lift()) +list(Q2(b).lift()))) for b in M.gens()]).kernel() def sum_submodules(M,S1,S2): return M.submodule([M(b) for b in S1.gens()+S2.gens()]) Z3=ZZ^3 M=Z3/Z3.span([36*Z3.0]) S1=M.submodule([6*M.0,3*M.1+3*M.2,3*M.1-3*M.2]) S2=M.submodule([8*M.0,6*M.2]) intersect_submodules(M,S1,S2) sum_submodules(M,S1,S2) -- 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