Another University Exam From Hell …

The list of fictional questions to university exams have been around for a long time. Such as:

Epistemology: Trace the development of human thought from 3000 BC to today. Compare and contrast with any other kind of thought.

Engineering: You have the disassembled parts of an AK-47 assault rifle in front of you. Also in front of you is an assembly manual, written in Navajo. In 15 minutes, a hungry Bengal tiger will be let into the exam room. Take whatever action you feel is appropriate. Be prepared to justify your decision.

Medicine: You have a scalpel, a clean rag, and a bottle of scotch. Remove your appendix. Do not suture until work is inspected.

Philosophy: Why?

The first three questions are bogus. But as the urban legend has it, the person who scored perfect on the last question answered with “Why not?”, signed his (or her) name to it and handed in his (or her) two-word essay to the examiner and left the room.

Here is another philosphy question, rumored to have been asked, and this is a new one on me:

Philosophy: “If this is a question, then answer it.”

As the legend goes, there was the usual reaction of heads hitting the desks, pages of paper being filled out with their perilous struggles against whether they were actually being asked a question or not. The highest mark in the class went to the one who handed in this 8-word essay: “If this is an answer, then mark it.”

Facebook bots apparently make their own language

From 2001: A Space Odyssey (1968)

Like a scene from Stanley Kubrick’s 2001: A Space Odyssey, computers are now seemingly taking matters into their own hands and possibly overthrowing their human overlords.

Many news outlets are telling us that Facebook bots can talk to each other in a language they are making up on their own. Some news outlets appear convinced that this communication is real. Even fairly respectable news outlets such as Al Jazeera are suggesting the proverbial sky is falling. However, they fall short of speculating that the Facebook bots are plotting against us.

While Facebook pulled the plug on the encoded “conversation” (which on inspection was repetitive gibberish along with repetitive responses), one half-expected the bots to try and prevent the operators from turning them off somehow. Maybe by disabling Control+C or something. Maybe they were plotting to prevent the human operator from pulling the plug from the wall.

What Facebook was experimenting with was something called an “End-to-End” negotiator, the source code of which is available to everyone on GitHub. Far from being a secret experiment, it was based on a very public computer program written in Python whose source code anyone could download and play with themselves on a Python interpreter, which is also freely available for most operating systems. And to greatly aid the confused programmer, the code was documented in some detail. Just to make sure everyone understands it, what it does, and how to make it talk to other instances of the same program.

They were discussing something, but no one knows what. There are news stories circulating around that they gerrymandered the english words to become more efficient to themselves, but I am going to invoke Ocham’s Razor and assume, until convinced otherwise — that this was a bug, the bots were braindead, and the world is safe from plotting AI bots.

For now.

A Look at Geometry in Grade 10: Circles

From Handal, et al. (2013), a diagram which includes technological knowledge, also a consideration for math teachers, or any teacher using 21st century learning.

Pedagogical content knowledge is a type of knowledge that is unique to teachers, and is based on the manner in which teachers relate their pedagogical knowledge (what they know about teaching) to their subject matter knowledge (what they know about what they teach) (Cochran, Kathryn, 1997). This concern seems especially pertinent for math teachers. I attempt to show how subject matter knowledge and pedagogical knowledge are both essential in getting students to the point where they can be assessed on a circles problem in grade 10 academic math.

Teachers are reminded at the outset that while knowing the subject is one essential ingredient, so is knowing your students and your age group. Students must be known individually, to become familiar with how they see the concepts, in their own words. This means that in a normal class setting, students must be able to be able to express themselves without fear of judgement. The teacher also needs to be familiar student IEPs, the supports in their school (student success teacher, guidance counsellors, social workers, and so on).
The teacher is urged to also try some geometry problems on their own. More than informing one’s content knowledge, the teacher is also learning to anticipate problems that may arise that affect lesson planning. According to Aslan-Tutak and Adams (2015), a lack of content knowledge robs teachers of being able to properly assess students real needs and strengths in the classroom.

This article takes a look at geometry in grade 10 and is written to raise awareness of the possible connectedness of aspects of geometry to other parts of the math program, and to also discuss implications for the learner.

In the Analytic Geometry strand, the Ministry (2005) gives as two of its overall expectations for the course MPM2D (Academic 10 Math):

  1. By the end of the course, students will model and solve problems involving the intersection of two straight lines;
  2. By the end of the course, students will solve problems using analytic geometry involving properties of lines and line segments.

Addressing both circles and the activity here involving them, the specific expectations look like this:

  1. By the end of the course, students will develop the formula for the midpoint of a line segment, and use this formula to solve problems.
  2. By the end of the course, students will  develop the formula for the equation of a circle with centre (0, 0) and radius r, by applying the distance formula for the length of  a line segment, d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2.
  3. By the end of the course, students will determine the radius of a circle with centre (0, 0), given its equation; write the equation of a circle with centre (0, 0), given the radius; and sketch the circle, given the equation in the form x^2 + y^2 = r^2.

Grade 10 appears to be the first and last time circles are covered as a relation. I would also tell students about a circle centred at the point (h, k), whose equation, (x - h)^2 + (y - k)^2 = r^2 is not that different from the distance formula shown above.

Student maturation. The chidren in this grade would generally be between 15-16 years old, and in most cases, maturationally ready to tackle math questions of some degree of complexity, even though impusivity is still an issue for most students at that age (Price, 2005). According to Price (2005), while impulsivity can be seen as a problem for adolescents of this age group regardless of their proficiency in math, she would also say that it can be regarded as an asset, that adolescent passion should be taken advantage of, and directed toward productive ends.

A task such as the three-point circle described below takes advatage of this passion, by subjecting a well-known property of circles to scrutiny. Beginning a rich task with a question starting with “Is it always true that three points always make a circle?” invites the student to try and make the idea fail. And of course, it does, sometimes. The student can then be asked, under what conditions does the idea fail, and can we re-state the conjecture that “three points make a circle” into something that is always true?

Big idea: Any three points can be used to form a circle if they are not on the same line. A rich task or rich assessment built on this will take with it a substatntial amount of the analytic geometry strand, and can wind up being among the last topics covered in a unit. The idea of three points making a circle is an old geometry problem. A much simpler, but less interesting, circle problem would be to have 3 points all some distance r from the origin to make a circle, which still loses none of the grade 10 content. Whenever I teach grade 10, I aim for a circle with an arbitrary centre, since so much of grade 10 math is embedded in it.

Rich problems such as this can be considered along the way as the result of a series of lessons. The sequence must be determined by the teacher

This can be either performed by the student using either geometry software, or using pencil and paper. It has been my experience that the latter option requires more time for the student, and more instructional time for the teacher, especially if the circle is not at the origin, which it likely won’t be given the prior requirement of “any three points”. This almost always requires the equation (x - h)^2 + (y - k)^2 = r^2, since the centre will be at some arbitrary point (h, k) rather than the point (0, 0).

It has been my experience that some learners take very well to this problem, while others are in need of assistance. If time is too tight, and students generally did well in the Quadratics strand, you might consider letting your students use Geometer’s Sketchpad to help solve the problem. Below, is a video where I demonstrate and discuss the use of Sketchpad for this problem.

Mostly, I will emphasize the benefits of a pencil-and-paper solution. And in the next video below, I demonstrate the use of an old fashioned geometry set and paper. The background music in this video is public domain, and there is no dialog, so feel free to turn off the volume (or turn it up). Since I was emphasizing technique in this video, I did not use graph paper.

A suggested lesson sequence to get to this point of the course (each of these could be one or more periods of lessons, covering other Big Ideas along the way):

  1. Solving lines and linear systems — point of intersection: a) Solve by substitution; b) Solve by elimination (this could take several periods)
  2. Midpoint of a line segment (can teach length of a line segment during this time to help confirm what we obtain from the formula \left( \frac{x_2 - x_1}{2}, \frac{y_2 - y_1}{2}\right) is really the midpoint) (1-2 periods)
  3. Solving quadratic systems (in Quadratic relations, the part on expansion of factors and solving is essential; however, the quadratic formula is not needed for this activity). (a couple of weeks)
  4. The equation of a circle a) centred at the origin (x^2 + y^2 = r^2) and b) centred at (h, k): (x - h)^2 + (y - k)^2 = r^2. Remind students of some properties of circles. For example, the circle is a collection of all points which are the same distance r from a centre point. (this can be 2-3 periods)
  5. A look at chords, along with major and minor arcs (optional, but is helpful in establishing a terminology for the three point/circle problem). Don’t spend a lot of time on this — it is not in the Ministry, but it is in some Ministry-approved grade 10 texts for the current curriculum.
  6. Students would need to play with trying to get three arbitrary points to make a circle for about 1 period to agree on what steps they would need to confirm the point/circle problem. They would either use software such as Sketchpad or a geometry set, but the decision must be made for the whole class. Students consolidate on what the steps ought to be to solve this problem. If software is used, I would add to the problem: find the full equation for the circle, its radius, and the centre point. If pencil and paper is used, after students have struggled, and an algorithm is decided upon, you might consider demonstrating a complete solution either on the board or using a document camera.
  7. Once the class agrees to an algorithm, 1-2 periods would be spent on a rich task (possibly a summative). If pencil and paper is used, the question is still do-able by grade 10 students, but I find not everyone can identify the centre with algebra, and usually end up estimating the position of the centre from the graph drawn. Thus, the there would also be a loss of accuracy in computing radius. (I would give a level 4 for the algebra; level 3 for estimating).

For the latter topic, that is, the algebraic solution to finding the centre from three points on a circle, I would suggest a PDF I wrote for my students, which demonstrated a sample calculation as they were working on their problem, given to them, or demonstrated the some days before the assessment, especially if anyone is having problems. Not all steps are shown in this handout, and the student is advised to perform the steps themselves. They would also be given a worksheet to practice on. It is from the PDF above mentioned that students began to point out the resemblance between the general circle equation and the distance formula, because both are used in the activity.

Supporting the teaching and learning of mathematics.

Going though with the pencil-and-paper method teaches students several things which would not be seen on a computer system:

  • Students see that there is now a broader use for expanding and solving quadratics, that isn’t part of the strand on quadratic relations, but uses techniques that are not foreign to it.
  • It is one opportunity to prepare students for the kind of math they may encounter in grade 11 Functions, grade 12 Advanced Functions, and Calculus and Vectors.
  • This is the last treatment students get with circle relations before university. It is no longer covered in grades 11 and 12, but such relations (and much more) are covered in first-year university texts.
  • Students see that there are parallels that can now be drawn between solving for a linear system and solving for a quadratic system — you still need two equations with the same two unknowns, for one thing.
  • What has preceeded shows that the unit must be very carefully planned to do this activity. But once done, the reward is an activity that captures a substantial part of grade 10 academic math.

Supporting high teacher efficacy.

In this page, I have covered most of the high points of this sort of lesson, and described in some detail much of the most difficult parts of it through videos and external documents.

In this page, I have told teachers how to prepare themselves and their students with suitable content knowledge, as well as what pertinent expectations are covered in the analytic geometry strand, as well as informing teachers of the maturational readiness of students, and how impusivity, re-directed as passion, can be used as an asset to student learning.

What I have not mentioned is that it is crucial that teachers must constantly assess their students in the “for” and “as” learning phases, through observations, conversations, as well as products. Most periods should not end without some kind of assessment of this nature. This is because, with this math, finding out where your students are in their learning is critical to understand next steps for planning. The consolidation phase could be a math congress where students share their findings, ask each other questions, and, with some guiding questions and information from the teacher, come to an agreement as to their general findings.

For teachers to be successful  in this strand, they would be best off with problem-based learning (PBL), using problems of varying degrees of open-endedness. This would be done for all or most lesson on the way to this one. PBL should be in the “Action” part of the 3-part lesson. Each lesson should not go without a consolidation phase (Ministry, 2010), where students share and explain their work, while answering questions.

Another aspect of geometry is covered by another video I did, one on quadrilaterals, with the question being: “Is it always true that midpoints on a quadrilateral make a parallellogram?” To see the answer, you have to accept rectangles and squares as special cases of parallellograms:


Aslan-Tutak, Fatma, and Thomasenia Adams. “A Study Of Geometry Content Knowledge Of Elementary Preservice Teachers.” International Electronic Journal Of Elementary Education, vol 7, no. 3, 2017, pp. 301-318.

Cochran, Kathryn (1997). Pedagogical Content Knowledge: Teachers’ Integration of Subject Matter, Pedagogy, Students, and Learning Environments [online] Available at: [Accessed 24 Jul. 2017].

Handal, Boris et al. (2013). “Technological Pedagogical Content Knowledge Of Secondary Mathematics Teachers – CITE Journal.” Citejournal.Org,

King, P. (2015). “Draw A Circle With Any Three Non-Collinear Points.” Youtube, 2015,

King, P. (2017). “Grade 10 Academic – Is It Always True That 3 Noncollinear Points Make A Circle?” Youtube, 2017,

Ontario Ministry of Education, Office of the Secretariat. (2010). Communication in the Mathematics Classroom (Vol. 13, Capacity Building Series). Toronto, ON: Queen’s Printer.

Ontario Ministry of Education (2005). The Ontario Curriculum Grades 9 and 10 Mathematics (Revised, 2005). Toronto: Queen’s Printer, Ontario.

Price, L. F. (2005). The Biology of Risk-Taking. Educational Leadership, April(2005), 22-26. Retrieved July 22, 2017.

Exploring Thales’ Theorem

I was playing with a geometry software package and decided to explore Thales Theorem.

The theorem states that for any diameter line drawn through the circle with endpoints B and C on the circle (obviously passing through the circle’s center point), any third non-collinear point A on the circle can be used to form a right angle triangle. That is, no matter where you place A on the circle, the angle BAC is always a right angle. Most places I have read online stop there.

There was one small problem on my software. Since constructing this circle meant that the center point was already defined on my program, there didn’t seem to be a way to make the center point part of the line, except by manipulating the mouse or arrow keys. So, as a result, my angle ended up being slightly off: 90.00550^{\circ} was the best I could do. But then, I noticed something else: No matter where point A was moved from then on, the angle would stay exactly the same, at 90.00550^{\circ}.

Now, 90.00550^{\circ} is not a right angle. Right angles have to be exactly 90^{\circ} or go home. If it’s not a right angle, then Thales’ theorem should work for any angle.

Why not restate the theorem for internal angles in the circle a little more generally then?

For any chord with endpoints BC in the circle, and a point A in the major arc of the circle, all angles \angle BAC will all equal some angle \theta. For points A in the minor arc, all angles will be equal to 180^{\circ} - \theta.

Note that BC is the desired chord, making the arc containing point A the major arc, with the small arc in the lower part of the circle the minor arc. As shown, all angles in the major arc are about 30.3 degrees.

So, now the limitations of my software are unimportant. In the setup shown on the left, the circle contains the chord BC, and A lies in the major arc, forming an angle \angle BAC = 30.29879^{\circ}. If A lay in the minor arc, the angle would have been 180^{\circ} - 30.29879^{\circ} = 149.70121^{\circ}.

By manipulating BC, you can obtain any angle \angle BAC you like, so long as \angle BAC < 180^{\circ}. More precisely, all angles in the minor arc drawn in the manner previously described will be 90^{\circ} < \angle BAC < 180^{\circ}, and all angles in the major arc will tend to be: 0^{\circ} < \angle BAC < 90^{\circ}. If the chord is actually the diameter line of the circle, then \angle BAC = 90^{\circ} exactly.

Programmatic Mathematica XVII: The Collatz Conjecture

There has been a lot of interest recently in the Collatz Conjecture. A lot of video blogs are going into it, particularly Numberphile, a vlog present on YouTube. It might have something to do with the fact that this year is the 70th anniversary of the conjecture. It is a simple idea, easy enough for a child to understand. Yet, it has been difficult enough that no one has been able to either prove or disprove it to this day.

The Collatz Conjecture is the hunch, or guess, or idea, that performing a certain recursive operation on any positive integer leads to the inevitable result that repeated operations on all successors will lead to the number 1. After that, the sequence of {1, 4, 2, …} occurs in an infinite repetition.

This problem was first posed by Lothar Collatz in 1937. The reason it is only a conjecture is that no one has been able to prove it for all positive integers. It is only conjectured to work as such. Over the past seventy years, no one has been able to furnish a counterexample where the number 1 is not reached. So by now, we’re “pretty sure” Collatz is correct for all positive integers.

I thought of some Mathematica code to write for this. The algorithm would go something like:

  1. Precondition: n > 0; n \in Z
  2. If n is 1, return 1 and exit
  3. If n is even, return n/2
  4. If n is odd, return 3n + 1
  5. Go back to line 2.

Like Fermat’s Last Theorem, which has been proved once and for all in 1995 by Professor Andrew Wiles, and aided by Richard Taylor, the Collatz Conjecture is simple enough to describe to any lay person (as I just did), but its proof has eluded us.

The application of the above algorithm to Mathematica code involves some new syntax. Sow[n] acts as a kind of array for anyone who doesn’t want to declare and implement an array. I would suppose that the programmers of the Mathematica language didn’t see the need for an array for many implementations, such as sequences of numbers. If you want to generate a sequence, you want the numbers in order from some lower bound, up to some upper bound. If you want to list them, you want to do the same thing. It is not often that you want to access only one particular value inside the sequence. This is for those people who just want the whole sequence uninterrupted.

I guess what Sow[n] does is leave the members of the sequence lying around in some pre-defined region in computer memory. That memory is likely to be freed once the Reap[n] function is called, which lists all the members of the stored sequence in the order generated.

EvenQ[] and OddQ[] are employed to check if n if odd or even before executing the rest of the line. If false, control passes through the next line. The testing is inefficient here, since each statement is tested all the time. So, if we already know the number is even, OddQ[] is executed anyway.

Co[1] = 1;
Co[n_ /; EvenQ[n]] := (Sow[n]; Co[n/2])
Co[n_ /; OddQ[n]] := (Sow[n]; Co[3*n + 1])
Collatz[n_] := Reap[Co[n]]

But Reap[n] by itself gives a nested array (or more accurately, a “ragged” array) with the final “1” outside of the innermost nesting, where the other numbers are.

In[10]:= Collatz[7]
Out[10]= {1, {{7, 22, 11, 34, 17, 52, 26, 13,
    40, 20, 10, 5, 16, 8, 4, 2}}}

Nested arrays are un-necessary, but the remedy to this gets rid of the number “1” which is the number the Collatz function is supposed to always land on. So we then rely on the presence of the number “2”, the number arrived at before going to “1”, at the end of the sequence. Getting rid of the nested array relies on using Flatten[Reap[Co[n]]]. But when you do that, this happens:

In[11]:= Collatz[7]
Out[11]= {1, 7, 22, 11, 34, 17, 52, 26, 13,
    40, 20, 10, 5, 16, 8, 4, 2}

Flattening has the effect of placing the ending 1 at the beginning of the array. If we can live with this minor inconvenience, then we are able to test the Collatz Conjecture on wide ranges of positive integers. So, this is the code we ended up with:

Co[1] = 1;
Co[n_ /; EvenQ[n]] := (Sow[n]; Co[n/2])
Co[n_ /; OddQ[n]] := (Sow[n]; Co[3*n + 1])
Collatz[n_] := Flatten[Reap[Co[n]]]

The sequences generated by the Collatz conjecture have the well-documented property of having common endings. Using the Table[] command, we can observe the uncanny phenomena that most of these sequences end in “8, 4, 2” (or, to be more precise, “8, 4, 2, 1”). Here are the sequences generated for the numbers from 1 to 10:

In[38]:= Table[Collatz[i], {i, 10}]

Out[38]= {{1}, 
          {1, 2}, 
          {1, 3, 10, 5, 16, 8, 4, 2}, 
          {1, 4, 2}, 
          {1, 5, 16, 8, 4, 2}, 
          {1, 6, 3, 10, 5, 16, 8, 4, 2}, 
          {1, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2},
          {1, 8, 4, 2}, 
{1, 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2},    
          {1, 10, 5, 16, 8, 4, 2}}

Because even numbers are to be divided by 2, somewhere along the meanderings of the sequence, a power of 2 is encountered, and from there it’s a one-way trip to the number “1”.

Gnome, a tale of a dead fail whale with a happy ending …

I moved my window manager from xfce to gnome today, and spent most of the day so far getting gdm3 to work. For a while, I was using two window managers, then narrowed it down to gdm3 and uninstalled the other one.

The login manager failed to come up, and for most of this morning I was stuck in a character console. In gnu/linux, strange things happen when you read a lot of documentation and error messages. I began to see artifacts that are in themselves hilarious, although after hours of poring through debug messages and error messages, I first thought I needed a long break. But no. The same phrase can be google’d, and others have reported seeing it, thus confirming my strange experience.

The error I saw was

We failed, but the fail whale is dead. Sorry.

So, what on Earth is a “fail whale”? It appears to mean that a part of the server that issues error messages, has died. Apparently, gdm3 itself didn’t die, since running ps showed that it was still running, although not running a login screen.

It turns out that the “fail whale” was a meme created by someone named Yiying Liu to refer to errors reported by Twitter. I guess I missed out on that meme.

Somewhere in the thicket of error and debug messages was a reference to the fact that /usr/share/gnome-sessions/sessions/ubuntu.session did not exist. I went to that location as root, and symlinked gnome.session to ubuntu.session.

ln -s gnome.session ubuntu.session

That appeared to be all that was needed. I was able to log on to a gnome desktop.

On the Syrian air strike, and Tomahawk missiles

… the most difficult thing about deciding what to write about these days isn’t so much that I’ve run out of ideas, but that the number of ideas are so numerous it’s actually hard to decide.

Just a while ago, on top of the usual computer/math stuff I usually write about, there was another technology that caught my interest, and I thought there was at least something to think about on this.

Yesterday morning, I woke up to news that Donald Trump gave the order to launch some 59 Tomahawk Missiles into an airfield in the west part of Syria. The news reported that this ominous act was a spur of the moment thing, done without congressional approval, but despite the egregious violation of protocol, I’ll try to focus at least somewhat on the technology (although the politics is hard to ignore).

Tomahawk Block IV cruise missile -crop.jpgThe Tomahawk is a missile that was at times manufactured by either General Dynamics, Raytheon, or McDonnell-Douglas, with a history going back to the early 1980s, with many improvements since then. It is essentially a guided missile, capable of flying as far as 2500 kilometres. Its “payload” can come in the form of either conventional or nuclear weapons. They pretty much all contain conventional explosives these days. It flies at about 890 km/h, which is slower than the speed of sound (which is 1,234.8 km/h), but still quite fast, owing to an internal jet engine. Most of these are launched from a ship, but they can also be launched from a submarine.

And oh yeah. Replacing the 59 Tomahawks fired earlier this week into Syria is going to cost 1 million dollars to replace. Each. Future costs are projected at around 1.5 million dollars each. And hardly any of the bombs appeared to hit their intended targets. The intended target, the Shyrat Air Base, was fully operational the next day.

Congress, who pretty much hold the purse strings for the government and must approve all spending, might have some legitimate questions to ask regarding spending up to 90 million dollars without asking. Others may ask even more pressing questions, more pressing than money — about dealing with ISIS/ISIL, or about the appearance (and the actuality) of fighting on both sides of the Syrian conflict, or about contradicting what a Trump spokesman has said this week regarding letting Syria do what it wanted (also a surprise statement). Did the missiles save lives? Did the missiles stop the transport of Sarin nerve gas? Did the missiles bring us closer to ending the conflict?

Here is a quote of the first words Trump made to the press of the April 6 attack:

My fellow Americans, on Tuesday, Syrian dictator Bashar al-Assad launched a horrible chemical weapons attack on innocent civilians. Using a deadly nerve agent, Assad choked out the life of innocent men, women and children. It was a slow and brutal death for so many, even beautiful babies were cruelly murdered in this very barbaric attack. No child of God should ever suffer such horror.

It is becoming burdensome to use empathy as a scale to judge the mind of Donald Trump. It is becoming more appropriate to judge him on how he appeals to our emotions and plays with them. He does this by communicating in an almost child-like language, but then makes references to “beautiful babies” being “cruelly murdered”, an attempt to wring out as much emotion as possible from the American public in support of the bombing. While propagandistic, it is crude propaganda, which seeks its usual aim of suppressing rational thought.

According to Trump, we must feel for anyone “brutally murdered” on the orders of al-Assad – especially the “beautiful babies” – yet, we also have to be against anyone who attempts to escape such “brutal murder” along with their families and other “children of God”, by emigrating to the United States for sanctuary. Recall that Syria was one of the countries Trump had on his list of banned countries of origin for immigration.

At some point, Congress (and later the taxpayer) will be asked to pay for this ultimately ineffective bombing raid. Wonder how that will play out …?

Happy π day, 2017

For π day 2017, this video posted back in 2015 about Pi day, 2019. That is when 2015 students graduate at MIT. Students at MIT registering in 2015 would now be in their second year.

BoUoW: Bash on Ubuntu on Windows

Tux is telling you the most current Ubuntu running for Windows for BoUoW.

I am not proud of possibly inventing the ugly acronym “BOUOW”, but “BASH on Ubuntu on Windows” appears to compel it. Maybe we can pronounce it “bow-wow” — not sure if that’s complementary. Just did a Google search, and, no, as predicted I couldn’t have invented it: It is variously acronymed: B.O.U.O.W., or BoUoW. It has been around since at least March of 2016, giving end users, computer geeks, and developers plenty of time to come up with something of a nickname or acronym.

But I actually mean to praise BoUoW, and to give it considerably high praise. This is a brave move on Microsoft’s part, and a long time coming. MS has made *NIX access available in its kernel for some time now, thus making *NIX conventions possible on the command line like certain commands in the Power Shell. The user has to enable the capability in the Windows 10 settings (“Windows Subsystem for Linux” (WSL)), and as Admin, the kernel has to be set to “Developer mode”, and follow the instructions on the MSDN website to download binaries and to enable a bash shell on either the command line or PowerShell.

BoUoW takes advantage of the WSL to do impressive things like use the same network stack as Windows 10 itself. This is because with WSL enabled, a UNIX command such as SSH can now make calls directly to the Windows 10 kernel to access the network stack.

This is, by Microsoft’s admission, a work in progress. It would worry me if they would not have said that. But lots of things do work. vi works and is symlinked (or somehow aliased) to vim. The bash shell comes with some other common aliases like “ll” for “ls -l”, for instance, and apparently, as part of the installation, you actually have a miniature version of Ubuntu, complete with a C compiler, and an image of Ruby, Perl, Python, and if it isn’t installed, you can always use “apt-get” to install it.

One of the security features has the disadvantage of conducting an install of BoUoW separately for each user. If a user types “bash” in a cmd window, and if BoUoW is not installed for that user, the install happens all over again, and the image goes under each user’s AppData directory requesting a BoUoW install. If you are using an SSD for C: drive like me, then you might find that limiting due to a shortage of space.

There are many things not recommended yet. If you are a serious web developer, for example, you would find many of the things you want, such as mySQL, are not currently working the right way. If you are a systems programmer, then you’ll find that ps and top only work for unix-like commands, so I wouldn’t use BoUoW for any serious process management. That being said, it does contain the old standbys: grep, sed, and awk.

The compiling and output of my “Hello, world!” program, also showing the source code.

gcc had to be installed separately. The binary it created for my “Hello, world!” program lacks the Microsoft .exe extension. And as it is for Unix binaries, it lacks any default extension. It is using gcc version 4.8.4. The current version is 6.3. This older gcc usually won’t pose a problem for most users.

The current stable Ubuntu is 16.04. BoUoW uses the previous stable version, 14.04, and thus has slightly older versions of Perl (5.18), Python (2.7.6), bash (4.3.11), Ruby (1.8) (available using apt-get), vim (7.4), and other software. Vim, however, appears to be the “large” version, which is expandable, using plugins like Vundle, which is good news. I don’t suspect that these slightly older versions would cause anyone problems, except possibly for Python, which has gone all the way up to version 3.5.2 since. You are warned also that it is possible that under Python or Perl, you might run into problems due to not all of their libraries running correctly under BoUoW. Not surprising, since Python has hundreds of installable libraries and Perl has thousands of them. Could take a while.


Another crack at 6×6 magic squares

Even-ordered magic squares are not difficult just because they are even, in my opinion. They are difficult to design because their order is composite. My experience has shown that by far the easiest to design are magic squares whose order is a prime number like 5, 7, 11, or 13. I have run into similar problems with 9×9, 15×15, as well as 6×6 and 8×8. The 6×6 seems to have the reputation for being the most difficult to make magic, although I have stumbled on one system that produced them, and wrote about it a few years ago, about how I applied that method to a spreadsheet. That method, however, led only to 64 possibilities.

Spreadsheets are a great way of checking your progress as you are building such squares, especially when you are trying to build a square using, say, a method you made up on your own, such as applying a Knight’s tour (which works OK with an order-8 square) to an order-6 square. This would require some facility with using spreadsheet formulae and other features which improve efficiency. Using your own method is very much based on trial and error, and you have to make a rule as to whether you will be wrapping the Knight’s moves (if you decide to use a Knight’s tour) to the opposite side of the board, or will you be keeping your moves within the board limits, changing direction of the “L’s” in your movements (this seems to lead to dead ends as you find you have no destinations left which follow an “L”, and consequently, squares which are not really magic). At any rate, the best squares follow some kind of rule which you need to stick to once you make it.

The best ones I have been able to make with a knights tour are: 1) when your L’s are all in the same “direction”‘ 2) when you sum up two squares. The problem is, all of the ones I have made with these methods so far either end up with weak magic (rows add up but not the columns) but the numbers 1-36 are all there; or all rows and columns make the magic number of 111, yet not all of the numbers are present and there are several duplicated (and even triplicated) numbers.

1 9 17 24 28 32 111
26 36 4 7 15 23 111
17 19 27 32 6 10 111
34 2 12 17 19 27 111
21 29 31 4 8 18 111
12 16 20 27 35 1 111
132 111 111 111 111 111 111 90

The above table shows the totals for the rows and columns for one attempt I made for a semi-magic square. Rows and columns work out to the correct total, but not the diagonals, as shown by the yellowed numbers. There are also duplicate entries, as well as missing entries. 1, 4, 12, 19, and 32 have duplicates, while there are three of 17 and of 27. Numbers missing are 3, 5, 11, 14, 22, 25, 30, and 33. That being said, the rows and columns add perfectly to 111, but not the diagonals. However, the average of the diagonals is the magic number 111 (this does not always work out). The sum of the missing numbers is 156, while the sum of the “excess” numbers (the sum of the numbers that occur twice plus double the sum of the numbers occurring thrice) is also 156 (could be a coincidence).

The above semi-magic square results from the sum of two squares where a knight’s tour is performed with the second square where the numbers 1 to 6 go in random order going down from top to botton. If I am too close to the bottom edge of a column, the knight’s tour wraps back to the top of the square. Beginning on the third column, I shift the next entry one extra square downward. The result is 6 of each number, each of these unique to its own row and column.

The first square are the multiples of 6 from 0 to 30 in random order going from left to right, also in a knight’s tour, wrapping from right to left and continuing. The third row is shifted by 1 to the right.

0 6 12 18 24 30
24 30 0 6 12 18
12 18 24 30 0 6
30 0 6 12 18 24
18 24 30 0 6 12
6 12 18 24 30 0
1 3 5 6 4 2
2 6 4 1 3 5
5 1 3 2 6 4
4 2 6 5 1 3
3 5 1 4 2 6
6 4 2 3 5 1

Note that the first square wasn’t really randomized.  When I tried to randomize it, the result was still semi-magic, similar to what was described. In the case I attempted, the average of the diagonals was not 111. The two are added, this time using actual matrix addition built into Excel. There is a “name box” above and at the far left of the application below the ribbon but above the spreadsheet itself. This is where you can give a cell range a name. I highlighted the first square with my mouse, and in the name box I gave a unique name like “m1x” (no quotes). The second was similarly selected and called “m2x”. I prefer letter-number-letter names so that the spreadsheet does not confuse it with a cell address (which it will). Then I selected a 6×6 range of empty cells on the spreadsheet and in the formula bar (not in a cell) above the spreadsheet (next to the name box), I entered =m1x+m2x, then I pressed CTRL+ENTER. The range of empty cells I selected is now full with the sum of the squares m1x and m2x, which is the first semi-magic square shown in this article.