This notebook contains commands for doing calculations in sexagesimal (base 60) arithmetic. The sexagesimal numeral system is prominent in the history of mathematics. It was used in ancient Babylonia and remained in widespread use especially in astronomy well into modern times.

The following cell initiates the necessary functions. The initial parameter “accuracy” determines how many positions after the “decimal point” to include; it may be changed to suit your needs. The last position is rounded where needed.

accuracy=6;
ToSexagesimal=
Function[Module[{intexpr, decexpr, remainder, integersneeded, nextdigit},
intexpr={};
decexpr={};
remainder=IntegerPart[#];
integersneeded=1;
While[remainder/60^(integersneeded-1)≥60, integersneeded++];
For[i=integersneeded,i>0, i--,  
nextdigit=IntegerPart[remainder/60^(i-1)];
AppendTo[intexpr, nextdigit];
remainder=remainder-nextdigit*60^(i-1)
];
remainder=#-IntegerPart[#];
For[i=1,i≤accuracy, i++,  
nextdigit=If[i==accuracy, Round[remainder/60^-i], Floor[remainder/60^-i]];
AppendTo[decexpr, nextdigit];
remainder=remainder-nextdigit*60^-i
];
{intexpr,decexpr}
]];
FromSexagesimal=
Function[Module[{intsum, decsum},
intsum=0;
For[i=1,i≤Length[#[[1]]], i++, 
intsum=intsum+(#[[1]][[i]])*60^(Length[#[[1]]]-i)
];
decsum=0;
For[i=1,i≤Length[#[[2]]], i++, 
decsum=decsum+(#[[2]][[i]])*60^-i
];
intsum+decsum
]];
PrintFormatting=
Function[IntegerString[#,10,2]
];
n=FromSexagesimal;
s=ToSexagesimal;
padding=PrintFormatting;

There are two basic commands: conversion from sexagesimal to decimal (base 10) numbers, and conversely. The function n[x] takes a sexagesimal number as input and gives the corresponding decimal number as output. The function s[x] is the inverse function: it takes a decimal number and gives the corresponding sexagesimal number.

Sexagesimal numbers are represented as a pair of lists {{…},{…}}, where the first component is the “integer” part and the second the “fractional” part.

For example, one half is 30 “minutes” or 30/60:

s[0.5]

45/60 is three quarters:

n[{{0},{45}}]

To perform calculations with sexagesimal numbers, first translate them into decimal numbers, have Mathematica do the calculation, then translate the answer back again into sexagesimal form.

For instance, here I perform the sexagesimal multiplication 4,10;20,2 times 1;30:

s[n[{{4,10},{20,2}}]*n[{{1},{30}}]]

The square root of 2 in sexagesimal form is famously shown on the Babylonian clay tablet YBC 7289. We can compute it like this:

s[Sqrt[2]]

As we see, we automatically have at our disposal all functions known to Mathematica, including for example trigonometric functions. Here for instance is the sexagesimal sine of the sexagesimal angle 3;10 degrees:

s[Sin[n[{{3},{10}}]*Degree]]

The command padding[x] adds padding zeros to a sexagesimal number. This can be useful for alignment purposes when creating tables. Here for instance are the first entries of a sexagesimal sine table:

Format[Table[padding[s[Sin[k*Degree]]], {k,30}], TraditionalForm]