Jackdaws

Jackdaws are primary source documents found in libraries, which are used in research or for class discussions. They are usually reproductions of iconic photos, letters, diary entries, and so on.

They can also be a species of bird, related to crows and ravens. I have often used (or misused) the word to mean “random books and documents that can’t be classed anywhere else”. Now I have to find another word for it.

Let’s see …

Or just “jackdaws”. I don’t think a whole lot of people know the actual “library” use of the word, and because I think it’s a cool word, I’ll use it for my own purposes.

Sunshine List 2021

The Ontario government has released The Sunshine List. It is a publically-avaialable list which lists the names, positions, and locations of any government employee earning over $100K per year, and was started in 1995 by the Mike Harris government as a way of naming and shaming those who commit the sin of earning above six figures. The article that appeared in today’s Toronto Star had a picture of an elementary school teacher and a classroom of young children, just below the headline, to suggest the targets of this list.

However, the list targets all 240,000 or so full-time government employees who get a paycheck from Queens Park, regardless of the sector of government invloved, such as Public Works, Healthcare, the ministries, OPG and the LCBO. And that just scratches the surface.

The 26 top wage earners working for school boards are those earning more than $250K. All of these people are school board directors, and the occasional associate director. When compared against the other sectors of government, the education sector is still the lowest-paid as they always have been. So it is no surprise that the sector called “School Boards”, according to the Sunshine List, are have the lowest average salary, for those earning above 100K.

The reality of such perceived largesse is twfold: the list which started in 1996 has become less impressive in its impact than it had been back then. $100K today has the same buying power as a salary of $69,769.70 back in 1996.

There is also taxation, which eats up $35,000 of your $100K gross earnings. The money you earn is not what you take home. And in 1996 dollars, the take-home pay of $65K can buy you what $45K used to back then. You can still live more or less comfortably and relatively debt-free on that salary, but it is far from lavish, especially if you live in the Greater Toronto Area because you won’t be able to afford a house or even a condo. An earner taking in $70,000 back in 1996 could buy a home in the GTA. Nowadays, an employee in the GTA earning $100,000 is lucky if they can find a two bedroom apartment that doesn’t break their bank account, especially if they are raising families.

Because of this, the magic number of $100,000 is outdated and much less meaningful than it used to be. It was a lot of money in 1996, but nowadays is barely above a living salary for a family of 4. It only looks big because of all the zeroes after the 1. To match the buying power of $100,000 in 1995, you would need to earn about $160,000 today.

The other aspect of this, is that the 85% of earners on the Sunshine List are earning between $100,000 and $110,000. 70% of earners on the Sunshine List are earning less than $105,000. That means that the per centage of earners just between $105K and $110K is barely 15% of the distribution. And as you go up in salary, the number of earners in each successive bracket falls like a rock. Also, keep in mind that the list isn’t giving you who is earning what, below $100,000. But because it takes a school teacher 10 years to get to that level, it is a safe bet that most Ontario government employees earn well below $100K, even in today’s dollars.

If we use $160,000 as the new cutoff (based on the same 1996 standard, adjusted for inflation), there are exactly 765 earners in Ontario working for school boards earning that either 160K or more, none of whom are teachers. That level of salary is generally earned by school board superintendents and the occasional principal. The 765 education sector earners is far fewer than the 80,434 sunshine earners working for school boards. There are many calls to update this list to take into account the change in standard of living of Sunshine earners, but as you can see number less than 1%, the list would not have nearly the same impact, nor cause anywhere near the same outcry.

And I have to say, why the outcry? We live in a world where Amazon workers are fired for being in the bathroom too long, thereby being a drain on Bezos’s ambition to buy himself another rocket. We live in a world where the average CEO earns more than 300 times more than the average worker under him. Government workers got where they were because of union activity, and out of the recognition that the boss wasn’t going to be nice one day and give us a living wage. The ones who don’t form unions get the shit jobs and shitty lives they duly fought for.

I realize I am being sardonic, but I am also suggesting that fighting for a living wage and adequate benefits is not easy, and is always a struggle, and bosses are hired to care more about profits than whether your skill set matches what earnings you deserve, whether you are taking home a living wage, or even your mental or physical health. Where is the outrage at the CEOs of private companies who earn so much off the backs of their employees? Or even at private companies who form government “partnerships” which benefit off the largesse of the taxpayers? These latter people are invisible on the Sunshine List.

People lose their minds when a government employee earns a living wage, but don’t seem to have a problem when a CEO reports a salary at a shareholders’ meeting in the billions of dollars, don’t know what to do with all that money, and buy themselves a rocket. Meanwhile their employees are so stressed they are unable to hold down a warehouse job for longer than a year or so, lest they be sacked for the crime of taking a bathroom break in an actual bathroom rather than peeing in a bottle like a good employee. This is what happens when you don’t fight for better working conditions.

To the left is a summary of salaries above 100K paid to all employees in the School Board sector of government. This encompasses all managers, custodial staff, secretaries, teachers, psychologists, other specialists, and board office employees right up to the director. Nearly everyone earns below 110K, with the number of earners in each successive bracket falling precipitously as you go up in salary level. With the full list sorted in order of salary, it is possible to determine the median salary for a School Board Sunshine List employee (remember, not all government employees) as being $103,129.16 or, in 1996 dollars, $65,411.73, using data provided by the Toronto Star to do the conversion.

Below is a breakdown by government sector.

Ubuntu on Windows 10

For some years now, Windows and Ubuntu have been coexisting to a degree, if you enable the Linux subsystem on windows and download the Ubuntu for Windows package from the Windows App store.

It makes it possible to muck about with Windows drivers and the Windows kernel from within a UNIX environment. Even make your own drivers that can send direct commands to the Windows kernel and even the TCP/IP stack. So long as you like the command line, there are some pretty cool tools and languages, such as C/C++, python, perl, and many of the other usual suspects at your disposal. It doesn’t really have support for Java, except as a runtime envirnonment. That shouldn’t stop you from installing JDK manually. You can install the one for Linux or the one for MS-Windows. Your choice. Also, there is no support at all for X-Windows.

The /mnt directory is used to house all of the drive letters that are visible to Windows. Here they are mounted as folders each named after their drive letter.

I can’t run MS-Windows commands like Notepad from the shell; but it turns out the Windows paths are not set by default in Ubuntu. Typing /mnt/c/Windows/notepad.exe allowed it to run. In fact, it can run any windows command, if you take the time to fix the $PATH variable. In addition, the Ubuntu subsystem doesn’t yet support the reading of ext3 filesystems, although it has no problem reading NTFS filesystems. An EXT3 driver I tried was able to identify and mount EXT3 filesystems (assigning it a drive letter) from within Windows, but no files were visible. I was offered to format the drive, but I declined. So, I wasn’t sure of the rationale for even having this driver if I can’t see any files.

Apart from that, it appears as if the main architect of the ext2 driver project, Matt Wu, has abandoned the project and has reduced his website to a blank webpage. I don’t see any updates on SourceForge later than 2015.

Cygwin’s (many) downsides

Cygwin is a free (as in freedom) open-source suite which tries to be a POSIX-based subsystem that runs on top of MS-Windows. It tries to behave as if it can do all tasks that Windows can, as if it were a wrapper for Windows. But essentially, even with an X-Window manager, it ends up being just another windowed application with windowed apps running inside it, which can be minimized so you can actually work with MS-Windows itself when you want to.

I wish to say at the outset that this is more of a review than anything. There is a lot of important info missing to construe this discussion as a how-to manual for un-installing or fixing a Cygwin system after a Windows reinstallation. If it were such a manual, this article would have to be much, much longer. In reality, I am really just venting frustration as to how Cygwin, a “program” (for lack of a better word) which I have been using for over a decade, is still very far from getting its act together.

An Eterm, running under WindowMaker. Yes, I was using the EMACS Cheat Sheet as wallpaper!

It has been a hobby of mine to make something of this subsystem for some years, and I have found it most useful as a programming environment. It has as much support for perl, python, C/C++ and vim as you like, and can even run windowed file managers, web browsers (among them, chromium, and lesser known ones like Opera and Midori), and editors like XEmacs. It has wide support of the standard window managers, such as GNOME, KDE, xfce, lxde, fvwm2, enlightenment, WindowMaker, right down to twm. And because all of this runs in a glorified window under MS-Windows, I can switch back and forth to and from MS-Windows whenever it suits me.

If Cygwin doesn’t have the packages for a “free” (as in beer) computer language, I found I can just install a Windows version of it under Cygwin, and that is fine. All Cygwin executables are “exe”, just like Windows, so I can also run Windows commands under a Bash shell. I wanted the latest Java from the Oracle website, and I found I was able to just unpack it somewhere, under, say, /opt, and link its executables to /bin or to any directory defined in my $PATH. Or, of course Java provides a “bin” directory which you can add to your $PATH without the need for making symbolic links.

All tickety-boo if you can get Cygwin up and running. Most applications ported from other unix systems will work if you recompile from source and run the configure script. Others will compile and install after some minor editing.

The downsides of Cygwin are apparent from the point of installation. When you first install Cygwin, the installer is somewhat cryptic, although you might be able to figure most of it out. The installer allows you to decide what packages you want and which ones you don’t. But it is really an illusion. If you want stuff such as your window managers to work on Cygwin, including your chosen X-Window manager, then just install everything. Maybe decide which window manager (or managers) you want and which ones you don’t want. I also was picky about the texmf language packs, which slow down the install to over 6 hours, so I do take the trouble to deselect most texmf language packs that are not English or which don’t use the “Latin” alphabet, while choosing any math or other academic fonts. Being otherwise indiscriminate about package selection means you have to live with scores (or possibly hundreds) of programs and window managers you will never care to use. My installation is typically about 26 gigs unpacked, spanning over 1 million files (1,017,806 files, to be exact) in some 65,000 folders. That is not counting my /home folder.

Another thing to know is that Cygwin has no uninstall tool to uninstall itself. So un-installation of Cygwin is infinitely more difficult than installation, for reasons we shall see.

I said earlier I found the installer cryptic. What I mean is that the installer has to download and install each package one at a time, which is a bugger if a remote server goes down or hangs. And, especially with those texmf language packs it appears to hang, when in reality it is just plain being slow. If you stop the installer and start it again, you get no indication of whether it remembered where it left off. What you do is behave as if it does remember, and click install. It does pick up from where it left off, but it is not very reassuring about it.

And God help you if you, for some reason need to reinstall MS-Windows. This is where you find when you go back to the directory with the installation, that it has introduced its own permissions, but that is not the worst permission problem. The ownership of the distribution becomes hard to untangle, in large part because when you reinstall MS-Windows the user and admin accounts you created become reduced to SID numbers of users no longer known to the system. And of course, you can remove those unknown users with Windows’ Properties, and reassert your ownership similarly, or by using the “takeown” and “icacls” commands which their cmd shell provides (running as Administrator). This takes hours when the number of files is over 1 million with 65,000 folders. This is slowed down further by the fact that there are several files and folders which have un-knowable permissions and un-knowable ownership which require you to change tactics when that happens. After an evening and the following morning, I was able to get rid of the now-bogus users while respecting other owners as much as possible. Using the inheritance option in MS-Windows has to be done judiciously, respecting that different folders have differing sets of system permissions. Some have no system permissions (just user and group permissions), while others have strange ones like “Creator Owner”, “Creator Group”, “None”, and “NULL SID”.

Some examples of strange “users”. “Everyone” isn’t considered strange, and includes all users on your system.

If you are able to untangle the Cygwin permission problems after re-installing MS-Windows, then congratulations! You are now at a point where you can decide two things: 1) you can still configure an icon to run a shell under mintty and content yourself with a bash shell as a reward for your work on permission changing; or 2) you can delete the entire Cygwin directory tree and decide if you want to reinstall again. Both prospects are hard-won, and here you are. I wish to emphasize that option 2 is not a joke. Deletion would have been impossible without taking ownership and fixing the permissions. It just sounds like a joke.

Notice that there is no choice “3” for trying to run X-Windows or a window manager. X-Windows will complain one way or another about not being able to find :0 (the root window), or will give an X window briefly, which crashes in seconds with no error message logged. Some X apps work, such as the aforementioned mintty, but except for shell commands, that’s it. If you wanted to run an application that needs any of the X-windows widgets, then you have to delete the whole thing (except possibly /home) and install from scratch. In other words you are basically screwed in all but the bleakest of ways if you reinstalled MS-Windows.

Over the years there had been several reasons for reinstalling. Sometimes it was to freshen a windows installation which was becoming increasingly sluggish and full of problems. “Freshening” a windows installation involves, for me, a formatting of C: drive. This is not so bad for me. Only programs and system files go on my C: drive. My documents and other files are on other physical hard drives. My Cygwin installation is also situated on one of the other physical drives, so it doesn’t take up valuable room on C:. So, I don’t feel as nervous about reinstallation as some would; but there is that darned Cygwin distro I have to reckon with sooner or later. You are screwed if you sort out the permissions under Cygwin, and screwed even more if you don’t.

This is /etc/fstab in its entirety. The edited line on the bottom contains the “noacl” option needed to fix this file permission bug.

As a post script, I found out how you get NULL SID, as well as incorrect ordering of permissions on many of the Cygwin files, the source of the majority of my permission headaches. The /etc/fstab has just one uncommented line, a filesystem called “none” allowing all of your Windows drives to be herded under /Cygdrive. This is supposed to have the advantage of allowing you to navigate to any physical drive or partition on your computer entirely within Cygwin (which is what it does). A missing option needs to be added: “noacl” (quotes omitted). This prevents Windows from trying to assign a user SID as if “none” was a user, thereby fixing many of the permission headaches.

I don’t understand why the designers of Cygwin don’t add “noacl” before they distribute it. I think the majority of us are running some form of NT-based windows system: Windows 2000, XP, 7, 8, 10, and now 11 are packaged with most computers these days, and their hard drives are usually NTFS. These bugs are specific to NTFS systems, and these bugs don’t show up on FAT-32 filesystems, which don’t store info on ACLs, SIDs, or anything of the sort.

The Cygwin website discusses these issues, but it seems that Cygwin is trying to be POSIX compliant when Windows obviously isn’t trying to be. If they are choosing MS-Windows as the host system, they will have to do things their way and not try to fight it with Cygwin’s “correct” way, or to disenfranchise the majority of their users for the sake of backwards compatability. Would it kill the owners of FAT-32 filesystems, whom I think are in the minority, to delete “noacl” for the sake of the majority? Once the system is installed it is too late to do it then, since by then the installed apps will all have the permission bug.

In the event you decide you wish to delete the whole shebang after hours of sorting out permissions, there is one little tiny file that completely thwarts nearly all attempts at deletion. I have found it on two of my installations, and it was a problem in that specific file. It is the file located at \usr\share\avogadro\crystals\zeolites\CON.cif, relative to the Cygwin top-level folder. It cannot be deleted, and its permissions and ownership cannot be changed or even known to humans. The reason Windows appears to go braindead with this file, is because of the filename. CON is a reserved word in MS-Windows, short for “console”, going back to the days of MS-DOS. So is naming your file LPT1, short for “line printer”, a Windows reserved word with the same MS-DOS heritage. You can’t delete it with anything in Windows, so you need a POSIX tool, like, ahem, Cygwin, to affect the deletion.

So I deleted CON.cif using my later installation of Cygwin, and I was thus able to delete the entire directory tree as a result. More to this issue is: what happens when you need to delete CON.cif and have no intention of reinstalling Cygwin? Stack Exchange has a whole discussion on this which makes my long story even longer, so I will end my article here.

The Reach of Bell Media

Bell Media controls what appears to be the majority of the media market in the Greater Toronto Area.

Greater Toronto Area: First, they provide most people here with their internet. There seems to be not too small an amount of competition from companies like Rogers Communications, however, but I think that makes Toronto pretty much a two-company town when it comes to internet. Smaller players exist, but they are so small you hardly notice them. Toronto is hardly a bit player when compared to other North American markets, as it is North America’s fourth largest city.

And, allow me to list what Bell Media owns in Canada, and this is very visible in Toronto and surrounding area, known as the Greater Toronto Area:
TV – City Pulse, much of CTV, BNN Bloomberg
AM Radio: NewsTalk 1010, 680 News, Funny 820, the latter of which is the Canadian subsidiary of iHeartMedia (Wikipedia). iHeart Media is known for using Premiere Radio Networks to hire paid actors as callers on call-in radio talk shows to segue into planned stories or opinions. This is a common practice on many right-wing talk shows such as those hosted by Sean Hannity, Rush Limbaugh, and Glenn Beck, and has been known and quite openly admitted for some time. Here is a more in-depth report on it.

Finding Pi to more decimal places

Introduction

\pi, or the circle constant, is a number that is irrational. Irrational numbers consist of infinitely many decimal places which never repeat. This assures that you can never convert it into an exact fraction. But \pi is worse than that. It is also a transcendental number, meaning that it will never be the solution of a polynomial with integer coefficients and a finite number of terms. By the year 1400, the greatest advances in the accuracy of \pi was made by the Chinese, who were able to work it out to 6 decimal places.

Pi, known as the circle constant, or the Archimedian constant.

Circles.

You can come up with a lower and upper bound for \pi if you consider a circle of radius r, and take the area of an inscribed polygon of n sides whose corners touch the circles’ edge; and then the area of a circumscribed polygon, with the same number of sides, whose sides touch the circle’s edge. This was the tactic used by the Greek philosopher Archimedes about 2400 years ago, around 350 BC. Archimedes observed that the circle constant \pi can be had by dividing the circle’s area by the radius squared \left(\pi = \frac{A}{r^2}\right). But to get a circle area of any accuracy you had to have an accurate value for \pi. Since he could find the areas of polygons with much greater accuracy, Archimedes decided to circumscribe a polygon of n sides, whose sides touched the circle’s edge. But these areas were always too big. So, he also tried to find the area of the inscribed polygon of the same n sides. Of course, these areas were smaller than the circle’s area. He knew that \pi lay between these areas, or rather that: \frac{A_i}{r^2} < \pi < \frac{A_c}{r^2}, where A_i represents the area of the inscribed polygon and A_c represents the area of the circumscribed polygon. Another way of expressing this inequality may be more familiar to some: A_i < \pi r^2 < A_c. In fact, for a unit circle, this gets really simple: A_i < \pi < A_c, since r = 1 for a unit circle.

So, to increase the accuracy of \pi, all Archimedes had to do was increase the number of sides of the two polygons. You would achieve full accuracy for \pi if the number of sides goes to infinity, where you would then have: A_i = \pi r^2 = A_c. For over 2000 years, this was the holy grail for achieving \pi to perfect accuracy. Using this tedious method, Archimedes calculated polygon areas of up to 96 sides, so he was able to say \frac{223}{71} < \pi < \frac{22}{7}, or to at least estimate that \pi was about equal to 3.14 (decimals were also not known to the Greeks, so 3.14 is a modern estimate). Remeber that this was before computers or even before the discovery of irrational numbers. Square roots were known in his day, so his own calculations would involve fractions and nested square roots, which didn’t necesarily have integer or rational solutions, so an expression like 12\sqrt{6-\sqrt{3}} was left as it was. What was clear from his calculations, was that it was not possible to express \pi as a rational number, or an exact ratio of whole numbers. The good news is, the estimation of 3.14 is good enough for quick calculations today.

But of course, there was frustration in not being able to resolve \pi to a rational number, and so over the next 2000 years, across China, India, Persia, northern Africa and Europe, as we acquired more and more mathematical knowledge (including acquiring the decimal system), we could increase the number of sides of the polygon to a greater and greater number of sides. In France, François Viète used polygons of 393,216 sides in the year 1593, but could only achieve an accuracy of 10 decimals that way: 3.1415926536 (decimals were known by then). This would be a level of accuracy found on most inexpensive scientific calculators, and looked like a small prize given the number of sides in Viète’s polygon. But this was not state of the art in the early days of the Renaissance. Ludolph van Ceulen, a Dutchman in the late 1600s, who used a polygon of 2^{62} sides, or 4,611,686,018,427,387,904, or exceeding 4.6 quintillion sides. In these days before computers, or even electricity, this took van Ceulen 25 years as his lifetime achievement, but only generated \pi to 35 decimals: 3.141 592 653 589 793 238 462 643 383 279 502 88. There were those who surpassed this as well, but not by a lot.

The polynomial method of Newton, expanded to 12 terms, gives about the same accuracy as a scientific calculator, 3.141592654.

Sir Isaac Newton, or, what were you doing during the pandemic?

1666 was the year that Isaac Newton, a young Cambridge University undergrad student, was sitting at home, quarantining himself (as was everyone else) as the Bubonic Plague was raging through Europe. During his two years of social distancing, among his discoveries in optics, mechanics and Calculus was his method of computing the value of \pi. For this, the 23 year-old Newton used integration (which he called “fluxions”) on a polynomial with rational coefficients. He acquired accuracy to 9 decimals with only a 12-term polynomial. This was achieved by combining the circle formula with the binomial theorem. The circle formula for a unit circle is: x^2 + y^2 = 1

Solving for y in terms of x, we get y = \pm\sqrt{1-x^2}. It would be a good idea to find the area of the circle going from 0 to 1 (a quarter circle), so we would only need the “positive” version of this formula: y = \sqrt{1-x^2}. The integral would look like:

    \[ \int^1_0 \left(1 - x^2\right)^{\frac{1}{2}} dx \]

But because this only gets us the area of a quarter of the unit circle, we need to multiply the integral by 4 to get the exact answer \pi:

    \[ 4\int^1_0 \left(1 - x^2\right)^{\frac{1}{2}} dx = \pi \]

While we have a good idea that this will get us \pi, it doesn’t yet yield any decimals, since \left(1 - x^2\right)^{\frac{1}{2}} must be expanded into a polynomial. For that, you have to break some rules about the Binomial Theorem.

The binomial theorem applies to the expansions of binomials such as: \left(1 + x\right)^n, where it is normally understood that n is a whole number greater than or equal to 1 (or n \ge 1 | n \in \mathbb{Z}). The coefficients of a general binomial expasion go as follows:

    \[ \left(1 + x\right)^n = {n \choose 0}+{n \choose 1}x+{n \choose 2}x^2 + ... + {n \choose k}x^k + ... + {n \choose n}x^n \]

Squaring x makes the expression (1 + x^2)^n. Its expansion looks like this:

    \[ \left(1 + x^2\right)^n = {n \choose 0}+{n \choose 1}x^2+{n \choose 2}x^4 + ... + {n \choose k}x^{2k} + ... + {n \choose n}x^{2n} \]

Now turning this into (1-x^2)^n, where we subtract instead of add, gives us a similar polynomial, but this time with alternating plus and minus signs:

    \[ \left(1 - x^2\right)^n = {n \choose 0}-{n \choose 1}x^2+{n \choose 2}x^4 - ... \pm {n \choose k}x^{2k} \pm ... \pm {n \choose n}x^{2n} \]

So, the strange thing Newton did with this is that he broke the rule that n be a natural number. Instead, for the purpose of finding the area of a unit circle (that is, pi, to as many decimals as possible), he had to go back to the formula for combinations, that is, {n \choose r} = \frac{n!}{(n-r)!r!} to see what would happen if n = 1/2. The reason for this is because it fit in with the circle formula of (1-x^2)^{1/2}.

n!, called “n-factorial”, is normally the whole number n, multiplied by all of its integer predecessors down to 1, as in: 3! = 3\times 2\times 1 = 6. You stop multiplying when you reach 1. But what if n = 1/2? For normal counting numbers, subtracting 1 gets you to the next lower whole number. At some point, you will reach 1 if you keep subtracting 1. But if n = 1/2, then subtracting 1 will always yield a fraction, and you never reach 1. In fact, you proceed forever into the negative numbers. Thus, a number like 1/2, when the formula is applied, leads to: \frac{1}{2}\times \frac{-1}{2}\times \frac{-3}{2}\times \frac{-5}{2}\times ... going forever. Is this useful?

It turns out, it does have  a use when placed in the formula for n \choose r, because, for example, the first term is 1, due to n \choose 0. The next term has the coefficient:

    \[ {n \choose 1} = \frac{n(n-1)(n-2)...(3)(2)(1)}{(n-1)(n-2)...(3)(2)(1)\times 1} = n \]

So, after all that, if n = 1/2, then this coefficient becomes 1/2 so that the second term is \frac{-x^2}{2}. The third term has the coefficient:

    \[ {n \choose 2} = \frac{n(n-1)(n-2)...(3)(2)(1)}{(n-2)(n-3)...(3)(2)(1)\times 2} = \frac{n(n-1)}{2} = \frac{n^2 - n}{2} \]

So, for n = 1/2:

    \[ \frac{\left(\frac{1}{2}\right)^2-\frac{1}{2}}{2} = \frac{\frac{1}{4}-\frac{1}{2}}{2} = \frac{-1}{4}\times\frac{1}{2}=\frac{-1}{8} \]

The first 12 terms in the infinite expansion are given in the above illustration at the start of this section.

How much of \pi could we get “on the cheap” by performing integration on only the first 7 terms?

    \begin{align*} \pi &= 4\int_0^1 \left( 1-\frac{x^2}{2}+\frac{x^4}{8}-\frac{x^6}{16}+\frac{15x^8}{384}-... \right) dx \\ &= 4\left( x-\frac{x^3}{6}-\frac{x^5}{40}-\frac{x^7}{112}-\frac{5x^9}{1152}-\frac{7x^{11}}{2816}-\frac{7x^{13}}{1024}-... \right) \Big|_0^1 \\ &= 4\left[1-\frac{1}{6}-\frac{1}{40}-\frac{1}{112}-\frac{5}{1152}-\frac{7}{2816}-\frac{7}{1024}-...\right] \\ &= 3.14297 \end{align*}

7 polynomial terms is all it takes to get the same accuracy Archimedes once had when he attempted to average out the areas of a 96-sided polygon both inscribed and circumscribed around a circle.

Integration will measure the area of the part of the circle from x=0 to x=0.5, down to the x axis. This shape can be thought of as a 30 degree sector combined with a right triangle.

There is an even better calculus-based solution, which has greater accuracy in fewer terms. What you want to do is to calculate the area under the same curve over 0 to 1/2 instead of 0 to 1. Substituting x = 1/2 allows each term to shrink faster, and thus to obtain accurate results with less work. Newton knew that on a unit circle centered at the origin, x = 1/2 is actually \cos(60^\circ). The y-value, by extension, is \sin(60^\circ) = \frac{\sqrt{3}}{2}. The area he is calculating describes a sector of the circle 30^\circ  from the perpendicular (this is 1/12th of the total area of the circle, and so its area is \pi/12). Added to this sector is a right triangle whose base is 1/2 and whose height is \frac{\sqrt{3}}{2}. The triangle would have an area of \frac{\sqrt{3}}{8} by the area formula A=\frac{1}{2}bh. It would be useful to get only the sector and subtract out the right triangle from the integral. So we will illustrate the first 5 terms of what Newton did:

    \begin{align*} \pi &= 12 \left(\int_0^{\frac{1}{2}} (1-x^2)^{1/2} dx - \frac{\sqrt{3}}{8}\right) \\ &= 12\int_0^{\frac{1}{2}} (1-x^2)^{1/2} dx - \frac{12\sqrt{3}}{8} \\ &=12\left( x-\frac{x^3}{6}-\frac{x^5}{40}-\frac{x^7}{112}-\frac{5x^9}{1152}\right)\Big|_0^{\frac{1}{2}} - \frac{12\sqrt{3}}{8} \\ &= 12\left(\frac{1}{2}-\frac{1}{48}-\frac{1}{1280}-\frac{1}{14336}-\frac{5}{589284}\right)-\frac{12\sqrt{3}}{8} \\ &= 3.14161 \end{align*}

That is an accuracy within \frac{1}{50,000}, which is impressive for a mere 5 terms. If you wanted more accuracy, just add more terms. Applying 7 terms as we did above would give us \pi\approx 3.141585, or an accuacy of within \frac{7}{1,000,000}.

Modern \pi calculations reflect the power of computers rather than the power of human calculation

Not much progress was observed after that until the invention of computers. So by 1949, the invention of the ENIAC computer gave us 1,120 decimal places, taking 70 hours. By 1973, the CDC-7600, or Cray computer was the first device to give more than 1 million decimal places in 23.3 hours. August 1989 was when the 1 billion digit barrier was broken, using an IBM mainframe. \pi became known to 1 trillion digits in 2002, by a Japanese team using a Hitachi supercomputer, after taking 25 days. Since then the orders of magnitude and computational time appeared to have plateaued somewhat. The latest world record, according to The Guiness Book of World Records, was in November 2020, when 50 trillion digits were found over a period of 8 months of computation. If printed in a normal sized font on letter-sized paper, it would require nearly 28 billion pages to contain the constant at 1800 characters per page. The supercomputer used 4 Intel Xeon processors (15 cores per CPU) running at 2.5GHz each, had 320 GB DDR3 RAM, and 336 terabytes across 60 hard drives, most of them used for computation.

As of 2021, a claim has been made of 62 trillion digits in a little over 3 months. The Swiss-based computer was able to find more digits, faster because of slightly more advanced hardware: Two AMD Epyc 7542 32-core processors at 2.9 GHz each, 1 terabyte of RAM, and 510 terabytes of storage across 38 hard drives, most used for swapping data with the RAM. Their “book” would be over 34 billion pages long if the digits were printed out. It was never made clear what kind of RAM was used. It is assumed they used DDR4.

The current computation of \pi to ever more digits has become a quasi-annual event; an opportunity for computer companies to flex their technological muscle and promote their brand. These impressive calculations are not so much human achievements in the sense of Newton or van Ceulen, but are really achievements of computer engineers and software programmers.

But how many digits do we really need? Even to express the diameter of the universe to within a Planck length (1.6162\times 10^{-35} meters), we would only require 62 digits of \pi.

This article is based on a video by YouTube vlogger Veritasum, plus some additional sources, such as the University of St. Andrews department of Math History.

Shopping for a printer, and network troubleshooting mysteries

Brother HL-3170CDW
Brother HL-3170CDW. My current printer with the dodgy network card.

I vaguely remember the network card not working when I bought the new Brother computer I am currently using. But I decided about a year or two later to test what is wrong using my network tester, which can test a connection over a cat 5 cable. Plugging both ends of the cable into the tester seemed to work. So I know the cable is fine. Plugging one end into the printer and the other end into the tester, it seemed to work also. Then testing the connection on the router using the same cable worked as well, in the sense that the lights on my testing device were blinking in the right order. But when I finally hooked up the printer to the router, I noticed no lights were flickering on the router end. So, maybe that port was the problem? I took a working connection from a switch I didn’t care about, and plugged it into the same ethernet port on the router. Suddenly that port came to life. So, I finally recalled that the printer had something wrong with the network card. I had the card on the printer replaced early on, and it was defective again. That, I remember, was the reason why I hooked up my printer by USB. It has wireless capability, but 1) both my desktop PCs have only cat-5; and 2) the printer is not visible on my router’s wireless settings anyway.

I stuck with the printer because it was a simple printer that did duplex printing and did it well. But I am going to have to consider shelving this printer and getting another one which with a network port that works. So far, my best bet is to order online, since almost nothing appears to be in stock. I am reading Amazon reviews of some decent printers and there are many harrowing tales about multiple DOA printers (original was DOA and so was its replacement), sketchy tech support  – and this is for a Xerox printer, which one would have thought would be an established brand. This will take some thought, and maybe a bigger budget than planned. And this is for a single-function duplex laser printer. I am not asking for anything crazy here.

For now, I refreshed the drivers, and cleaned out the system using CCleaner. The printer will have to serve me for now.

Speccy
Speccy

I was reviewing my computer’s specs using a software called “Speccy”. You might have heard of it. It is one of those small bits of software that came with my “Pro” copy of CCleaner. It just tells you details about your system and components. I wanted a printout of what I saw on the screen regarding what drive letters are intended for which empty ports on my card reader. And about 30 pages of printing later, … not much on that, but a lot on each and every other detail I wasn’t interested in. It would have still kept printing had I not hit the “cancel” button on the printer. I specified double-sided printing, but because I changed the driver to the functioning printer in front of me, the duplex setting was forgotten about by the driver, and the 30 or so pages are all single-sided. What a waste.

Looking at the website for Consumer Reports, I notice that the field is dominated by Brother or HP printers. Xerox is way down below the top 10, receiving scores in the 50s, but no single-function printer I looked at scored above 68. Also, the most expensive are not necessarily the highest-rated. Another workhorse brand, Lexmark, also is not in the top 10.

Brother HL-3230CDW
Brother HL-3230CDW. Not all that different.

My top two criteria are “Predicted Reliability” and “Ink/Maintenance”. The latter criteria, I found out later, are mostly relevant to inkjets, since it refers to the ink used during their self-cleaning/maintenance cycle. All printers shown to me were duplexing color lasers. No printer scored 5/5 for reliability. The top-rated printer, a Brother HL-3230CDW (CR score of 67), has the familiar problem in that it refuses to print in black (or print at all) if a color cartridge runs out. My printer is similar in this regard. I like that it duplexes, something I am willing to pay a little extra for. But apparently it does not print color photos very well, a “feature” shared by these sorts of printers, apparently. The tray takes up to half a ream. Prices vary from $350 to over $550 depending on the seller.

Hewlett Packard Color LaserJet Pro M255dw
YASTDCLP (Yet another single-tray, duplexing, color laser printer), this time the HP M255dw.

Just below that is a Hewlett-Packard Color LaserJet Pro M255dw, given a rating of 66. Photo quality is still bad; and this one will reject generic cartridges, forcing you to have to shuck out the full price of HP cartridges. Horrible business practice. The printer I have right now is using generic cartridges. In fact, it has never used cartridges from the manufacturer since I had purchased it three years ago. The four generic cartridges cost me a total of $200. Each HP cartridge costs around $80, and four of them would pay for the cost of the HP printer they fit in. CR estimates that with the long life of the cartridges, your cartridge outlay will be in the neighbourhood of $500 over 4 years. I am converting to Canadian dollars and lowballing. Lexmark printers also insist on their proprietary cartridges. Xerox doesn’t appear to suffer from this problem; and Brother certainly doesn’t. CR’s priorities are not the same as mine, it appears.

HP AIO
The ultimate HP AIO color laser printer. The fastest, and boasting the lowest printing cost per page. At a $10K price tag, it could only be the lowest cost per page for me if they were giving away free reams of paper. It might pay off in a business setting where the printer is in very high usage, due to its monthly duty cycle of 125,000 pages.

Generally, the ratings are depressingly low. Higher ratings (starting at 78 and going down) are given to monochrome AIO (“all-in-one”) printers, and I am not interested in that. Many of them are also mostly suitable for offices. When it comes to color AIO models, the scores drop to 70 starting with a Brother MFC printer. These generally have higher price tags. AIOs generally print, scan, fax, and photocopy. I haven’t had the need to photocopy, and have separate scanners which perform much better than the AIOs I’ve used. And is faxing still a thing with anyone? Most of us just receive documents sent as emailed attachments these days. In my experience, the fax feature, when I had bothered to hook it up, is only just an avenue for a grifter to send junk faxes to me, at the expense of my ink and my paper.

I guess while CR wouldn’t have known that I have a high-performing scanner and have no need of an AIO, it has helped me to clarify my own priorities: 1) Color laser; 2) duplexing (inkjets do color better, but I am not sold on inkjets doing that on both sides of the same sheet without bleeding, and lasers have a lower per-page cost); 3) reliability with a cat-5 (wireless is OK too, but only if cat-5 is working); 4) compatability with refillable, aftermarket toner cartridges.

As a postscript, my outlay for my working, networked printer was $0.00. I turns out that there was nothing wrong with the network card. What tipped me off was that I got the printer to print out the network information, and noticed the printer had an IP address, and knew the IP of the router. Paradoxically, the printer was not visible anywhere on the network. So, rather than untangle that, a factory reset was all that was needed.

Prime Curios IV: The number 13

12 is a nice number. It is why we order a dozen doughnuts, for example. You can most likely keep all the guests happy, allowing you to divide the doughnuts among 2, 3, 4, 6, or 12 guests (not counting yourself). Thus, 12 has a lot of divisors, making it a highly composite number. It would have been nice to have our money denominated under a base-12 system (called a “dozenal” system), since there are so many ways to evenly divide the cash.

13 is just one more added to 12, but then the number becomes very uncooperative by contrast. You can’t even divide 13 in half, evenly. While 13 doughnuts is a called “a baker’s dozen”, there is no way to divide them among guests unless you have 12 guests; but at least this way you have a doughnut left over for yourself. It is amazing what happens sometimes when you add 1. But the indivisibility of 13 is a property shared by all prime numbers.

13 objects.

13 is the second number in a series called a star number. A star number is the number of objects you can arrange into a six-pointed star. The next 3 numbers in this series are: 37, 73, and 121. The first number was 1. 13 is likely the only positive number that is prime, lucky, happy, unlucky (depending on the culture), and Fibonacci.

An 18th-century American flag.

13 is the number of archimedian solids; the number of tricks in a bridge hand; the number of leaves on the olive branch of an American dollar bill; the number of both stars and stripes on an American flag from the 18th century; it is the greatest number of seconds that a chicken has been recorded flying; it is also the number of volumes in Euclid’s Elements; the number of record albums recorded by The Beatles; the number of digits in an ISBN number; and the number of rounds in Yahtzee.

13 in base-10 is 31 in base-(1+3) (or base-4). 13 is a factor of the 3-digit number abc if 13 is also a factor of a + 4b + 3c. 13 with its digits reversed is 31, which is also prime (called an emirp). ELEVEN PLUS TWO contains 13 letters; so does TWELVE PLUS ONE. Also, the product of pi, Euler’s constant, and the golden ratio, rounded down, or: \lfloor \pi e \Phi \rfloor = 13. Performing arithmetic on the first 5 primes yields 13 if done in the following manner: (5\times 11) - (2\times 3\times 7)=13.

The Republican logo

13 is the smallest Republican prime number. These are numbers whose left-hand digits (not counting the middle) are prime and the right-hand digits are not. 1 is not actually a prime number, nor is it composite. Democratic primes exist whose numeric patterns are the opposite. Thus, the reversal of 13, or 31, is a Democratic prime.

.
Belphegor.

The number 1000000000000066600000000000001, which has the number of the Beast (666), flanked on both sides by 13 zeroes and beginning and ending with 1, is prime, and is called a Belphegor prime. This prime is also palindromic (reads the same backwards and forwards). Belphegor is one of the seven princes of hell, presiding over the deadly sin of sloth. The Belphegor prime is also a “naughty” prime, due to the number of naughts, or zeroes present in the number. This number also has 31 digits, which is 13, reversed.  There are 13 prime numbers between 13 and 31.

In 2013, there were two Friday the 13ths, and both were 13 weeks apart. 13 is the number of days the Julian calendar is behind the Gregorian calendar. ROT-13 is a kind of message encryption which “rotates” all letters in the message around the 13th letter of the alphabet with the effect of preventing accidental reading of internet text messages such as spoilers to novels or movies.

I researched the Prime Curios website; Numberphile on YouTube; and the OEIS library of number sequences for this article.

My Introduction to the Raspberry Pi

The Raspberry Pi version 4B

I was recently sent a Raspberry Pi 4B computer, disassembled, with little introduction or fanfare. I have heard much about the miniature hobby computer over the past decade, but hadn’t actually used one or seen one up close until now. I put it together, and observed that it didn’t POST on its own. Being a tiny motherboard, it has no BIOS at all, and is completely dependent on the installed operating system for hardware detection and testing. I downloaded and installed a Debian image made for Raspberry Pi using their imager you could download from their website.

It boasts a quad-core ARM Processor (Revision 3). It is not your average Intel processor. All of the largest chips on the motherboard each take up no more than 1 square cm, and the heat sinks are so small that they attach like little aluminum decals to their processors. It comes with 4GB RAM installed, and a place for a Micro-SD for the operating system and limited storage. It can support up to two 4K HD monitors at 60 frames per second, each connected with micro-HDMI connectors. It has connectors for legacy Type-A USB2 and USB3 devices. I am using the two USB2 connectors for the mouse and keyboard; and the other two for “anything else”. There is a third Type-C USB3.1 connector which is used for power. The power switch itself is on the same cable as for the power supply. You can also hook up a standard Ethernet cable for connecting to a network. If you don’t have ethernet, the Pi boasts a WiFi receiver. The motherboard goes inside a plastic system box about the size of a small pack of cigarettes.

On the motherboard are pinouts which resemble the ones used for the old parallel ATA connectors from decades ago. After learning how to send power to which pin through a comnputer program, the possibilities of operating small electrical devices (lights, speakers, an arduino device, what else …?) expand greatly.

Uh, (ahem) ….

The installation had a few hitches, since it appears I cracked the first two micro SD cards either on the supplied USB adaptor, or on the micro-SD mount provided underneath the motherboard. I went and purchased a third, a 32GB Sandisk Ultra (I could have gone as low as 4GB, but this was the smallest sold by Staples). I installed the OS using their installer again, and this one booted. Since I was at home, I didn’t have access to my supplied monitor, keyboard and mouse, so I just reconnected existing devices at home, and was rewarded by a rather nice X-Windows display.

The CanaKit Raspberry Pi 4: A $100 Office PC and More ...
The default desktop for Raspberry Pi 4, with some icons added. It comes with a minimal set of default apps, and access to a BASH shell.

The Pi is bluetooth-enabled, but I hadn’t tried it yet. I did plug in a wireless adapter for a Logitech keyboard/mousepad combo (the K400 Plus), and it worked instantly.

Now, since I was given this computer as a teaching tool for students, I made the default account password-protected, and created a new account named “student” with fewer priveleges: they can’t install or remove software, and are not part of the “games” group. The first restriction appears effective when I tested it, but the latter exclusion from the “games” group still meant they were able to play  some games, for example those that originate from the python graphics libraries. My students, like teenagers everywhere, have at least a mild addiction to computer games, so I decided to remove them as a possible distraction. Since all students will use  a single account, they will need their own USB thumb drive, since there won’t be many other ways to save files edited on the Raspberry Pi. However, since it has WiFi, there is always G-Drive or OneDrive.

Prime Curios III: The number 23

Number23.jpg
“The Number 23”, a 2007 movie which starred Jim Carrey and was directed by Joel Schumacher.

23 was the number featured in two movies. The 1999 movie called “23” was in German,  starring August Diehl, Fabian Busch, Dieter Landuris, Jan Gregor Kremp. The Hollywood movie called “The Number 23” was released 8 years later, starring Jim Carrey, Virginia Madsen, Logan Lerman, and Danny Huston. Both movies appear to be psychodramas based in some way upon the fear of the number 23, a condition known as Eikositriophobia. The phrase “the 23 enigma” figures in this film, usually uttered by people who find a mystical significance with the number 23.

Yes indeed there are people in the world that fear a specific number of some kind. Each number has its own long and nearly unpronouncable name. The most common fear would probably be Triskaidekaphobia, the fear of the number 13 (oh yeah, another prime number). But let’s stick to the number 23 for this article.

    • It is part of the expression “23 skidoo!”
    • 23 is a number whose digits add to 5, the next prime.
    • 23 is a part of the Birthday Paradox: 23 is the minimum number of people to have in a room, where the probability of two people having the same birthday is just over 50%. Related to this, is the question of how many ways can 23 people be paired? It turns out that this becomes {23 \choose 2} = 253 \approx 365\ln{2}.
    • Twin primes are a pair of prime numbers which are also two consecutive odd numbers. Examples are 3 and 5; 5 and 7; 11 and 13; 17 and 19. The first prime that cannot be “twinned” in this manner is the number 23.
    • 23 is also called a “factorial prime”, because the next whole number, 24, is a factorial: 24 = 4\times 3\times 2\times 1 =4!.
    • Reversing the digits makes it a power of 2: 32 = 2^5=2^{2+3}.
    • e^\pi, rounded down to the next lower integer, is 23, or: \lfloor e^\pi \rfloor =23.
    • The sum of the first 23 primes is 874, a number divisible by 23.
    • 23 is made from digits which are the first two primes, 2 and 3. Wikipedia calls a number like 23 a Samarandache-Wellin prime, where putting together the digits of the first n consecutive primes makes the next Samarandache-Wellin prime. “2” is the first prime, so is the “sum” of only one prime. The second prime has to be the concatentation of the first two primes, so “23” is the next one. 5 divides “235”, so that doesn’t work; but “2357” is prime, the concatenation of the first 4 primes to make the third Samarandache-Wellin prime.
    • 23 is also the number of chromosomes in a human; the atomic mass of sodium; the degrees of tilt of the Earth’s axis; the Bible’s 23rd Psalm; and the number of times Roman emperor Julius Caesar was stabbed in the Theatre of Pompeii.