A generator of infinite sequences of figurate numbers for Python.
Project description
FigurateNum
FigurateNum is a set of figurate number generators based on the book Figurate Numbers (2012) by Michel Deza and Elena Deza.
FigurateNum generates the following types of infinite sequences:
- 74 sequences of plane figurate numbers
- 84 sequences of space figurate numbers
- 68 sequences of multidimensional figurate numbers
What is the purpose of FigurateNum?
FigurateNum facilitates the discovery of new patterns among sequences and enables various numerical calculations in mathematical projects and related endeavors. It can be integrated with other software to visualize the geometric objects described. Moreover, it serves as a valuable companion to the book!
How to install?
pip install figuratenum
How to import figuratenum?
import figuratenum as fgn
How to use?
>>> seq = fgn.hyperdodecahedral_numbers()
>>> first = next(seq)
>>> second = next(seq)
>>> third = next(seq)
>>> fourth = next(seq)
>>> print(first, second, third, fourth)
1 600 4983 19468
You could get a list of numbers using a loop:
>>> generator = fgn.k_dimensional_centered_hypertetrahedron_numbers(21)
>>> sequence = []
>>> for _ in range(1, 15):
>>> next_num = next(generator)
>>> sequence.append(next_num)
>>> print(sequence)
[1, 23, 276, 2300, 14950, 80730, 376740, 1560780, 5852925, 20160075, 64512240, 193536720, 548354040, 1476337800]
Alternative usage via FigurateNum class
from figuratenum import FigurateNum as fgn
Importing the FigurateNum
class allows you to use practical methods to return lists, tuples or arrays with the requested number of elements:
take(n)
take_to_list(stop, start, step)
take_to_array(stop, start, step)
take_to_tuple(stop, start, step)
pick(n)
>>> print(fgn.generalized_dodecahedral_numbers(-3).take(8))
[-165, -56, -10, 0, 1, 20, 84, 220]
>>> print(fgn.octadecagonal_pyramidal_numbers().take_to_array(5))
array('i', [1, 19, 70, 170, 335])
Plane figurate numbers
polygonal_numbers
triangular_numbers
square_numbers
pentagonal_numbers
hexagonal_numbers
heptagonal_numbers
octagonal_numbers
nonagonal_numbers
decagonal_numbers
hendecagonal_numbers
dodecagonal_numbers
tridecagonal_numbers
tetradecagonal_numbers
pentadecagonal_numbers
hexadecagonal_numbers
heptadecagonal_numbers
octadecagonal_numbers
nonadecagonal_numbers
icosagonal_numbers
icosihenagonal_numbers
icosidigonal_numbers
icositrigonal_numbers
icositetragonal_numbers
icosipentagonal_numbers
icosihexagonal_numbers
icosiheptagonal_numbers
icosioctagonal_numbers
icosinonagonal_numbers
triacontagonal_numbers
centered_triangular_numbers
centered_square_numbers
=diamond numbers
centered_pentagonal_numbers
centered_hexagonal_numbers
centered_heptagonal_numbers
centered_octagonal_numbers
centered_nonagonal_numbers
centered_decagonal_numbers
centered_hendecagonal_numbers
centered_dodecagonal_numbers
=star_numbers
centered_tridecagonal_numbers
centered_tetradecagonal_numbers
centered_pentadecagonal_numbers
centered_hexadecagonal_numbers
centered_heptadecagonal_numbers
centered_octadecagonal_numbers
centered_nonadecagonal_numbers
centered_icosagonal_numbers
centered_icosihenagonal_numbers
centered_icosidigonal_numbers
centered_icositrigonal_numbers
centered_icositetragonal_numbers
centered_icosipentagonal_numbers
centered_icosihexagonal_numbers
centered_icosiheptagonal_numbers
centered_icosioctagonal_numbers
centered_icosinonagonal_numbers
centered_triacontagonal_numbers
centered_mgonal_numbers
pronic_numbers
=heteromecic_numbers = oblong_numbers
polite_numbers
impolite_numbers
cross_numbers
aztec_diamond_numbers
polygram_numbers(m)
=centered_star_polygonal_numbers(m)
pentagram_numbers
gnomic_numbers
truncated_triangular_numbers
truncated_square_numbers
truncated_pronic_numbers
truncated_centered_pol_numbers(m)
=truncated_centered_mgonal_numbers(m)
truncated_centered_hexagonal_numbers
=truncated_hex_numbers
generalized_mgonal_numbers(m, start_numb)
generalized_centered_pol_numbers(m, start_numb)
generalized_pronic_numbers(start_numb)
Space figurate numbers
m_pyramidal_numbers(m)
triangular_pyramidal_numbers
square_pyramidal_numbers
=pyramidal_numbers
pentagonal_pyramidal_numbers
hexagonal_pyramidal_numbers
heptagonal_pyramidal_numbers
octagonal_pyramidal_numbers
nonagonal_pyramidal_numbers
decagonal_pyramidal_numbers
hendecagonal_pyramidal_numbers
dodecagonal_pyramidal_numbers
tridecagonal_pyramidal_numbers
tetradecagonal_pyramidal_numbers
pentadecagonal_pyramidal_numbers
hexadecagonal_pyramidal_numbers
heptadecagonal_pyramidal_numbers
octadecagonal_pyramidal_numbers
nonadecagonal_pyramidal_numbers
icosagonal_pyramidal_numbers
icosihenagonal_pyramidal_numbers
icosidigonal_pyramidal_numbers
icositrigonal_pyramidal_numbers
icositetragonal_pyramidal_numbers
icosipentagonal_pyramidal_numbers
icosihexagonal_pyramidal_numbers
icosiheptagonal_pyramidal_numbers
icosioctagonal_pyramidal_numbers
icosinonagonal_pyramidal_numbers
triacontagonal_pyramidal_numbers
triangular_tetrahedral_numbers[finite]
triangular_square_pyramidal_numbers[finite]
square_tetrahedral_numbers[finite]
square_square_pyramidal_numbers[finite]
tetrahedral_square_pyramidal_numbers[finite]
cubic_numbers
tetrahedral_numbers
octahedral_numbers
dodecahedral_numbers
icosahedral_numbers
truncated_tetrahedral_numbers
truncated_cubic_numbers
truncated_octahedral_numbers
stella_octangula_numbers
centered_cube_numbers
rhombic_dodecahedral_numbers
hauy_rhombic_dodecahedral_numbers
centered_tetrahedron_numbers
=centered_tetrahedral_numbers
centered_square_pyramid_numbers
=centered_pyramid_numbers
centered_mgonal_pyramid_numbers(m)
centered_pentagonal_pyramid_numbers
centered_hexagonal_pyramid_numbers
centered_heptagonal_pyramid_numbers
centered_octagonal_pyramid_numbers
centered_octahedron_numbers
centered_icosahedron_numbers
=centered_cuboctahedron_numbers
centered_dodecahedron_numbers
centered_truncated_tetrahedron_numbers
centered_truncated_cube_numbers
centered_truncated_octahedron_numbers
centered_mgonal_pyramidal_numbers(m)
centered_triangular_pyramidal_numbers
centered_square_pyramidal_numbers
centered_pentagonal_pyramidal_numbers
centered_heptagonal_pyramidal_numbers
centered_octagonal_pyramidal_numbers
centered_nonagonal_pyramidal_numbers
centered_decagonal_pyramidal_numbers
centered_hendecagonal_pyramidal_numbers
centered_dodecagonal_pyramidal_numbers
centered_hexagonal_pyramidal_numbers
=hex_pyramidal_numbers
hexagonal_prism_numbers
mgonal_prism_numbers(m)
generalized_mgonal_pyramidal_numbers(m, start_num)
generalized_cubic_numbers(start_num)
generalized_octahedral_numbers(start_num)
generalized_icosahedral_numbers(start_num)
generalized_dodecahedral_numbers(start_num)
generalized_centered_cube_numbers(start_num)
generalized_centered_tetrahedron_numbers(start_num)
generalized_centered_square_pyramid_numbers(start_num)
generalized_rhombic_dodecahedral_numbers(start_num)
generalized_centered_mgonal_pyramidal_numbers(m, start_num)
generalized_mgonal_prism_numbers(m, start_num)
generalized_hexagonal_prism_numbers(start_num)
Multidimensional figurate numbers
pentatope_numbers
=hypertetrahedral_numbers
=triangulotriangular_numbers
k_dimensional_hypertetrahedron_numbers(k)
=k_hypertetrahedron_numbers(k)
=regular_k_polytopic_numbers(k)
=figurate_numbers_of_order_k(k)
five_dimensional_hypertetrahedron_numbers
six_dimensional_hypertetrahedron_numbers
biquadratic_numbers
k_dimensional_hypercube_numbers(k)
=k_hypercube_numbers(k)
five_dimensional_hypercube_numbers
six_dimensional_hypercube_numbers
hyperoctahedral_numbers
=hexadecachoron_numbers
=four_cross_polytope_numbers
=four_orthoplex_numbers
hypericosahedral_numbers
=tetraplex_numbers
=polytetrahedron_numbers
=hexacosichoron_numbers
hyperdodecahedral_numbers
=hecatonicosachoron_numbers
=dodecaplex_numbers
=polydodecahedron_numbers
polyoctahedral_numbers
=icositetrachoron_numbers
=octaplex_numbers
=hyperdiamond_numbers
four_dimensional_hyperoctahedron_numbers
five_dimensional_hyperoctahedron_numbers
six_dimensional_hyperoctahedron_numbers
seven_dimensional_hyperoctahedron_numbers
eight_dimensional_hyperoctahedron_numbers
nine_dimensional_hyperoctahedron_numbers
ten_dimensional_hyperoctahedron_numbers
k_dimensional_hyperoctahedron_numbers(k)
=k_cross_polytope_numbers(k)
four_dimensional_mgonal_pyramidal_numbers(m)
=mgonal_pyramidal_numbers_of_the_second_order(m)
four_dimensional_square_pyramidal_numbers
four_dimensional_pentagonal_pyramidal_numbers
four_dimensional_hexagonal_pyramidal_numbers
four_dimensional_heptagonal_pyramidal_numbers
four_dimensional_octagonal_pyramidal_numbers
four_dimensional_nonagonal_pyramidal_numbers
four_dimensional_decagonal_pyramidal_numbers
four_dimensional_hendecagonal_pyramidal_numbers
four_dimensional_dodecagonal_pyramidal_numbers
k_dimensional_mgonal_pyramidal_numbers(k, m)
=mgonal_pyramidal_numbers_of_the_k_2_th_order(k, m)
five_dimensional_mgonal_pyramidal_numbers(m)
five_dimensional_square_pyramidal_numbers
five_dimensional_pentagonal_pyramidal_numbers
five_dimensional_hexagonal_pyramidal_numbers
five_dimensional_heptagonal_pyramidal_numbers
five_dimensional_octagonal_pyramidal_numbers
six_dimensional_mgonal_pyramidal_numbers(m)
six_dimensional_square_pyramidal_numbers
six_dimensional_pentagonal_pyramidal_numbers
six_dimensional_hexagonal_pyramidal_numbers
six_dimensional_heptagonal_pyramidal_numbers
six_dimensional_octagonal_pyramidal_numbers
centered_biquadratic_numbers
k_dimensional_centered_hypercube_numbers(k)
five_dimensional_centered_hypercube_numbers
six_dimensional_centered_hypercube_numbers
centered_polytope_numbers
k_dimensional_centered_hypertetrahedron_numbers(k)
five_dimensional_centered_hypertetrahedron_numbers
six_dimensional_centered_hypertetrahedron_numbers
centered_hyperoctahedral_numbers
=orthoplex_numbers
nexus_numbers(k)
k_dimensional_centered_hyperoctahedron_numbers(k)
five_dimensional_centered_hyperoctahedron_numbers
six_dimensional_centered_hyperoctahedron_numbers
generalized_pentatope_numbers(start_num = 0)
generalized_k_dimensional_hypertetrahedron_numbers(k = 5, start_num = 0)
generalized_biquadratic_numbers(start_num = 0)
generalized_k_dimensional_hypercube_numbers(k = 5, start_num = 0)
generalized_hyperoctahedral_numbers(start_num = 0)
generalized_k_dimensional_hyperoctahedron_numbers(k = 5, start_num = 0)
generalized_hyperdodecahedral_numbers(start_num = 0)
generalized_hypericosahedral_numbers(start_num = 0)
generalized_polyoctahedral_numbers(start_num = 0)
generalized_k_dimensional_mgonal_pyramidal_numbers(k, m, start_num = 0)
generalized_k_dimensional_centered_hypercube_numbers(k, start_num = 0)
generalized_nexus_numbers(start_num = 0)
Contributing
FigurateNumber is currently under development, and we warmly invite your contributions. Just fork the project and then submit a pull request:
- Sequences from Chapters 1, 2, and 3 of the book
- New sequences not included in the book: If you have new sequences, please provide the source.
- Tests, documentation and errata in the book
When making commits, please use the following conventional prefixes to indicate the nature of the changes: feat
, refactor
, fix
, docs
, and test
.
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
Built Distribution
File details
Details for the file figuratenum-0.8.0.tar.gz
.
File metadata
- Download URL: figuratenum-0.8.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f39757b77410088ad66f1362481f77f9adff5d5af6fa3c612c85eda415c2e2e3 |
|
MD5 | ac91cd36caf0feeeaa0fe6dce6017cff |
|
BLAKE2b-256 | 6182093d1eacadabd290b19698dc93f62ab22318c9045f00d243206e9b0d565f |
File details
Details for the file figuratenum-0.8.0-py3-none-any.whl
.
File metadata
- Download URL: figuratenum-0.8.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d584d44b5657cc7e364ab7d28e0655532db4c5dd4002f277dbb11f45b32c536 |
|
MD5 | a105bde72bd17985687235a38926bf36 |
|
BLAKE2b-256 | 7e0fcdaebe82d76026bf6e9c27acd521b273a8e265aded618135bacd426dca3e |