Sunday, June 27, 2021

Stewart Chapter 15: Skeins and Voids

Table of Contents

1. Introduction
2. Stewart Chapter 15: Skeins and Voids
3. Lemay Chapter 15 Part 1: Modifiers, Access Control, and Class Design
4. Conclusion

Introduction

Today I make my decision regarding which of my districts I'll continue working in. Three districts is a bit awkward, which is why I wish to keep two of those three districts.

I have chosen to keep my two Orange County districts and drop my LA County district. I will notify the district of my resignation soon.

The reason for this is simple -- the two OC districts have provided work more reliably. Recall that except for the year that I was at the old charter school, I've worked at that school ever since just after I created this blog. That was six-plus years ago, giving me a total of five-plus years in the district. But of those years, only since just before the pandemic did I get regular calls from there. Too often I had to depend on my other district for work since this one wasn't calling me.

Even though I got more calls from there in April and May, I can't help but wonder how much of that was due to teachers taking more time off due to the pandemic. Yes, the uptick in calls started slightly before the pandemic, but still, my first four years in the district stick out too much in my mind. I fear that if I drop one of the OC districts, this upcoming year will be too much like my first four years in the district, and I'd be completely dependent on my remaining district for calls. Instead, I'd rather have two districts, both of which I can count on.

Perhaps if the pandemic had never occurred (back to my COVID What Ifs again?) and the uptick in calls that started in late 2019 continued through all of 2020, I would keep working there. But instead, the pandemic has pushed me towards OC, where the schools reopened faster, and yes, where I landed a long-term position last fall.

I have served my LA County district well -- and as I wrote earlier, it's the only job which I can say that I've held for five years (although not consecutively). But the time has come for me to look towards OC for future subbing work -- provided, of course, that I continue subbing at all.

I'm still looking towards leaving education completely. Once again, the fact is that I needed to become a regular teacher, and no school was in a rush to hire me. I can't stay a sub forever, which is why I believe that I need to search elsewhere for a full-time career.

Of the two OC districts, which district calendar will the blog follow in 2021-22? I still haven't completely decided yet. While the two district calendars are similar, they aren't identical. The first day of school will be Monday, August 16th on one calendar and the next day on the other. So the holidays on the calendars are slightly different.

Moreover, unlike 2021, the two districts will have different spring breaks in 2022. With Easter falling late next year, one school will take the week before Easter (Holy Week) off, and the other district will take the week before that off (that is, spring break won't include the Easter in that district). Like 2021, I might not get much of a break in April 2022.

But that's enough about spring break. It's still summer break now, so let's return to our two summer reading books (including one that might end my education career completely).

Stewart Chapter 15: Skeins and Voids

Chapter 15 of Ian Stewart's Calculating the Cosmos is called "Skeins and Voids." As usual, each chapter begins with a quote:

"The heaven, moreover, must be a sphere, for this is the only form worthy of its essence, as it holds the first place in nature."

-- Aristotle, On the Heavens

In this chapter, Stewart asks three questions about the universe. These questions form the basis of this upcoming chapter. He begins:

"What does the universe look like? How big is it? What shape is it? We know something about the first question, and it's not what most astronomers or physicists originally expected."

The author compares the universe to the foam in a washbowl -- mostly empty space surrounding a few clumps of matter. As for the other two questions, he writes:

"We have a fair idea of how big the observable universe is, but beyond that, how can we even start to find out? The third question, shape, is even trickier."

The universe might be spherical, as Aristotle once believed in the opening quote, but it could be another shape as well. Stewart returns to what the universe looks like -- he describes open clusters of stars:

"They occur inside galaxies; about 1100 of them are known in our own Galaxy. Globular clusters are composed of hundreds of thousands of old stars in a huge fuzzy spherical ball, and they generally occur as orbiting satellites to galaxies."

By the way, our Galaxy is often referred to as the Milky Way, but Stewart calls it just the Galaxy. It is one of many galaxies that appears in the first image of the chapter -- two slices through the Sloan Digital Survey of galaxies, showing filaments and voids. Earth has been placed at the center. Each dot is a galaxy, and the radius of the circle is 2 billion light years. He describes some of these galaxies:

"The other main large galaxy in the local group is the Triangular Galaxy, which may be a satellite of Andromeda."

Still, there appear to be many clusters or superclusters of galaxies, which lots of vast empty space between them:

"Galaxies in the same general region that have similar proper motions belong to the same supercluster. The cosmos is like a fluid, with stars for atoms, galaxies for vortices, and superclusters for larger-scale structures."

The author includes his next image here. It's a computer simulation of a region 50 million light years across for one model of the distribution of visible matter in the universe. But the universe is much more massive than can be determined from visible matter only. One possibility is that there is lots of invisible dark matter, or it could be that the universe is much older than we think:

"A third is that we haven't yet hit on the right model. Size next. As astronomers probed the universe with ever more powerful telescopes, they weren't just seeing further; they were looking back in time."

This is due to the finite speed of light. Our estimate is that the radius of the observable universe is about 45.7 billion light years. Stewart moves on to the third question about the universe -- its shape. Of course, since this is a Geometry blog, we really want to focus on this question here. For centuries, it was assumed that the geometry of the universe was Euclidean, since it was believed that this is the only geometry there is:

"That belief was torpedoed in the 1800s when mathematicians discovered self-consistent non-Euclidean geometries, but although these have beautiful applications within mathematics, hardly anyone expected them to apply to the real world."

One mathematician who did try to apply non-Euclidean geometry to the real world was Gauss. Stewart retells the story we find at the start of Lesson 5-7 of the U of Chicago text -- the great mathematician tried to find the sum of the angles of a triangle with vertices on three mountain peaks. But, as the author warns us:

"Ironically, in view of what Einstein did with the mathematics that emerged from these discoveries, the gravitational attraction of the mountains interfered with his measurements."

When we say that space is non-Euclidean, we mean that space is curved. But does this mean that it must be curved around something?

"A sphere, for instance, is clearly curved around the solid ball it contains. To make a cylinder, you take a sheet of paper and bend it round in a circle, so a cylindrical surface is curved around the solid cylinder that it bounds."

But for Gauss, whether an object has curved has nothing to do with being curved around something. For example, by his definition, a cylinder is not curved, but Euclidean:

"The angles of a small triangle, for instance, add to 180 degrees, provided you measure them within the paper. A rigid but bendy protractor is ideal."

The ancients tried to determine the size and shape of our world. Compared to our planet's size, these people were no different from tiny ants:

"But they could make measurements and try to deduce the size and the topology. Unlike the ant, they did have some outside help: the Sun, Moon, and stars."

Several Italian mathematicians developed differential geometry -- the study of various surfaces and similar multidimensional shapes called manifolds:

"But they treated the ideas from a purely mathematical viewpoint. No one imagined that differential geometry might apply to real space."

That is, no one imagined it until perhaps the most famous physicist of all time -- Albert Einstein. He imagined spacetime as a possible manifold:

"The result of Einstein's heroic struggles was the Einstein field equations, relating the curvature of spacetime to the distribution of matter."

Standard manifolds are Riemannian -- as in Bernhard Riemann and the Riemann sphere. But spacetime isn't Riemannian, since the square of time needs to be negative. Stewart writes:

"One useful simplification allows me to talk, meaningfully, about the shape of space -- a Riemannian manifold -- rather than than more slippery concept, the shape of spacetime -- a pseudo-Riemannian one."

The author describes what he calls comoving frames -- the two of us may be far apart, but we're moving with the same velocity:

"Whenever I separate our space and time in this manner, I'm referring to a comoving frame. The story now takes a bizarre swerve into the realm of mythology."

Whether a geometry is Euclidean or not depends on its curvature -- zero curvature is Euclidean. But this isn't the whole story:

"The mathematical theorem states that for any fixed value of the curvature, the metric of constant-curvature spacetime is unique, so it was all too easy to assume that the geometry must also be unique. After all, doesn't the metric define the space? No."

For example, both a flat plane and a cylinder are considered to be Euclidean, even though only the plane is globally flat -- just roll the plane to make the cylinder. As it turns out, even a torus is considered Euclidean:

"Then you repeat the procedure to join the ends of the cylinder, creating a surface with the same topology as a torus."

Nonetheless, for many years, scientists ignored the other possibilities and assumed that the only possible Euclidean space is globally flat:

"So astronomers worked with this limited range of spacetimes in the mistaken belief that nothing else is possible."

Ever since Aristotle, it was believed that the universe is a sphere -- and unfortunately, not much more has been learned about the universe's shape since then:

"But there are ideas floating around that could diminish our ignorance. If not a sphere, then what? In 2003 NASA's Wilkinson Microwave Anisotropy Probe (WMAP) satellite was measuring a ubiquitous radio signal called the cosmic microwave background (CMB); its results are shown on page 249."

Sorry -- page 249 isn't until the next chapter, so we'll have to wait to see those results. The point is that it seems our universe is finite after all -- the shape of a British football or American soccer ball:

"The dodecahedron, which has 12 pentagonal faces, gets into the act because the centers of the faces of an icosahedron from a dodecahedron, so both solids have the same symmetries. 'Football' is more media-friendly, albeit technically imprecise."

Henri Poincare -- a mathematician we've discussed on the blog is past years -- discovered this manifold, which we now call Poincare dodecahedral space:

"It's positively curved and of finite extent. Jeffrey Weeks worked out the statistics of the CMB fluctuations if the universe were a dodecahedral space, and found an excellent fit to the WMAP data."

Theoretically, if the universe is finite, it would be possible to point a telescope into outer space and see the back of your head:

"It could take some time, mind you -- as long as it takes light to go all the way around the universe -- so you need to stay patient. And the head you observe might be rotated, upside down, or a mirror image of the original."

But, as the author points out, if the universe were finite, then there should be some patterns found in this CMB data:

"The fluctuations of the CMB around these two circles should be almost identical, and we can detect that using statistical correlations of the temperature fluctuations: we'd expect to see that same sequence of hot or cold patches around each circle, where 'hot' and 'cold' mean a slightly higher or lower temperature than average."

This is explained in the final image of the chapter, which shows self-intersections of the last scattering surface for a flat torus, shown here as the large circle. Other partial circles are wrapped-around copies. The torus is the shaded square with opposite edges identified, and Earth is the white dot at the center. Copies of circles meet at the black dots, which are identified in wrap-around pairs. Dotted arrows show microwaves arriving from the same region of space along two distinct directions.

But such patterns have not been detected. So Stewart speculates on the reasons for this as he closes out this chapter:

"So far it's not worked out in practice, though -- either because the universe isn't like that, or because it's too big for those special circles to occur. So what shape is the universe? We haven't a clue."

Lemay Chapter 15 Part 1: Modifiers, Access Control, and Class Design

After struggling through Chapters 13 and 14, I decided to break Chapter 15 into two parts. All of the listings (that is, actual code to type into my computer) appear in the second part, and so today's section is all about reading, cutting, pasting, and learning.

Here is the link to today's lesson:

http://101.lv/learn/Java/ch15.htm

Lesson 15 of Laura Lemay's Teach Yourself Java in 21 Days! is called "Modifiers, Access Control, and Class Design." Here's how it begins:

Here at the start of Week 3, you've probably grasped the basics of the Java language from Week 1, and you've applied them fairly often to create applets in Week 2. You can stop here, if you like, and go on your merry way, knowing enough Java to get by.

Week 3 extends what you already know. In this week you'll learn more about advanced Java concepts such as access control and packages, and you'll learn techniques for structuring large programs in an efficient object-oriented way so your code can be more easily maintained and extended or, if you so choose, easily reused by other people.

I know -- where Lemay says "Here at the start of Week 3," I think "Here at the start of Year 2" -- you know how slow I am.

We begin with modifiers:

The techniques for programming you'll learn today involve different strategies and ways of thinking about how a class is organized. But the one thing all these techniques have in common is that they all use special modifier keywords in the Java language.

In Week 1 you learned how to define classes, methods, and variables in Java. Modifiers are keywords you add to those definitions to change their meaning. Classes, methods, and variables with modifiers are still classes, methods, and variables, but the modifiers change their behavior or how Java treats those elements.

Modifiers are special language keywords that modify the definition (and the behavior) of a class, method, or variable.

OK, I recognize some (though not all) of these modifiers from my previous experience coding in C++, so at least I know a little about these.

The most important modifiers in the language, from the standpoint of class and object design, are those that allow you to control the visibility of, and access to, variables and methods inside your classes.

OK, I understand this.

Why would you care about controlling access to methods and variables inside your classes? If you remember way back to the beginning of this book, I used the analogy of the pc-how you can buy different pc components and put them all together so that they interact to create a larger system.

Each component in that pc system works in a particular way and has a specific way of interacting with the other components in the system. For example, a video card plugs into your motherboard using a standard socket and plug arrangement, as does your monitor to the back of the card. And then your computer can talk the right software language through the card to get bits up on the screen.

The video card itself has a whole lot of other internal features and capabilities beyond this basic hardware and software interface. But as a user or consumer of the card, I don't need to know what every single chip does, nor do I need to touch them in order to get the card to work. Given the standard interfaces, the card figures everything out and does what it needs to do internally. And, in fact, the manufacturer of the card most likely doesn't want me to go in and start mucking with individual chips or capabilities of the card, because I'm likely to screw something up. It's best if I just stick to the defined interface and let the internal workings stay hidden.

Classes and objects are the same way. While a class may define lots of methods and variables, not all of them are useful to a consumer of that class, and some may even be harmful if they're not used in the way they were intended to be used.

In fact, the most common metaphor used here is "the black box." Thus the inside of Lemay's TV set or monitor is a black box -- she doesn't need to know how it works in order to use it.

The Java language provides four levels of protection for methods and instance variables: publicprivateprotected, and package (actually, the latter isn't an explicit form of Java protection, but I've included it here because it's nicely alliterative). Before applying protection levels to your own code, you should know what each form means and understand the fundamental relationships that a method or variable within a class can have to the other classes in the system.

OK, I've seen most of these before.

The first form of protection we'll talk about is the one you've been unconsciously using all this time: what's called package protection. In C, there's the notion of hiding a name so that only the functions within a given source file can see it. Java doesn't have this kind of control; names will be happily found in other source files as long as Java knows where to find them. Instead of file-level protection, Java has the concept of packages, which, as you learned on Day 2, "Object-Oriented Programming and Java," and will learn a whole lot more about tomorrow, are a group of classes related by purpose or function.

OK, as Lemay tells us here, we've been using "packages" all along here, and "packages" have no close analog in C (or C++). She says that we'll learn more about packages "tomorrow" -- which, of course, doesn't really mean tomorrow to me.

From the default protection you get with package protection, you can either become more restrictive or more loose in how you control the visibility and access to your methods and variables. The most restrictive form of protection is private, which limits the visibility of methods and instance variables to the class in which they're defined. A private instance variable, for example, can be used by methods inside the same class, but cannot be seen or used by any other class or object. Private methods, analogously, can be called by other methods inside that same class, but not by any other classes. In addition, neither private variables nor private methods are inherited by subclasses.

Private protection means that your methods and variables are accessible only to other methods in the same class.

OK, so private works more or less the same as in C++.

The diametric opposite of private protection, and the least restrictive form of protection, is public. A method or variable that is declared with the public modifier is accessible to the class in which it's defined, all the subclasses of that class, all the classes in the package, and any other classes outside that package, anywhere in the entire universe of Java classes.

Public protection means that your methods and variables are accessible to other methods anywhere inside or outside the current class or package.

OK, so public works more or less the same as in C++.

The final form of protection available in Java concerns the relationship between a class and its present and future subclasses declared inside or outside a package.

Protected protection means that your methods and variables are accessible to all classes inside the package, but only to subclasses outside the package.

Hmm --the author includes a warning here:

In C++, the protected modifier means that only subclasses can access a method or variable, period. Java's meaning of protected is slightly different, also allowing any class inside the package to access those methods and variables.

This is a bit confusing to me. I'm glad that Lemay includes a chart here. I won't repeat the chart here -- you can get it directly from the Lemay link above.

Setting up protections in new classes with new methods is easy; you make your decisions based on your design and apply the right modifiers. When you create subclasses and override other methods, however, you have to take into account the protection of the original method.

The general rule in Java is that you cannot override a method and make the new method more private than the original method (you can, however, make it more public).

OK, and once again, there's a list to keep track of what we can and can't do.

A good rule of thumb in object-oriented programming is that unless an instance variable is constant it should almost certainly be private. But, I hear you say, if instance variables are private, how can they be changed from outside the class? They can't. That's precisely the point. Instead, if you create special methods that indirectly read or change the value of that instance variable, you can much better control the interface of your classes and how those classes behave. You'll learn about how to do this later in this section.

Don't worry -- the same is true in C++. What we'll learn to do is create public accessor methods in order to access the variable. Thus methods (functions) should be public, but variables (integers, strings) should remain private.

This is approximately the midpoint of the chapter, so we'll resume this lesson in my next post.

Conclusion

Today was the semifinal round of the Scripps National Spelling Bee. It is different from previous Bees, due to both the pandemic and the unprecedented eight-way tie at the last pre-pandemic bee in 2019.

This year, the semifinals are held over Zoom in the individual spellers' homes. The last eleven spellers advance to the finals -- not in DC, in Orlando, FL (just like the NBA playoffs in the bubble). And in order to avoid multiway ties, there are also rounds where the participants are given a word and they must choose the definition among three choices in 30 seconds. In one round, a whopping five spellers were eliminated due to giving the wrong definition. Oh, and the spellers' hands must be visible (so that they can't hide a dictionary or anything like that).

Since I'm from California, I always root for spellers from my state. One Californian correctly spelled Fabian and punched her ticket to Orlando, but one boy stumbled on scabious (the name of a plant and hence a noun, yet it's spelled like an adjective).

Texas, as usual (due to a Dallas spelling club), leads the way with four finalists. One of those Texans is a ten-year old girl (most finalists are in middle school). Also, one finalist is from the Bahamas -- the first native of his country to advance.

I usually watch the film Akeelah and the Bee on the night of the annual spelling bee. I will probably watch the movie on July 8th, the night of the final round.

No comments:

Post a Comment