#10852: CombinatorialFreeModule contains bug in latex method and is missing a
latex_prefix
-------------------------------+--------------------------------------------
Reporter: stumpc5 | Owner: sage-combinat
Type: defect | Status: needs_review
Priority: major | Milestone:
Component: combinatorics | Keywords: latex, CombinatorialFreeModule
Author: Christian Stump | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------------+--------------------------------------------
Description changed by stumpc5:
Old description:
> This patch provides a bugfix for the latex method for
> `CombinatorialFreeModule` as discussed here:
>
> http://groups.google.com/group/sage-combinat-
> devel/browse_thread/thread/c2f3ca216ea88a96
>
> The bug looked like this:
>
> {{{
> sage: X = CombinatorialFreeModule(QQ,ZZ)
> sage: x = X.an_element()
> sage: x
> 3*B[-1] + B[0] + 3*B[1]
> sage: latex(x)
> ------------------------------------------------------------
> ...
> mons = [ prefix + '_{' + ",".join(map(str, m)) + '}' for (m, _) in v ]
> TypeError: argument 2 to map() must support iteration
> }}}
>
> Now, this is fixed:
>
> {{{
> sage: X = CombinatorialFreeModule(QQ,ZZ)
> sage: x = X.an_element()
> sage: x
> 3*B[-1] + B[0] + 3*B[1]
> sage: latex(x)
> 3B_{-1} + B_{0} + 3B_{1}
> }}}
>
> It also provides a new optional argument latex_prefix for
> `CombinatorialFreeModule` in order to be able to get a latex symbol as
> output:
>
> {{{
> sage: X =
> CombinatorialFreeModule(QQ,ZZ,prefix='beta',latex_prefix='\\beta')
> sage: x = X.an_element()
> sage: x
> 3*beta[-1] + beta[0] + 3*beta[1]
> sage: latex(x)
> 3\beta_{-1} + \beta_{0} + 3\beta_{1}
> }}}
New description:
This patch provides a bugfix for the latex method for
`CombinatorialFreeModule` as discussed here:
http://groups.google.com/group/sage-combinat-
devel/browse_thread/thread/c2f3ca216ea88a96
The bug looked like this:
{{{
sage: X = CombinatorialFreeModule(QQ,ZZ)
sage: x = X.an_element()
sage: x
3*B[-1] + B[0] + 3*B[1]
sage: latex(x)
------------------------------------------------------------
...
mons = [ prefix + '_{' + ",".join(map(str, m)) + '}' for (m, _) in v ]
TypeError: argument 2 to map() must support iteration
}}}
Now, this is fixed:
{{{
sage: X = CombinatorialFreeModule(QQ,ZZ)
sage: x = X.an_element()
sage: x
3*B[-1] + B[0] + 3*B[1]
sage: latex(x)
3B_{-1} + B_{0} + 3B_{1}
}}}
It also provides a new optional argument latex_prefix for
`CombinatorialFreeModule` in order to be able to get a latex symbol as
output:
{{{
sage: X =
CombinatorialFreeModule(QQ,ZZ,prefix='beta',latex_prefix='\\beta')
sage: x = X.an_element()
sage: x
3*beta[-1] + beta[0] + 3*beta[1]
sage: latex(x)
3\beta_{-1} + \beta_{0} + 3\beta_{1}
}}}
Also, this new feature is applied for the root space for root systems:
{{{
sage: L = RootSystem(['A',3]).root_lattice()
sage: Lvee = L.coroot_lattice()
sage: L.simple_root(1)
alpha[1]
sage: latex(L.simple_root(1))
\alpha_{1}
sage: Lvee.simple_root(1)
alphacheck[1]
sage: latex(Lvee.simple_root(1))
\alpha^\vee_{1}
}}}
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10852#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac?hl=en.