figurate_numbers
Figurate Numbers generates 241 infinite sequences of plane, space, and multidimensional figurate numbers based on the book ‘Figurate Numbers’ (2012) by Elena Deza and Michel Deza. The methods are implemented using the Enumerator class and are designed for use in your math projects or in Sonic Pi.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Repository
Figurate Numbers generates 241 infinite sequences of plane, space, and multidimensional figurate numbers based on the book ‘Figurate Numbers’ (2012) by Elena Deza and Michel Deza. The methods are implemented using the Enumerator class and are designed for use in your math projects or in Sonic Pi.
Basic Info
- Host: GitHub
- Owner: edelveart
- License: mit
- Language: Ruby
- Default Branch: main
- Homepage: https://rubygems.org/gems/figurate_numbers
- Size: 692 KB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 3
Topics
Metadata Files
README.md
Figurate Numbers
Figurate Numbers is the most comprehensive and specialized library for figurate numbers, developed in Ruby to date. It implements 241 infinite number sequences inspired by the groundbreaking work Figurate Numbers by Elena Deza and Michel Deza, published in 2012.
Installation
Install it from the gem repository:
rb
gem install figurate_numbers
Features
Figurate Numbers implements 241 infinite sequences using the Enumerator class in Ruby, each categorized by its geometric dimension. It is ideal for use in mathematical modeling, algorithmic composition, and integration with tools like Sonic Pi.
The sequences are organized following the structure of the Figurate Numbers book:
- PlaneFigurateNumbers: 79 sequences (2D)
- SpaceFigurateNumbers: 86 sequences (3D)
- MultiDimensionalFigurateNumbers: 70 sequences (4D and beyond)
- Zoo of figurate-related numbers: 6 additional sequences (included in the MultiDimensional module)
- ArithTransform: p-adic transformations and other arithmetic operations
See detailed list of sequences below
How to use in Ruby
Version 1.5.0
```rb require 'figurate_numbers'
Using take(integer)
FigurateNumbers.pentatope.take(10)
Storing and iterating
f = FigurateNumbers.centeredoctagonalpyramid
f.next
f.next
f.next
``
Starting from version **1.5.0**,figurate_numbersnot only supports global access viaFigurateNumbers` and the use of specific classes for separate access, but also introduces new p-adic transformations and other mathematical operations that can be applied directly to sequences.
rb
PlaneFigurateNumbers.polygonal(19)
SpaceFigurateNumbers.rhombic_dodecahedral
MultiDimensionalFigurateNumbers.six_dimensional_hyperoctahedron
seq = MultiDimensionalFigurateNumbers.five_dimensional_hypercube.take(15)
ArithTransform.ring_padic_val(seq, 3)
How to use in Sonic Pi
Simply copy the entry point path from the lib/figurate_numbers.rb file where the gem is installed.
```rb
require "
polnum = FigurateNumbers.polygonal(8) 350.times do play polnum.next % 12 * 7 # Some mathematical function or transformation sleep 0.125 end
ampseq = SpaceFigurateNumbers.centeredhendecagonalpyramidal 100.times do sample :bdsone, amp: ArithTransform.padicnorm(ampseq.next, 3) # p-adic amplitude control sleep 0.25 end ```
Version 1.3.0 (legacy)
The main change introduced after version 1.3.0 is that you must now import the file using require instead of run_file; otherwise, it will not function.
See discussion in the Sonic Pi community thread right here!
List of Sequences and Arithmetic Transformations Methods
1. Plane Figurate Numbers
polygonal(m)triangularsquarepentagonalhexagonalheptagonaloctagonalnonagonaldecagonalhendecagonaldodecagonaltridecagonaltetradecagonalpentadecagonalhexadecagonalheptadecagonaloctadecagonalnonadecagonalicosagonalicosihenagonalicosidigonalicositrigonalicositetragonalicosipentagonalicosihexagonalicosiheptagonalicosioctagonalicosinonagonaltriacontagonalcentered_triangularcentered_square=diamond(equality only by quantity)centered_pentagonalcentered_hexagonalcentered_heptagonalcentered_octagonalcentered_nonagonalcentered_decagonalcentered_hendecagonalcentered_dodecagonal=star(equality only by quantity)centered_tridecagonalcentered_tetradecagonalcentered_pentadecagonalcentered_hexadecagonalcentered_heptadecagonalcentered_octadecagonalcentered_nonadecagonalcentered_icosagonalcentered_icosihenagonalcentered_icosidigonalcentered_icositrigonalcentered_icositetragonalcentered_icosipentagonalcentered_icosihexagonalcentered_icosiheptagonalcentered_icosioctagonalcentered_icosinonagonalcentered_triacontagonalcentered_mgonal(m)pronic=heteromecic=oblongpoliteimpolitecrossaztec_diamondpolygram(m)=centered_star_polygonal(m)pentagramgnomictruncated_triangulartruncated_squaretruncated_pronictruncated_centered_pol(m)=truncated_centered_mgonal(m)truncated_centered_triangulartruncated_centered_squaretruncated_centered_pentagonaltruncated_centered_hexagonal=truncated_hexgeneralized_mgonal(m, left_index = 0)generalized_pentagonal(left_index = 0)generalized_hexagonal(left_index = 0)generalized_centered_pol(m, left_index = 0)generalized_pronic(left_index = 0)
2. Space Figurate Numbers
r_pyramidal(r)triangular_pyramidal = tetrahedralsquare_pyramidal = pyramidalpentagonal_pyramidalhexagonal_pyramidalheptagonal_pyramidaloctagonal_pyramidalnonagonal_pyramidaldecagonal_pyramidalhendecagonal_pyramidaldodecagonal_pyramidaltridecagonal_pyramidaltetradecagonal_pyramidalpentadecagonal_pyramidalhexadecagonal_pyramidalheptadecagonal_pyramidaloctadecagonal_pyramidalnonadecagonal_pyramidalicosagonal_pyramidalicosihenagonal_pyramidalicosidigonal_pyramidalicositrigonal_pyramidalicositetragonal_pyramidalicosipentagonal_pyramidalicosihexagonal_pyramidalicosiheptagonal_pyramidalicosioctagonal_pyramidalicosinonagonal_pyramidaltriacontagonal_pyramidaltriangular_tetrahedral [finite]triangular_square_pyramidal [finite]square_tetrahedral [finite]square_square_pyramidal [finite]tetrahedral_square_pyramidal_number [finite]cubic = perfect_cube != hex_pyramidal (equality only by quantity)tetrahedraloctahedraldodecahedralicosahedraltruncated_tetrahedraltruncated_cubictruncated_octahedralstella_octangulacentered_cuberhombic_dodecahedralhauy_rhombic_dodecahedralcentered_tetrahedron = centered_tetrahedralcentered_square_pyramid = centered_pyramidcentered_mgonal_pyramid(m)centered_pentagonal_pyramid != centered_octahedron (equality only in quantity)centered_hexagonal_pyramidcentered_heptagonal_pyramidcentered_octagonal_pyramidcentered_octahedroncentered_icosahedron = centered_cuboctahedroncentered_dodecahedroncentered_truncated_tetrahedroncentered_truncated_cubecentered_truncated_octahedroncentered_mgonal_pyramidal(m)centered_triangular_pyramidalcentered_square_pyramidalcentered_pentagonal_pyramidalcentered_hexagonal_pyramidal = hex_pyramidalcentered_heptagonal_pyramidalcentered_octagonal_pyramidalcentered_nonagonal_pyramidalcentered_decagonal_pyramidalcentered_hendecagonal_pyramidalcentered_dodecagonal_pyramidalhexagonal_prismmgonal_prism(m)generalized_mgonal_pyramidal(m, left_index = 0)generalized_pentagonal_pyramidal(left_index = 0)generalized_hexagonal_pyramidal(left_index = 0)generalized_cubic(left_index = 0)generalized_octahedral(left_index = 0)generalized_icosahedral(left_index = 0)generalized_dodecahedral(left_index = 0)generalized_centered_cube(left_index = 0)generalized_centered_tetrahedron(left_index = 0)generalized_centered_square_pyramid(left_index = 0)generalized_rhombic_dodecahedral(left_index = 0)generalized_centered_mgonal_pyramidal(m, left_index = 0)generalized_mgonal_prism(m, left_index = 0)generalized_hexagonal_prism(left_index = 0)
3. Multidimensional figurate numbers
pentatope = hypertetrahedral = triangulotriangulark_dimensional_hypertetrahedron(k) = k_hypertetrahedron(k) = regular_k_polytopic(k) = figurate_numbers_of_order_k(k)five_dimensional_hypertetrahedronsix_dimensional_hypertetrahedronbiquadratick_dimensional_hypercube(k) = k_hypercube(k)five_dimensional_hypercubesix_dimensional_hypercubehyperoctahedral = hexadecachoron = four_cross_polytope = four_orthoplexhypericosahedral = tetraplex = polytetrahedron = hexacosichoronhyperdodecahedral = hecatonicosachoron = dodecaplex = polydodecahedronpolyoctahedral = icositetrachoron = octaplex = hyperdiamondfour_dimensional_hyperoctahedronfive_dimensional_hyperoctahedronsix_dimensional_hyperoctahedronseven_dimensional_hyperoctahedroneight_dimensional_hyperoctahedronnine_dimensional_hyperoctahedronten_dimensional_hyperoctahedronk_dimensional_hyperoctahedron(k) = k_cross_polytope(k)four_dimensional_mgonal_pyramidal(m) = mgonal_pyramidal_numbers_of_the_second_order(m)four_dimensional_square_pyramidalfour_dimensional_pentagonal_pyramidalfour_dimensional_hexagonal_pyramidalfour_dimensional_heptagonal_pyramidalfour_dimensional_octagonal_pyramidalfour_dimensional_nonagonal_pyramidalfour_dimensional_decagonal_pyramidalfour_dimensional_hendecagonal_pyramidalfour_dimensional_dodecagonal_pyramidalk_dimensional_mgonal_pyramidal(k, m) = mgonal_pyramidal_of_the_k_2_th_order(k, m)five_dimensional_mgonal_pyramidal(m)five_dimensional_square_pyramidalfive_dimensional_pentagonal_pyramidalfive_dimensional_hexagonal_pyramidalfive_dimensional_heptagonal_pyramidalfive_dimensional_octagonal_pyramidalsix_dimensional_mgonal_pyramidal(m)six_dimensional_square_pyramidalsix_dimensional_pentagonal_pyramidalsix_dimensional_hexagonal_pyramidalsix_dimensional_heptagonal_pyramidalsix_dimensional_octagonal_pyramidalcentered_biquadratick_dimensional_centered_hypercube(k)five_dimensional_centered_hypercubesix_dimensional_centered_hypercubecentered_polytopek_dimensional_centered_hypertetrahedron(k)five_dimensional_centered_hypertetrahedron(k)six_dimensional_centered_hypertetrahedron(k)centered_hyperoctahedral = orthoplexnexus(k)k_dimensional_centered_hyperoctahedron(k)five_dimensional_centered_hyperoctahedronsix_dimensional_centered_hyperoctahedrongeneralized_pentatope(left_index = 0)generalized_k_dimensional_hypertetrahedron(k = 5, left_index = 0)generalized_biquadratic(left_index = 0)generalized_k_dimensional_hypercube(k = 5, left_index = 0)generalized_hyperoctahedral(left_index = 0)generalized_k_dimensional_hyperoctahedron(k = 5, left_index = 0) [even or odd dimension only changes sign]generalized_hyperdodecahedral(left_index = 0)generalized_hypericosahedral(left_index = 0)generalized_polyoctahedral(left_index = 0)generalized_k_dimensional_mgonal_pyramidal(k, m, left_index = 0)generalized_k_dimensional_centered_hypercube(k, left_index = 0)generalized_k_dimensional_centered_hypertetrahedron(k, left_index = 0)[provisional symmetry]generalized_k_dimensional_centered_hyperoctahedron(k, left_index = 0)[provisional symmetry]generalized_nexus(k, left_index = 0) [even or odd dimension only changes sign]
4. Zoo of figurate-related numbers
cuban_numbers = cuban_prime_numbersquartan_numbers [Needs to improve the algorithmic complexity for n > 70]pell_numberscarmichael_numbers [Needs to improve the algorithmic complexity for n > 20]stern_prime_numbers(infty = false) [Quick calculations up to 8 terms]apocalyptic_numbers
5. Arithmetic Transformations
ArithTransform.n_residue(n, pow, mod)ArithTransform.pc_inversion(n, mod)ArithTransform.padic_val(n, p)ArithTransform.ring_padic_val(seq, p)ArithTransform.padic_norm(n, p)ArithTransform.ring_padic_norm(seq, p)ArithTransform.padic_expansion(n, p, precision = 11, reverse: false)ArithTransform.ring_padic_expansion(seq, p, precision = 11, reverse: false)
Book Errata
Chapter 1, page 6: The formula for Square in the table is given as:
1/2 (n^2 - 0 * n)It should be corrected to:1/2 (2n^2 - 0 * n)Chapter 1, page 51: The formula for Centered icosihexagonal numbers is listed as:
1/3n^2 - 13n + 1with values546, 728, 936, 1170. The correct formula and values are:13n^2 - 13n + 1with values547, 729, 937, 1171.Chapter 1, page 51: The value for Centered icosiheptagonal number is given as
972. The correct value is973.Chapter 1, page 51: The value for Centered icosioctagonal number is given as
84. The correct value is85.Chapter 1, page 65: The term polite numbers is misspelled as:
inpolite numbersIt should read:impolite numbersChapter 1, page 72: The formula for truncated centered pentagonal numbers (TCSS5) is: `TCSS5(n) = (35n^2 - 55n) / 2 + 3
It should be:TCSS_5(n) = (35n^2 - 55n) / 2 + 11`Chapter 2, page 92: The formula for octagonal pyramidal numbers is stated as:
n(n+1)(6n-1) / 6The correct formula is:n(n+1)(6n-3) / 6Chapter 2, page 140: The sequence for centered square pyramidal numbers is listed as:
1, 6, 19, 44, 85, 111, 146, 231, ...The number111should be excluded, resulting in:1, 6, 19, 44, 85, 146, 231, ...Chapter 2, page 155: The formula for generalized centered tetrahedron numbers (S3^3) is: `S3^3(n) = ((2n - 1)(n^2 + n + 3)) / 3
It should include a negative sign:S_3^3(n) = ((2n - 1)(n^2 - n + 3)) / 3`Chapter 2, page 156: The formula for generalized centered square pyramid numbers (S4^3) is: `S4^3(n) = ((2n - 1)(n^2 - n + 2)^2) / 3
The correct formula is:S_4^3(n) = ((2n - 1)(n^2 - n + 2)) / 2`Chapter 3, page 188: The term hyperoctahedral numbers is incorrectly called:
hexadecahoron numbersIt should be:hexadecachoron numbersChapter 3, page 190: The term hypericosahedral numbers is incorrectly written as:
hexacisihoron numbersIt should be:hexacosichoron numbers
Owner
- Name: Edgar Delgado Vega
- Login: edelveart
- Kind: user
- Location: Lima-Perú
- Repositories: 1
- Profile: https://github.com/edelveart
Hi, I'm Edgar, a person motivated by art and technology. My interests are mathematical music theory and live coding (Sonic Pi).
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software and its documentation, please cite it as below."
authors:
- family-names: "Delgado Vega"
given-names: "Edgar Armando"
orcid: "https://orcid.org/0000-0002-9672-9087"
title: "Figurate Numbers for Ruby and Sonic Pi"
version: 1.5.0
doi:
date-released: 2024-07-08
url: "https://github.com/edelveart/figurate_numbers"
repository-code: "https://github.com/edelveart/figurate_numbers"
license: MIT
GitHub Events
Total
- Release event: 2
- Push event: 55
- Create event: 1
Last Year
- Release event: 2
- Push event: 55
- Create event: 1
Packages
- Total packages: 1
-
Total downloads:
- rubygems 4,197 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 18
- Total maintainers: 1
rubygems.org: figurate_numbers
Generates 241 infinite sequences of plane, space, and multidimensional figurate numbers based on the book ‘Figurate Numbers’ (2012) by Elena Deza and Michel Deza. The methods are implemented using the Enumerator class and are designed for use in your math projects or in Sonic Pi.
- Homepage: https://github.com/edelveart/figurate_numbers
- Documentation: http://www.rubydoc.info/gems/figurate_numbers/
- License: MIT
-
Latest release: 1.5.3
published 9 months ago