## The meaning of i^i

Imaginary numbers, like most things at the peripherals of our grasp of reality, interest me, since they appear to have their own rules at times. There was a video blog some time ago that tried to reckon with $\large i^i$ and considered what it equalled.

One calculation I observed came from De Moivre’s identity, $\large e^{i\theta} = \cos\theta + i \sin\theta$. If you let $\theta = \frac{\pi}{2}$, you get $e^{i\frac{\pi}{2}} = 0 + i = i$.

Now raising both sides of the equation $e^{i\frac{\pi}{2}} = i$ to the power i, you obtain the result: $e^{i\cdot i\frac{\pi}{2}} = i^i$, and, since $i\cdot i = i^2 = -1$, you get: $e^{\frac{-\pi}{2}} = i^i$.

This is a notable equation because the left hand side are all real numbers, and the right hand side are all complex. The result of the right-hand side is about 0.20788.

But did this crack that mystery? Well, if you consider the origin of the derivation was from De Moivre’s identity, then it would just compel one to think that not only is $\frac{\pi}{2}$ a solution, but all angles co-terminal to it. $i^i$ therefore has infinitely many answers if we are to rely on De Moivre’s Theorem.

## Representing the Quartic Formula

I have used various graphics packages to hunt for a quartic formula. Over the years I had settled for a formula that is one order down, the cubic formula. For a polynomial of the form $f(x) = ax^3 + bx^2 + cx + d$, all real solutions may be obtained by the formulae:

These formulae are relatively easy to find with a math package like Maple. See how the formula is quite a lot more complex when compared with the quadratic formula.

The formula for finding all real solutions to an order 4 polynomial has been elusive, however. Maple simply gives up and doesn’t bother. There is, however, Mathematica, which can come up with a quartic formula. I have a screenshot of all four solutions to $ax^4 + bx^3 + cx^2 + dx + e=0$, two parts at a time from the Mathematica output: (to view, you need to right click on the image and select “View image” or something similar on your browser)

The second part of this is:

Thank God Neils Abel verified that there is no such formula polynomials of order 5 and above. Another blogger went to the trouble of writing all four formulae in LaTeX, and came up with:

## 9×9 Magic Squares by the Lo Shu Method

The Lo Shu method generated the only 3×3 magic square that exists (rotations and reversals of the same 3×3 arrangement notwithstanding), and was the first magic square known to be discovered by humans, over 3000 years ago in China. Because of the one magic square it yields, utilizing the Lo Shu method recursively for 9×9 can only generate exactly one 9×9 magic square. A casual glance on Google will tell you that there are many more 9×9 squares out there that break the patterns that we are about to explore.

My preference has always been to discuss algorithms for magic squares that are “high-yielding”, or lead to many distinct magic squares, such as 5×5 (14,400 squares), and 7×7 (over 25 million squares). Why spend an article discussing the one possible square generated by the Lo Shu algorithm? I think this is because this has a great many unique patterns, and there are many “little” squares, each with their own magic numbers. It is not pan-magic in the normal way, but it seems to have multiple magical properties nonetheless.

The basic Lo Shu square begins with an ordered arrangement of the digits 1-9 in a 3×3 matrix:

                 1  2  3
4  5  6
7  8  9

Switch each corner number with the number kitty-corner to it:

                9  2  7
4  5  6
3  8  1

Then, imagine pressing the 9 to go between the 4 and 2, to create a new row, and doing the same with the 1 in placing it between the 8 and the 6. The diagonal 3  5  7 becomes the middle row of the new square. It would look thus:

                4  9  2
3  5  7
8  1  6

The result is a 3×3 square that is magic, and is the only 3×3 magic square of sequential digits 1-9 that exists. Beware of reflections and rotations of these squares, since they are still the same square.

The reason for showing the construction of the 3×3 square is because constructing the 9×9 square follows a strangely identical pattern.

### The 9×9 Lo Shu square is built on the same pattern

The same principle that created the 3×3 square can be used to make a 9×9 square. The drawback is that this method will again only yield one square. In truth, there are thousands of 9×9 squares possible. You begin with the numbers 1 to 81 in sequence in a 9×9 array:

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

Let’s look at the first column. We make a 3×3 array out of this, starting by placing the numbers in numerical order in the same manner done with the numbers 1 to 9 earlier:

                         1   10   19
28   37   46
55   64   73

Then, we switch the corner numbers again:

                       73   10   55
28   37   46
19   64    1

Form new rows as described earlier, resulting in the top being 28  73  10, and the bottom being 64  1  46, with 19  37  55 being the middle row:

                       28   73   10
19   37   55
64    1   46

The result is a 3×3 sub-square that itself is magic. You can repeat this for the second column:

                       29   74   11
20   38   56
65    2   47

But then you would notice that each cell in this new 3×3 sub-square is one more than each corresponding cell in the previous 3×3 sub-square. Thus, the remaining sub-squares can be obtained by adding 1 to the previous sub-square when doing each of the columns in order from the original 9×9 square. You get the following intermediate 9×9 square:

 28 73 10 29 74 11 30 75 12 19 37 55 20 38 56 21 39 57 64 1 46 65 2 47 66 3 48 31 76 13 32 77 14 33 78 15 22 40 58 23 41 59 24 42 60 67 4 49 68 5 50 69 6 51 34 79 16 35 80 17 36 81 18 25 43 61 26 44 62 27 45 63 70 7 52 71 8 53 72 9 54

OK, so we are not quite there yet. The light grey and white patterns denote the nine 3×3 sub-squares that we were just discussing. But in the manner done for the initial 3×3 squares, we need to:

1. Switch out the corner 3×3 sub-squares, as shown below.
 36 81 18 29 74 11 34 79 16 27 45 63 20 38 56 25 43 61 72 9 54 65 2 47 70 7 52 31 76 13 32 77 14 33 78 15 22 40 58 23 41 59 24 42 60 67 4 49 68 5 50 69 6 51 30 75 12 35 80 17 28 73 10 21 39 57 26 44 62 19 37 55 66 3 48 71 8 53 64 1 46
2. Finally, make the magic square from the sub-squares going diagonally. That is, make a top row of the three sub-squares in the top left corner; then make a bottom row of the three sub-squares in the bottom right corner. The middle rows of the 9×9 square will consist of the three sub-squares extending from the bottom left to the top right. In this manner, we would have formed the magic square in the precise pattern that we used for individual numbers when we did the original 3×3 square. Below is the square, revelaling the magic number totals on the rows, columns, and diagonals:
 31 76 13 36 81 18 29 74 11 369 22 40 58 27 45 63 20 38 56 369 67 4 49 72 9 54 65 2 47 369 30 75 12 32 77 14 34 79 16 369 21 39 57 23 41 59 25 43 61 369 66 3 48 68 5 50 70 7 52 369 35 80 17 28 73 10 33 78 15 369 26 44 62 19 37 55 24 42 60 369 71 8 53 64 1 46 69 6 51 369 369 369 369 369 369 369 369 369 369 369 369

The feature of this square that intrigued me was in the way the algorithm was scalable from 3×3 to 9×9. That made it easy to learn.

## 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

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

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:

Bibliography/Resources

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: https://www.narst.org/publications/research/pck.cfm [Accessed 24 Jul. 2017].

Handal, Boris et al. (2013). “Technological Pedagogical Content Knowledge Of Secondary Mathematics Teachers – CITE Journal.” Citejournal.Org, http://www.citejournal.org/volume-13/issue-1-13/mathematics/technological-pedagogical-content-knowledge-of-secondary-mathematics-teachers/.

King, P. (2015). “Draw A Circle With Any Three Non-Collinear Points.” Youtube, 2015, https://youtu.be/ZdPQA6eSZD0.

King, P. (2017). “Grade 10 Academic – Is It Always True That 3 Noncollinear Points Make A Circle?” Youtube, 2017, https://www.youtube.com/watch?v=ZRoAbbhuwoU.

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$.

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.

ClearAll[Co];
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:

ClearAll[Co];
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).

The 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 …?