Numeral Systems Toolbox 1.1

版本 1.0.0.0 (12.7 KB) 作者: Rasmus Anthin
Convert from and to different numeral systems. Arabic, Roman, Mayan, Ionic, Babylonian.
2.9K 次下载
更新时间 2003/10/13

无许可证

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

引用格式

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

MATLAB 版本兼容性
创建方式 R10
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Operators and Elementary Operations 的更多信息
致谢

参考作品: chb

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

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