#17624: Coerce factorization of polynomial to symbolic expression
---------------------------+----------------------------
Reporter: gagern | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.5
Component: symbolics | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
---------------------------+----------------------------
Dealing with polynomial rings is nice, but the fact that they always
present their content in fully expanded form can make it hard to read
results. For a single polynomial, computing its factorization can help.
But for e.g. a vector or matrix composed of factorizations, this is not
possible.
{{{
sage: R.<a,b> = QQ[]
sage: m = matrix([[a^2-b^2, a^3-a*b^2], [a*b + b^2, -77*a+77*b]])
sage: factor(m[0,0])
(a - b) * (a + b)
sage: m.apply_map(factor)
TypeError: x must be a list
sage: SR(factor(m[0,0]))
TypeError:
sage: m.apply_map(lambda x: SR(str(factor(x))))
[ (a + b)*(a - b) (a + b)*(a - b)*a]
[ (a + b)*b -77*a + 77*b]
sage: m[1,1].factor()
(-77) * (a - b)
}}}
It would be nice if the `apply_map(factor)` call would simply work,
returning a matrix of symbolic expressions to help reading that matrix.
The detour via `str` is a very hackish workaround, in my opinion.
Note that SR will automatically expand some things, as evidenced by the
coeffcicient 77 in the example above. I guess that could only be avoided
if we could have matrices of factorizations. That would be a viable
alternative, and might be worth its own ticket, but I think coercion to SR
might have other benefits as well, so this ticket here is about that
coercion.
--
Ticket URL: <http://trac.sagemath.org/ticket/17624>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.