#15364: Introduce factor_or_zero into global namespace
-------------------------------------+-------------------------------------
Reporter: zabrocki | Owner:
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-6.0
Component: factorization | Resolution:
Keywords: | Merged in:
Authors: Mike Zabrocki | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
public/ticket/15364/zabrocki/factor_or_zero|
1e0e3da44e609c65c2b6b269f80991d01a33b844
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:9 zabrocki]:
> You are right. For consistency it should return a factorization object
rather than an actual 0.
And now compare:
{{{
sage: var('x')
x
sage: factor(x^2-1) #this is just a symbolic_expression
(x - 1)*(x + 1)
sage: PQ.<X>=QQ[]
sage: factor(X^2-1)
(X - 1) * (X + 1)
sage: factor(X^2-1).universe()
Univariate Polynomial Ring in X over Rational Field
sage: PZ.<Y>=ZZ[]
sage: factor(Y^2-1)
(Y - 1) * (Y + 1)
sage: factor(Y^2-1).universe()
Univariate Polynomial Ring in Y over Integer Ring
}}}
you should probably be consistent with that too.
From the application you describe, I guess you're mostly interested in
application to SR (the first case) in which case the most appropriate
thing to do is probably to add a method `simplify_factor` to
SymbolicExpression, which could happily simplify the expression "0" to the
product "0". In the other cases, the code is just a lot clearer if people
specify their own little one-off function that does with 0 what they want.
--
Ticket URL: <http://trac.sagemath.org/ticket/15364#comment:10>
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/groups/opt_out.