Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Roman Numerals

13 views
Skip to first unread message

Mr Ajit Sen

unread,
Feb 22, 2007, 4:32:48 AM2/22/07
to
Dear Mathgroup,

Does Mathematica have any function to convert Arabic
numerals to Roman, & vice versa? I'm thinking of
something like

Roman[2007] ---> MMVII

Arabic[MDCCLXIV] ---> 1764

I just thought about that after seeing the date in
the credits of an old movie, & I reckoned it'd
be faster to use Mathematica than use a convertor on the Web.

I could not get any info from the Help browser or the archive.
A Yes/No answer with a few words will do. I don't
really need a code. Unless someone has plenty of spare
time.

Thanks.
Ajit Sen.



___________________________________________________________
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html

Mr Ajit Sen

unread,
Feb 23, 2007, 5:11:57 AM2/23/07
to
Dear Dimitris,

Thanks a lot. It's a wonderful notebook.

Ajit.



___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

dimitris

unread,
Feb 23, 2007, 5:13:59 AM2/23/07
to
Dear Ajit

I think you will see many interesting things downloading the package
and the notebook
AntiqueNotations of Robby Villegas from here

http://library.wolfram.com/infocenter/Demos/4952/

Regards
Dimitris


=CF/=C7 Mr Ajit Sen =DD=E3=F1=E1=F8=E5:

> Now you can scan emails quickly with a reading pane. Get the new Yahoo! M=
ail. http://uk.docs.yahoo.com/nowyoucan.html


janos

unread,
Feb 25, 2007, 4:49:24 AM2/25/07
to
> ail.http://uk.docs.yahoo.com/nowyoucan.html
Dear Ajit,

I also liked the proposed nb,
but you might be still be interested in reading
this small recursive program calculating
Roman numerals (form our book with L. Szili, 1996).

arabic = Union[10^Range[0, 3], Flatten[Outer[Times, {9, 5,4},
10^Range[0, 2]]], {0}];
roman = ToString /@ {{}, I, IV,V, IX, X, XL, L, XC, C, CD, D, CM, M};
MapThread[SetDelayed, {ToRoman /@ arabic, roman}];
cap[x_Integer /; 0 < x < 4000] := First[Select[Reverse[arabic], # < x
&, 1]];
ToRoman[x_Integer /; 0 < x < 4000] := SequenceForm[ToRoman[cap[x]],
ToRoman[x - cap[x]]]

ToRoman /@ (2^Range[0, 12])


0 new messages