Generate transcendental numbers within a range using algebraic generators and transcendental functions.
Project description
transcendental-range
Generate ranges of transcendental numbers.
Python port of the Wolfram Language resource function TranscendentalRange.
Usage
from transcendental_range import transcendental_range
transcendental_range(x) gives all transcendental numbers of the form t = b e^a with 1 <= t <= x and a, b algebraics in range(1, x).
transcendental_range(x, y) gives all transcendental numbers of the form t = b e^a with x <= t <= y and a, b algebraics in range(x, y).
transcendental_range(x, y, s) uses a step parameter s for the generator range.
transcendental_range(x, y, s, d) requires a minimum step d between successive elements.
Details
-
transcendental_rangecan systematically generate various types of transcendental numbers. -
Transcendental numbers are irrational numbers that cannot be expressed as solutions of any polynomial equation with integer coefficients (that is, they are not algebraic numbers).
-
By default, the range elements are generated according to the Lindemann-Weierstrass theorem, that is linear combinations of exponentials t = b e^a, for all algebraic arguments and coefficients a, b that are members of range(x, y), or possibly range(x, y, s) using a step parameter s.
-
For all the available transcendental types, the generated exact numbers have been mathematically proven to be transcendental through the theorems of Lindemann-Weierstrass, Gelfond-Schneider and Baker (cf. Baker, 1975 - Transcendental Number Theory).
-
The elements are returned as exact sympy expressions, sorted by numerical value.
Options
transcendental_range accepts the following keyword arguments:
| Option | Default | Description |
|---|---|---|
method |
'exp' |
Function for generating transcendental numbers |
generators_domain |
'rationals' |
Type of algebraic generators for the function arguments |
farey_range |
False |
Set the step denominators as in the Farey sequence |
formula_complexity_threshold |
math.inf |
Limit the complexity of the expressions |
working_precision |
15 |
Precision for all internal numerical evaluations |
method
The method option specifies the transcendental function used to generate numbers. Available values:
| Method | Form |
|---|---|
'exp' |
b exp(a) |
'log' |
b log(a) |
'power' |
a^b |
'sin', 'cos', 'tan', 'cot', 'sec', 'csc' |
b f(a) |
'sinh', 'cosh', 'tanh', 'coth', 'sech', 'csch' |
b f(a) |
'asin', 'acos', 'atan', 'acot', 'asec', 'acsc' |
b f(a) |
'asinh', 'acosh', 'atanh', 'acoth', 'asech', 'acsch' |
b f(a) |
| list of the above | combined range |
'all' |
all of the above types |
For the method 'power', only algebraic irrational generators in the exponent b can produce transcendental numbers (Gelfond-Schneider theorem).
generators_domain
The generators_domain option specifies whether the arguments a, b should belong to the rationals ('rationals') or to the algebraics ('algebraics'), as generated by range and algebraic_range respectively. These are restricted to be real numbers.
formula_complexity_threshold
The output can be restricted by setting a threshold for the complexity of the numeric expressions involved. The corresponding numerical values are assigned through a heuristic recipe provided by formula_complexity from the algebraic-range package.
Examples
from transcendental_range import transcendental_range
transcendental_range(5)
# [exp(1), 2*exp(1)/3, exp(2)/3, 3*exp(1)/4, exp(1)/2, ...]
Generate transcendental numbers using the logarithm:
transcendental_range(-2, 2, method='log')
# [-2*log(2), -log(2), log(2), 2*log(2)]
Use the 'power' method with algebraic generators to produce numbers of the form a^b with irrational exponents (Gelfond-Schneider theorem):
from sympy import Rational
transcendental_range(-1, Rational(3, 2), Rational(1, 2),
method='power', generators_domain='algebraics')
# [(1/2)**sqrt(2), (1/2)**(sqrt(2)/2), (sqrt(2)/2)**(sqrt(2)/2),
# 2**(sqrt(2)/4), (3/2)**(sqrt(2)/2)]
Generate transcendental numbers using the inverse tangent (multiples of pi appear naturally):
transcendental_range(-3, 3, method='atan')
# [-2*atan(3), -3*pi/4, -2*atan(2), -pi/2, -atan(3), -atan(2),
# -pi/4, pi/4, atan(2), atan(3), pi/2, 2*atan(2), 3*pi/4, 2*atan(3)]
Use step, minimum separation and formula complexity threshold together:
transcendental_range(0, 20, Rational(1, 4), 2, formula_complexity_threshold=6)
# [exp(1/4)/4, 3*exp(1/2)/2, exp(3/2), 4*exp(1/2), 13*E/4,
# 4*E, 19*E/4, 11*E/2, 25*E/4, 7*E]
For more examples and details, see the Wolfram Language documentation.
Dependencies
- sympy >= 1.12
- algebraic-range >= 0.8.0
Author
Daniele Gregori
License
MIT
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 transcendental_range-0.8.1.tar.gz.
File metadata
- Download URL: transcendental_range-0.8.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fca717107f69c79a420c5cfad8150df0d7281310c1bbf0f783867e2d01cd8ff
|
|
| MD5 |
4ea945644e7f733c43f6aa1f90cec7e2
|
|
| BLAKE2b-256 |
c5a3fa76074b97658ed98fa7c34b176bbb6a1ff4251af1a4f53d83ab335f601e
|
File details
Details for the file transcendental_range-0.8.1-py3-none-any.whl.
File metadata
- Download URL: transcendental_range-0.8.1-py3-none-any.whl
- Upload date:
- Size: 13.5 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 |
13f66dc4fb707172952e64bc4f2cc6c67cb801ac15e4a0ff6d4a4fb8f34aeb05
|
|
| MD5 |
b01023a3fc770a1e5e599a464fd0002f
|
|
| BLAKE2b-256 |
9250e8d1139acbc40b68e2a16fc36b6d53a88ea38df124ea4d305cfd2b35428b
|