Wikipedia:Reference desk/Archives/Mathematics/2016 September 20

= September 20 =

February 29
From the table above, how many times does February 29 (Leap Day) fall on each day of the week in 400 years in the Gregorian calendar? GeoffreyT2000 ( talk,  contribs ) 04:47, 20 September 2016 (UTC)


 * I think a useful reference is the article Dominical letter, which lists the frequency of each configuration of years.
 * In other words, the first column of the table refers to years which has a February 29 falling on Sunday. This corresponds to a leap year starting on Thursday, which corresponds to the double dominical letter DC. There are 13 such years in the 400 year cycle, as per the quoted article. Those correspond on your table to the thirteen years from 2004 to 2376, for instance. Frequency for the other colums are: Monday, CB, 15; Tuesday, BA, 13; Wednesday, AG, 15; Thursday, GF, 13; Friday, FE, 14; Saturday, ED, 14.
 * All in all, there are 97 leap years on the cycle. Because of the fact that this number is not divisible by 7, and that certain leap Julian years are ommited in the Gregorian cycle, one has a different frequency for each column. Pallida  Mors  12:25, 20 September 2016 (UTC)
 * Correction: The reason for the different frequencies is not that 97 is not divisible by 7.  It's that the total number of days in the 400-year cycle, namely 146097, is divisible by 7.  The 400-year cycle is exactly 20871 weeks, so it starts on the same day of the week every time.  January 1, 2000 was a Saturday, and if we're still using the same calendar, January 1, 2400 will also be a Saturday.
 * That's what allows the variations to accumulate. If the number of days in the cycle were not divisible by 7, because 7 is a prime number, the differences in frequencies would disappear on the average, in the limit as the number of cycles goes to infinity. --Trovatore (talk) 18:21, 22 September 2016 (UTC)
 * Every simple calendar, such as the Julian and the Gregorian, has a period; that is, there is a cycle of years after which the cycle of days of the week repeat exactly in the same way. Of course such cycles have an entire number of weeks (that's the only way it could work such that the cycle start in the same day of the week).
 * So, does the fact that the total number of days in the cycle is divisible by 7 imply that the frequency of years falling on each column is different? No. the Julian calendar has a cycle of 700 years, after which every century repeats the exact configuration of dominical letters [indeed, there is a small cycle of 28 years after which the same configuration appears]. If we build the corresponding frequencies for each day of the week on the Julian calendar, we will find that there are 175 leap years over the cycle. Of these, exactly one seventh (25) correspond to leap years starting on each day of the week. Notice that the frequency is the same for each category, which derives from the fact that on the Julian calendar, the number of leap years is a multiple of 7 (175) and there is no jump or miss of leap years. On the Gregorian calendar, on the other hand, the number of leap years (or common years, for the sake) is not a multiple of 7; hence, there is no way of distributing 97 years evenly on seven clases. Pallida  Mors  10:34, 25 September 2016 (UTC)

General definition of addition and multiplication
I have been trying to come up with general definitions of these two operations, without much success. This is what I have come up with.

Addition is an operation under which a set form an abelian group.

Multiplication distributes over addition (so multiplication cannot be defined without addition).

I'm not entirely happy with these definitions. The set $$\mathbb{R}\setminus 0$$ forms an abelian group under multiplication, yet would satisfy my definition of addition. Can we do better?--Leon (talk) 07:21, 20 September 2016 (UTC)


 * I'm not really sure what you are asking. An abelian group is the typical way that the concept of addition is generalized.  You seem dissatisfied with that, but it is unclear to me what additional property you think should be present.  It may be worth noting that $$\left(\mathbb{R},+\right)$$ is isomorphic to $$\left(\mathbb{R}^{+},\cdot\right)$$ under the function $$x \mapsto e^x$$ and so in a sense addition and multiplication have the same structure.  Dragons flight (talk) 08:00, 20 September 2016 (UTC)
 * (ec) I think you're looking for something that doesn't really exist. There are the concrete operations of addition and multiplication in the basic particular structures that we all know and love &mdash; the naturals, the rationals, the reals, the complex numbers, the matrices, the ordinals, the Clifford algebras.  There are certain commonalities:  Operations called "addition" and "multiplication" are usually, but not always, associative.  An operation called "addition" is usually, but not always, commutative. An operation called "multiplication" usually distributes over one called "addition" if there is one.  But I don't believe you're going to find any abstract characterization of what addition and multiplication are in general. --Trovatore (talk) 08:08, 20 September 2016 (UTC)

Convert floating point to alphanumeric
Hi can someone help me with a formula to convert floating point (precision 5) to alphanumeric (length 5, upper and lower case), and then BACK to floating point without losing precision. It's for some software I am trying to write. My floating point number is for example 74.00594 and I need it represented in at most 5 alphanumeric characters. The number will not be larger than 360. Alphanumeric can include 0..9, A..Z and a..z. Is this possible or do I need more characters to mathematically represent a precision 5 number? Thank you. Sandman1142 (talk) 09:38, 20 September 2016 (UTC)


 * Yes, you can do it. In general, with N symbols, D digits can represent numbers 0 to ND - 1.  In this case 625 - 1 = 916132831, which means you can represent 0.00000 to 9161.32831 if you insist in five decimal place precision.  I don't have time to write out the algorithm, but the general theory is that a number written with five digits "abcde" is equal to $$aN^4 + bN^3 + cN^2 + dN + e$$.  In terms of writing the algorithm, you might get a faster response at the computer reference desk.  Dragons flight (talk) 10:03, 20 September 2016 (UTC)


 * Brilliant, thanks! I can work out the algorithm from there.  Bow to the gods of maths! Sandman1142 (talk) 11:03, 20 September 2016 (UTC)


 * Let me just drop the (somewhat) helpful link: radix. Tigraan Click here to contact me 11:32, 20 September 2016 (UTC)


 * Yes after that I realized I just have to write a base 10 to base 62 converter and back. It got complicated as my float can be negative, but I got it working. Live and learn. Thanks again guys. Sandman1142 (talk) 13:33, 20 September 2016 (UTC)


 * You have me curious, Sandman. Why do you need to do this ?  If the intent is to encode it to make it less readable, perhaps the excess capacity could be used to further obscure it.  One simple method would be to randomly pick a multiple of 360 to add to the number each time you encode, keeping it less than the max (so 8801), and then subtract 360 until you get down to the 0-360 range when decoding. Of course, we could come up with a better encoding method, if this is really your intent.StuRat (talk) 17:15, 20 September 2016 (UTC)
 * I would prefer not this discuss this openly, StuRat. You are welcome to contact me via my contact details. Sandman1142 (talk) 10:16, 21 September 2016 (UTC)