#9020: random degrees for random_element()s univariate polynomial rings
--------------------------------+-------------------------------------------
Reporter: burcin | Owner: AlexGhitza
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.4.3
Component: basic arithmetic | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Attached patch allows using a tuple as the `degree` argument when calling
the `random_element()` method of univariate polynomial rings. The tuple
specifies the minimum and maximum degrees so we don't always get
polynomials of the same degree:
{{{
sage: R.<x> = ZZ[]
sage: R.random_element(degree=(0,8))
2*x^7 - x^5 + 4*x^4 - 5*x^3 + x^2 + 14*x - 1
sage: R.random_element(degree=(0,8))
-2*x^3 + x^2 + x + 4
}}}
This is also directly usable by matrices:
{{{
sage: M = Matrix(R,2,2)
sage: M.randomize(degree=(0,6))
sage: M
[ -40*x^3 - 3*x^2 - 5*x -x^4 + 476*x^3 - 3*x + 3]
[-12*x^6 + 2*x^4 - x^3 + x^2 + x - 1 -52*x + 5]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9020>
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.