Mayan Numerals in Julia - MayanNumerals.jl

I was watched this yt video. Seemed in interesting so I thought I would make a package for using Mayan numerals since Julia has Unicode support and what not. Here is the package (MayanNumerals.jl).

13 Likes

The github readme doesnโ€™t do your work justice :grinning:

julia> using MayanNumerals

julia> Mayan(0)
๐‹ 

julia> Mayan(1)
๐‹ก

julia> Mayan(3)
๐‹ฃ

julia> Mayan(5)
๐‹ฅ

julia> Mayan(8)
๐‹จ

julia> Mayan(14)
๐‹ฎ

julia> Mayan(20)
๐‹ก๐‹ 

julia> Mayan(100)
๐‹ฅ๐‹ 

julia> Mayan(369)
๐‹ก๐‹ ๐‹ฉ

julia> Mayan(359)
๐‹ฑ๐‹ณ

julia> Mayan(360)
๐‹ก๐‹ ๐‹ 

julia> Mayan(420)
๐‹ก๐‹ฃ๐‹ 

julia> Mayan(1024)
๐‹ข๐‹ฏ๐‹ค
5 Likes

I didnโ€™t even think of people not having the font installed. Oops! I wonder if there is a way to check if the user has the right font to render the glyphs (not much help in the readme though).

How do you do numbers less than one?
What is Pi in Mayan number system???
What about negative and imaginary numbers?

1 Like

You donโ€™t need fonts, just use an array of Ints
Are you going to use Big Mayan Indians or Small Mayan Indians for your array?

You might like my AncientNumbers.jl, which supports calculations like XV + ๐’ - ไท€ == ๐”๐’๐‘โ€ฆ but no Mayan. (Maybe becaue ๐‹  doesnโ€™t parse as in Julia?)

5 Likes

I did absolutely consider it to have negative and decimal. I decided against it because it would have been a bit anachronistic. Technically, the numeral system is base 20 where on the 3rd (1st being the ones place) base is different.

1 Like

I did consider using an array of Ints, but decided to make the Mayan number a think wrapper around an Int type since it makes it easier to implement arithmetic.

Wow great package! Iโ€™ll have to check it out! The interesting about the Mayan Unicode codepoints is that Julia does recognize them as numerals since isnumeric('๐‹ ') == true.

Iโ€™ve recently been dealing with a shady merchant who sent me a bad delivery, finally I can calculate the refund Iโ€™m owed for the adjusted value of this pile of low-grade copper (not to mention the terrible customer service my employee had to deal with)

4 Likes