Generate ranges of algebraic numbers
Project description
algebraic-range
Generate ranges of algebraic numbers.
Python port of the Wolfram resource function "AlgebraicRange" resource function.
Requires SymPy ≥ 1.12.
Overview
algebraic_range creates ranges made of algebraic numbers. This extends the basic concept of range() to include, besides rational numbers, also roots — always restricted to the real domain.
The first two arguments represent the bounds of the range (minimum and maximum values), while the optional third and fourth arguments (by default equal to 1 and 0) regulate the upper and lower bounds of the steps (differences between successive elements).
Usage
algebraic_range(x) # Sqrt[Range[1, x²]] for x ≥ 1
algebraic_range(x, y) # Sqrt[Range[x², y²]] for 0 ≤ x ≤ y
algebraic_range(x, y, s) # step upper bound s, 0 < s ≤ y
algebraic_range(x, y, s, d) # step lower bound d, 0 ≤ d ≤ s
Parameters
| Parameter | Default | Description |
|---|---|---|
r1 |
(required) | Start of range (or single argument) |
r2 |
None |
End of range |
s |
None |
Step upper bound (negative → descending) |
d |
0 |
Step lower bound |
root_order |
2 |
int r → orders 2..r; [r] → only order r; [r1,r2,…] → listed orders |
step_method |
"Outer" |
"Outer" or "Root" |
farey_range |
False |
Use Farey-sequence–based rational multipliers |
formula_complexity_threshold |
inf |
Discard elements above this complexity |
algebraics_only |
True |
Reject transcendental inputs |
Options
root_order
# Include square and cubic roots
algebraic_range(2, root_order=3)
# Only cubic roots
algebraic_range(2, root_order=[3])
# Cubic and fifth roots
algebraic_range(1, Rational(3, 2), root_order=[3, 5])
step_method
# "Root" method: Sqrt[Range[x², y², s²]]
algebraic_range(0, 3, Rational(1, 3), step_method="Root")
The default "Outer" method uses the outer product construction. The "Root" method is generally a superset.
farey_range
algebraic_range(0, 3, Rational(1, 3), farey_range=True)
Generalises FareyRange by combining algebraic ranges over all Farey-sequence steps.
formula_complexity_threshold
# Only keep simple expressions
algebraic_range(4, root_order=4, formula_complexity_threshold=8)
algebraics_only
from sympy import sqrt, E
# This raises NotAlgebraicError:
# algebraic_range(0, 5, sqrt(E))
# Allow transcendental step:
algebraic_range(0, 5, sqrt(E), algebraics_only=False)
See also
For more details, properties and examples see the full documentation for the original Wolfram Language resource function AlgebraicRange, contributed by the same author and vetted by the Wolfram Review Team.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algebraic_range-0.8.2.tar.gz.
File metadata
- Download URL: algebraic_range-0.8.2.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ff6f447ce7800fb2d214f7ea4496cc1bc28c64cbf27204ed286254f3786c6a7
|
|
| MD5 |
c95b29f8a0776451ef9851a9d5aef778
|
|
| BLAKE2b-256 |
49b9ff52b59e83bad0dc49a9395ded1fdf934d1ed0284ee66b0394d94d4e7fdd
|
File details
Details for the file algebraic_range-0.8.2-py3-none-any.whl.
File metadata
- Download URL: algebraic_range-0.8.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d60899d45900914e539a2e922e5a15d3ab0f8ea54dff23b02edf9c4164287597
|
|
| MD5 |
38dba6163c0c7b23d1af171087fade70
|
|
| BLAKE2b-256 |
b017db2bf48cfcc2df3efb64ab7cf9b760cbb6a37f8da12573f8919786a93500
|