Skip to main content

Generate transcendental numbers within a range using algebraic generators and transcendental functions.

Project description

transcendental-range

Tests PyPI version Python License: MIT

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_range can 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(10)
# [E, 2*E, exp(2), 3*E]

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

Author

Daniele Gregori

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transcendental_range-0.8.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transcendental_range-0.8.2-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file transcendental_range-0.8.2.tar.gz.

File metadata

  • Download URL: transcendental_range-0.8.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for transcendental_range-0.8.2.tar.gz
Algorithm Hash digest
SHA256 0a7e5ff7d8e5c402b746687cb8b262a8200edef4622c2d9a0e0ed9114ff35d79
MD5 2866409d69c6857384a2c865e774c061
BLAKE2b-256 c44ab25b65d5bff615988ed6b084c6802b7421318a5fa8d1a8fb4476eff5828b

See more details on using hashes here.

File details

Details for the file transcendental_range-0.8.2-py3-none-any.whl.

File metadata

File hashes

Hashes for transcendental_range-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a9ca611ac77afc1e47378f58355d11394f37867f5cc33e446c7e69ac7a641d2
MD5 a9ea013b524230385857cfd405c20d51
BLAKE2b-256 858fda01b515e79bf6293fe5164ed837e0733a17d5512e97815e44bf3afe8800

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page