Numeral Systems Toolbox 1.1

Convert from and to different numeral systems. Arabic, Roman, Mayan, Ionic, Babylonian.
2.9K Downloads
Updated 13 Oct 2003

No License

This toolbox contains four main functions that converts back and forth between different numeral systems. Numeral systems supported are yet so far only the ancient systems; Arabic, Roman, Mayan, Ionic and Babylonian.
The take a string or cellstring as an input which represents numerals in either Arabic or some other system and converts it to a string of numerals of the other system.

ROMAN : arabic <-> roman
MAYAN : arabic <-> mayan
IONIC : arabic <-> ionic (greek)
BABYLONIAN : arabic <-> babylonian

Thus you can convert between all of these systems. However some of them have certain interval constraints. Like the roman converter only allows for converting up to numbers as big as 3999 (arabic), whilst ionic numbers can only be as large as 999.

More systems will be added to the toolbox in the future.

Examples:

roman 1994 %will be 'MCMXCIV'
roman DCCCLXXXVIII %results in arabic '888'
roman(roman('2003')) %yields '2003'
str2num(roman('xxiii')) %the number 23
roman({'iv','VII','4'}) %results in {'4','7','IV'}

mayan 64302 %mayan: 8*20^3 + 0*20^2 + 15*20 + 2
mayan(char({'oo','='})) %mayan for arabic 7
mayan([mayan('45+') mayan('80+')]) %perform mayan addition

ionic 999 %results in '\sampi\qoppa\theta'
ionic \nu\zeta %same as arabic 57
title(ionic('456')) %displays the result

babylonian 21609 %147^2, notice the gap
babylonian('VVV <<VVVVVV') %same as 3*60+26 = 206
babylonian('YYY <<YYYYYY') %returns '206'
babylonian(roman('XLIV')) %returns babylonian for '44'

For more MATLAB programs, refer to http://www.etek.chalmers.se/~e8rasmus/eng/matlab_programs.html

Cite As

Rasmus Anthin (2024). Numeral Systems Toolbox 1.1 (https://www.mathworks.com/matlabcentral/fileexchange/4014-numeral-systems-toolbox-1-1), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R10
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Operators and Elementary Operations in Help Center and MATLAB Answers
Acknowledgements

Inspired by: chb

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0

Now includes the babylonian numeral system. Still, no converters support fractionals (yet to come).