Opened 10 years ago

Last modified 10 years ago

## #11725 closed enhancement

# Generate random elements of the algebraic field — at Initial Version

Reported by: | rbeezer | Owned by: | AlexGhitza |
---|---|---|---|

Priority: | minor | Milestone: | sage-4.7.2 |

Component: | algebra | Keywords: | random, QQbar, sd32 |

Cc: | spice | Merged in: | |

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

Random elements of QQbar default to the method implemented for the integers. This patch creates algebraic numbers via roots of random polynomials with integer coefficients.

Implementation notes:

- Degree 2 is the default so that some complex numbers are generated.
- Might create constant polynomials, so a monic term (of random degree) may be added.
- Could be some efficiencies to be gained by not creating all the roots and choosing just one, but this should be a good start.
- Real goal was random vectors over
`QQbar`

. A doctest demonstrates how control of the integer coefficients can be passed from`random_vector()`

to the`QQbar.random_element()`

to `ZZ.random_element().

**Note:**See TracTickets for help on using tickets.