Ticket #9020 (closed enhancement: fixed)
random degrees for random_element()s univariate polynomial rings
| Reported by: | burcin | Owned by: | AlexGhitza |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.4.4 |
| Component: | basic arithmetic | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | John Cremona |
| Authors: | Burcin Erocal | Merged in: | sage-4.4.4.alpha0 |
| Dependencies: | Stopgaps: |
Description
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]
Attachments
Change History
comment:1 Changed 3 years ago by burcin
- Status changed from new to needs_review
- Authors set to Burcin Erocal
Note: See
TracTickets for help on using
tickets.

