Friday, May 22, 2020

Lemay Lesson 4: Working with Objects

Table of Contents

1. Introduction
2. Mbira: Another Musical Google Doodle
3. Memorial Day on the Calendar
4. Lesson 4 -- Working with Objects
5. Another Rapoport Math Problem
6. Reblogging: SBAC Prep
7. More on Java and Geometry
8. More on the AP and SAT Exams
9. More on the Future of Education
10. Conclusion

Introduction

Today is the Friday before Memorial Day. In my old district, there would have been a four-day weekend for Memorial Day, with no school today.

Why is there an extra holiday today? It's a "floating day" that's there only when needed to make the last week of school have three days for finals (Days 178, 179, 180). It all depends on the exact lengths of winter and spring breaks, which in turn depend on which day of the week Christmas falls and how close Easter is to the designated spring break week (the fourth week of March).

Last year, it was a four-day weekend for Memorial Day. But the year before that, it was a three-day holiday weekend. And so if schools had been open, today would have been a non-posting day. I've done it often since the start of the closure -- post on days that I normally wouldn't.

Meanwhile, on the Islamic Calendar, today is the new moon at the end of Ramadan. The new moon occurred late this morning (Pacific time zone) and thus after sunset in the Middle East. As expected, the waxing crescent was not visible in those time zones, and so there is still at least one day left of fasting for Muslims.

Mbira: Another Musical Google Doodle

Yesterday, yet another musical Google Doodle appeared -- the mbira, a Zimbabwean thumb piano. As with previous interactive Doodles, this one is featured for two days, yesterday and today. I'm posting a little information about this doodle -- and I'm submitting this post a few hours earlier than usual, so that you'll have the opportunity to try this on the Doodle before it disappears.

The mbira contains 14 notes, which can be played using 14 keys on our computer keyboard. Here's a correspondence between the computer keys and musical notes:

Home Row = Treble Notes
Key   Note
S        g'
D       eb'
F        f'
G       bb
H       d'
J        bb'
K      c"
L       d"
;        eb"

Lower Row = Bass Notes
Key   Note
Z       g
X       f
C       eb
V       d
B       Bb

Here they are again, arranged from low to high:

Key   Note
B       Bb
V       d
C       eb
X       f
Z       g
G       bb
H       d'
D       eb'
F        f'
S        g'
J        bb'
K      c"
L       d"
;        eb"

As with strings, longer mbira keys sound as lower notes and shorter keys sound as higher notes. But there's a slight inconsistency on Google -- the F key sounds higher than the D key despite being shown as a longer key. I find this annoying when I press the keys S-D-F -- the F key is musically between the other two keys, despite sitting to the right of them.

The F key is the only key whose letter matches its musical note as it sounds as an f'. That is, unless you count the B key, which sounds as a German B (or Bb).

It's also possible to play the mbira using the mouse, but I prefer the keyboard since this allows us to play two notes at the same time (that is, harmony). This is better than the theremin, where only one note can be played at a time (melody).

As we look at the available notes, we see that both B and E have flats, suggesting Bb major, except that the seventh (A) is missing. We might also think of it as Eb major without the fourth (Ab). In addition, we see that the note C is available only in the highest octave (as c"). Thus in the lower octaves, Bb lacks the second (in addition to the seventh), and Eb lacks the sixth (and the fourth).

If we look at minor scales rather than major, then this is C minor without the sixth. This is what I've called the Kristen Lawrence Halloween scale, since many of her songs use this scale. But we can't really play any of those minor songs here -- the lack of C in the lower octaves makes it awkward to play any C minor songs. A more playable minor scale is G minor (no second, limited fourth).

Among triads, Bb major, Eb major, and G minor are all playable. C minor is playable only if we consider inversions (where C isn't the root note).

Here is a song that I created using a random number generator. At first I wanted to use the digit 0 to represent a rest and 1-9 to represent the keys S to ; on the home row. But then I chose 0 first (which would start the song with a rest), and there were a few points where the song kept jumping between the middle and high octaves. I changed these so that there's no rest at the start and there is only one octave jump:

Musical Notes: c" bb' c" bb' f' d' g' g' eb' d' g'_ c" bb' c" bb' f' f' eb' d' d" d" bb'_
Keyboard Key: K J    K  J    F H S S  D  H S_  K J    K  J    F F D  H L  L   J_
Running Bass:  B                 B            C             B                 X            B

This song is considered to be in the key of Bb major. (Note: Since I wanted to use 0 for rest and 1-9 for notes, we might try converting the digits of pi or another constant into this scale.)

As for songs that I performed in class that are convertible to this scale, "Benchmark Tests" works. I originally wrote this song in C major with no seventh -- but after I sang it a few times, I ended up dropping the fourth as well. (Once again, I can make up random notes all I want -- a song isn't musical until it sounds right, and in this case, dropping the fourth sounded right.)

Since the new version has no fourth, I can play it in Eb major on the mbira. The scale that my song is in is, in fact, the pentatonic scale. But the five playable notes (excluding C) on the mbira do not form a pentatonic scale since it contains the seventh instead of the sixth. Fortunately, by playing the song in Eb major, the single playable C note (the sixth) is in just the right place for the song:

The Benchmark Tests Song
Musical Notes: eb' f' eb' f' eb' eb' eb'_ eb' f' g' f' eb' f' eb'_ f' c" eb" c" bb' bb' bb'_
Keyboard Key: D  F D   F D  D   D_   D  F S F D   F D_  F K  ;     K J    J     J_
Running Bass:  C               C                C            C             X               B

Each verse contains eight bars -- the six listed bars plus the last two repeated. I always end the song by repeating the first two bars.

Memorial Day on the Calendar

Memorial Day was originally known as Decoration Day. It was created to mark the end of the Civil War and commemorate the soldiers who lost their lives during the war. Its traditional date was May 30th, but now it falls on the last Monday in May. And of course, instead of remembering soldiers, many people treat it as the unofficial start of summer instead.

Notice that "Friday before Memorial Day" and "fourth Friday of May" are equivalent -- both refer to the Friday between May 22nd and 28th. And filmmakers would take full advantage of this -- the summer movie season ought to start on Memorial Day weekend (the fourth Friday in May), but in order to get a jump on the competition, some blockbusters would open earlier. The start of summer movie season gradually became the third Friday in May, and then the first Friday in May.

Last year, Aladdin opened on Memorial Day weekend, John Wick III opened on the third Friday in May, Pokemon opened on the second Friday, and Avengers couldn't even wait for the first Friday in May, instead leaping ahead to the last Friday in April (Arbor Day)! Of course, that was last year -- due to the virus, no blockbusters are opening this May.

One thing I've noticed about Memorial Day and Thanksgiving is that they're the two federal holidays that are closest to being directly opposite each other -- this year, Memorial Day is May 25th, while Thanksgiving will be November 26th. (New Year's Day and Fourth of July are the only other federal holidays that are nearly antipodal.)

And in fact, Thanksgiving has become the unofficial start of the winter (or holiday) season in the way that Memorial Day has become the unofficial start of summer. Both are associated with big meals (Memorial Day on the grill, Thanksgiving in the oven). And of course, the film studios have crept the holiday movie season up from Thanksgiving weekend to the first Friday in November, so that there are usually four weekends of blockbusters in that month as well.

On the school calendar, it's possible to have Memorial Day on the Early Start Calendar serve the same purpose that Labor Day does on the old calendar -- just as school shouldn't start before Labor Day on the old calendar, it shouldn't end past Memorial Day on the new calendar. There are about 90 school days between winter break and Memorial Day, so it's possible to have 90 days of school in first semester, let winter break divide the semesters, and finish before Memorial Day. But in practice, most schools don't have Day 1 early enough in August to have either Day 90 by Christmas or Day 180 by Memorial Day.

I've read that businesses that seek to hire students for summer jobs would prefer it if schools were closed through both Memorial and Labor Day. But it's impossible to squeeze in 180 days of school between Labor and Memorial Day (unless we forego winter and spring breaks, etc.). It might be possible to have a 160-day school year with 70 days in the first semester and 90 in the second. But many people believe that our 180-day school year is already too short relative to other countries, and would be opposed to an even shorter year, even if it benefits students looking for summer jobs.

Theoretically, colleges that work on a 4-1-4 plan (first semester from September-December, winter term in January, second semester from February-May) could start after Labor Day and end by Memorial Day. But in practice, the California State Universities here on the 4-1-4 plan still seem to start a week or two before Labor Day, putting college students looking for summer jobs (whose bosses want employees to work through Labor Day) at a disadvantage.

Once again, what I'm saying here applies to normal years. This year is anything but normal.

Lesson 4 -- Working with Objects

Since I waited so long to post, I wish to speed this up a little. So I will attempt to do all of Lesson 4 today rather than split it up into Part 1 and Part 2 as I did with Lessons 2-3.

Lesson 4 of Laura Lemay's Teach Yourself Java in 21 Days! is called "Working with Objects." Here's how this chapter begins:

Let's start today's lesson with an obvious statement: Because Java is an object-oriented language, you're going to be dealing with a lot of objects. You'll create them, modify them, move them around, change their variables, call their methods, combine them with other objects-and, of course, develop classes and use your own objects in the mix.

As usual, I'll compare Java to the object-oriented language I already know, C++. First, we notice that there are differences between strings and other objects:

The String class is unusual in that respect-although it's a class, there's an easy way to create instances of that class using a literal. The other classes don't have that shortcut; to create instances of those classes you have to do so explicitly by using the new operator.

And that's our first difference between C++ and Java. In C++, new is only used when we wish to create an object on the "free store" (a special area of memory), but in Java, we must use it to call the constructor and create any object (other than a string).

Our first listing involves Date objects, which are built into a Java package that we can import:


Listing 4.1. Laura's Date program.
 1: import java.util.Date;
 2: 
 3: class CreateDates {
 4: 
 5:     public static void main(String args[]) {
 6:         Date d1, d2, d3;
 7: 
 8:         d1 = new Date();
 9:         System.out.println("Date 1: " + d1);
10: 
11:         d2 = new Date(71, 7, 1, 7, 30);
12:         System.out.println("Date 2: " + d2);
13: 
14:         d3 = new Date("April 3 1993 3:24 PM");
15:         System.out.println("Date 3: " + d3);
16:     }
17: }
(Of course, "Laura" here refers to Laura Lemay, our author.)

My output matches Lemay's, except that Line 9 gives today's date:

The second Date object you create in this example has five integer arguments. The arguments represent a date: year, month, day, hours, and minutes. And, as the output shows, this creates a Date object for that particular date: Sunday, August 1, 1971, at 7:30 a.m.

And yes -- the argument 71 means 1971. Thus Java isn't Y2K compliant -- changing this to 20 means 1920 and not 2020. Meanwhile, as the author tells us, the months start from 0, so 7 is August. I know that this is true in C++ as well -- the months start from 0, yet the days start from 1. And so day 1 really means the 1st, not the 2nd.

The next concept is dot notation:

To get to the value of an instance variable, you use an expression in what's called dot notation. With dot notation, the reference to an instance or class variable has two parts: the object on the left side of the dot and the variable on the right side of the dot.

This listing uses dot notation to access a Point class and its variables, the x- and y-coordinates:


Listing 4.2. The TestPoint Class.
 1: import java.awt.Point;
 2: 
 3: class TestPoint {
 4: public static void main(String args[]) {
 5:     Point thePoint = new Point(10,10);
 6:
 7:     System.out.println("X is " + thePoint.x);
 8:     System.out.println("Y is " + thePoint.y);
 9:
10:     System.out.println("Setting X to 5.");
11:     thePoint.x = 5;
12:     System.out.println("Setting Y to 15.");
13:     thePoint.y = 15;
14:
15:     System.out.println("X is " + thePoint.x);
16:     System.out.println("Y is " + thePoint.y);
17:
18:  }
19:}

The dot notation is also used to call class methods as well as variables.

This listing uses dot notation to access the string class and its methods:

Listing 4.3. Several uses of String methods.
 1: class TestString {
 2: 
 3:     public static void main(String args[]) {
 4:         String str = "Now is the winter of our discontent";
 5: 
 6:         System.out.println("The string is: " + str);
 7:         System.out.println("Length of this string: "
 8:                 + str.length());
 9:         System.out.println("The character at position 5: "
10:                 + str.charAt(5));
11:         System.out.println("The substring from 11 to 17: "
12:                 + str.substring(11, 17));
13:         System.out.println("The index of the character d: "
14:                 + str.indexOf('d'));
15:         System.out.print("The index of the beginning of the ");
16:         System.out.println("substring \"winter\": "
17:                 + str.indexOf("winter"));
18:         System.out.println("The string in upper case: "
19:                 + str.toUpperCase());
20:     }

I wish to compare Java's string class to BASIC, another language known for its strings. Of course, both languages have a length method, which BASIC calls LEN. Instead of "substrings," BASIC calls these "midstrings." These substrings are indexed starting with 1 rather than 0, and the length is specified rather than the end position, so str.substring(11, 17) would become written as MID$(S$,12,7) in BASIC. On the other hand, the only way to use charAt in BASIC would be to write MID$(S$,6,1), and indexOf has no equivalent in BASIC.

As a math teacher, I find Java's Math class useful:

Class methods can also be useful for gathering general methods together in one place (the class). For example, the Math class, defined in the java.lang package, contains a large set of mathematical operations as class methods-there are no instances of the class Math, but you can still use its methods with numeric or boolean arguments. For example, the class method Math.max() takes two arguments and returns the larger of the two. You don't need to create a new instance of Math; just call the method anywhere you need it, like this:
int biggerOne = Math.max(x, y);
(The author leaves out the t in int, so I just filled it in here.) In order to use this, we must write:

import java.lang.Math;

This is what the author means when she tells us that Math is in the package java.lang.

We now move on to references:

As you work with objects, one important thing going on behind the scenes is the use of references to those objects. When you assign objects to variables, or pass objects as arguments to methods, you are passing references to those objects, not the objects themselves or copies of those objects.

And references are shown in the next listing:


Listing 4.4. A references example.
 1: import java.awt.Point;
 2:
 3: class ReferencesTest {
 4:     public static void main (String args[]) {
 5:        Point pt1, pt2;
 6:         pt1 = new Point(100, 100);
 7:         pt2 = pt1;
 8: 
 9:         pt1.x = 200;
10:         pt1.y = 200;
11:         System.out.println("Point1: " + pt1.x + ", " + pt1.y);
12:         System.out.println("Point2: " + pt2.x + ", " + pt2.y);
13:     }
14: }
Here we see that when we change pt1, it changes pt2 as well, since these are the same object. In C++, references exist, but it all depends on how the function or constructor is written, and the symbol & must be used. In Java, these are automatically references without any need for an ampersand.

And closely related to references in C++ are pointers. Lemay explains:

There are no explicit pointers or pointer arithmetic in Java as there are in C-like languages-just references. However, with these references, and with Java arrays, you have most of the capabilities that you have with pointers without the confusion and lurking bugs that explicit pointers can create.

OK, I admit that I find the section on converting to objects confusing. For some reason, we must distinguish between int vs. Integer, and boolean vs. Boolean. Apparently, one of them in each pair is a primitive (primordial) type while the other is a class. The class is needed because we can only convert from primitive to primitive and class to class. (And I'm completely confused as to why the Void class is needed.) Hopefully, this will be explained in more detail as I proceed through this text.

In the final listing, we learn the difference between == and String.equals:


Listing 4.5. A test of string equality.
 1: class EqualsTest {
 2: public static void main(String args[]) {
 3:         String str1, str2;
 4:         str1 = "she sells sea shells by the sea shore.";
 5:         str2 = str1;
 6:  
 7:        System.out.println("String1: " + str1);
 8:         System.out.println("String2: " + str2);
 9:         System.out.println("Same object? " + (str1 == str2));
10:  
11:        str2 = new String(str1);
12:  
13:        System.out.println("String1: " + str1);
14:         System.out.println("String2: " + str2);
15:         System.out.println("Same object? " + (str1 == str2));
16:         System.out.println("Same value? " + str1.equals(str2));
17:     }
18:  }
The first time, str1 and str2 are references to the same object, so we get true, but after we used new the second time, they are the different objects (==) but with the same value (equals). In BASIC, = for strings tests only for the same value.

In Lemay's Q & A, one of her questions refers to C++:


Q:
No operator overloading in Java? Why not? I thought Java was based on C++, and C++ has operator overloading.
A:
Java was indeed based on C++, but it was also designed to be simple, so many of C++'s features have been removed. The argument against operator overloading is that because the operator can be defined to mean anything; it makes it very difficult to figure out what any given operator is doing at any one time. This can result in entirely unreadable code. When you use a method, you know it can mean many things to many classes, but when you use an operator you would like to know that it always means the same thing. Given the potential for abuse, the designers of Java felt it was one of the C++ features that was best left out.

Another Rapoport Math Problem

Today on her Daily Epsilon of Math 2020, Rebecca Rapoport writes:

(The number of magic squares of order 4)/40

No, this isn't a Geometry problem -- its reference to "squares" doesn't make it Geometry. A magic square of order n is a configuration of natural numbers from 1 to n^2 such that the sums of every row, column, and diagonal are equal. Here is an example of a magic square of order 3:

276
951
438

The sum of each row, column, and diagonal is 15. But now we are asked to count how many magic squares there are, which is easy in the order-3 case. There are other order-3 magic squares:

438
951
276

492
357
816

But notice that in case, a simple isometry maps the original square to the new one (a reflection in the first case and a rotation in the second). If we consider two magic squares to be identical if there exists an isometry mapping one to the other, then there is only one order-3 magic square.

 Of course, the order-4 case is much more complicated. There exist many magic squares that are distinct in that no isometry maps one to the other. All of them have the same magic number, 34.

As it turns out, it's impossible to calculate it exactly. It seems as if there ought to be an elegant method, such as "there are 16 possibilities for the first number, 15, for the second number, and 14 for the third number -- then there's only one possible number for the fourth number so that the entire row adds up to 34," and so on.

But there isn't such a method. The only reason we know how many magic squares there are is that over the centuries, some mathematicians counted them one-by-one:

http://www.magic-squares.net/order4list.htm

There are 880 basic magic squares of order-4. The complete set was compiled by Bernard Frénicle de Bessy before 1675. [1][2]
This list has been recalculated and verified by many people since that time (myself included).

These 880 magic squares were classified into 12 groups by H. E. Dudeney and first published in The Queen, Jan. 15, 1910. The classification diagrams appeared later in Amusements in Mathematics, 1917, published by Thomas Nelson & Sons, Ltd.

Here are some of the magic squares from this list:

Magic Square #692
  4  9  813
10  714  3
15  211  6
  516  112

Magic Square #576
  4  11316
1415  3  2
1110  6  7
  5  812  9

Magic Square #335
  2  9  716
1514  4  1
  6  31312
11  810  5

The above website contains links that list all 880 of them. And thus this is a pure research question from the Rapoport calendar. Either we know how many magic squares there are or we don't.

And so to answer today's question, the number of magic squares of order 4 is 880, so we obtain:

(The number of magic squares of order 4)/40 = 880/40 = 22

Therefore the desired answer is 22 -- and of course, today's date is the 22nd. There are several Numberphile videos on magic squares, although none of them give 880 as the number of order-4 magic squares there are. One of them is on a the Parker Square, a semimagic square that's almost magic except one of the diagonals doesn't sum to the magic number. (In the YouTube comments, there's a running joke where a "Parker" something is something that almost works, but doesn't.)

Reblogging: SBAC Prep

Last year, May 22nd was a Wednesday, but I didn't sub that day, nor did I post much. All I wrote last year was SBAC Prep, which I will reblog here:

Question 23 of the SBAC Practice Exam is on comparing rates:

Nina has some money saved for a vacation she has planned.

  • The vacation will cost a total of $1600.
  • She will put $150 every week into her account to help pay for the vacation.
  • She will have enough money for the vacation in 8 weeks.

If Nina was able to save $200 a week instead of $150 a week, how many fewer weeks would it take her to save enough money for the vacation? Enter the result in the response box.

First of all, let's ignore the given value $1600 completely, since it has nothing to do with the solution of this problem. What we want to know is, how long will it take Nina to save the same amount of money at $200/wk. as she does at $150/wk. for eight weeks? Thus this is the equation:

200w = 150(8)
200w = 1200
w = 6

So it takes her six weeks to save the money as opposed to eight weeks. Therefore it will take her two fewer weeks (that is, 8 - 6) to save the money -- students should enter the number 2.

Sometimes students might forget that even though w = 6, they must enter the number 2, since the question is not how many weeks will she save, but how many fewer weeks. Sometimes I avoid this problem by letting x = 8 - w, so that as soon as I find x, I have the number I need to enter:

200(8 - x) = 150(8)
1600 - 200x = 1200
-200x = -400
x = 2

I often solve Pappas problems this way -- using the variable x only for the final value that I need to find rather than any intermediate values. Also, if there's a system of equation and Pappas asks us to solve for x, I might eliminate y even if x is easier to eliminate, so that I find the actual asked-for value more directly.

Both the girl and the guy from the Pre-Calc class have trouble with this question. In fact, the guy has only written:

150x = 1600

on his paper, with no final answer. The girl, on the other hand, has written a little more:

1600 = 150w
150(8) = 1600
200

and then she gives 6 weeks as her final answer. Yes, it does take Nina six weeks to save the money -- but that answer isn't justified by anything on the girl's paper. Actually, I'm starting to wonder whether I've attempted to help her during class, perhaps by telling either her only or the entire class that it takes eight weeks to save the money at the slower rate or six weeks at the faster rate. So she tries to include the numbers 8 and 6 somewhere on her paper.

Once again, I wonder whether there's anything to do to make this question easier for the students to understand and answer correctly. Earlier, I wrote that 1600 has nothing to do with the solution -- so let's restate the problem with the 1600 line left out:

Nina has some money saved for a vacation she has planned.

  • She will put $150 every week into her account to help pay for the vacation.
  • She will have enough money for the vacation in 8 weeks.

If Nina was able to save $200 a week instead of $150 a week, how many fewer weeks would it take her to save enough money for the vacation? Enter the result in the response box.

Now look at those first two lines again. The lady will save $150 per week for eight weeks -- that is, she will save a total of $1200. The problem is less confusing because we now know that the target amount is $1200, not $1600. No student would write an equation with 1600 at all, and so more students are likely to get the right answer.

But what is a teacher to do, since we can't make that 1600 line disappear from the computer we're using to administer the SBAC? Well, we can ask the students to look for extraneous information -- for example, we read the following to them out loud:

Nina has some money saved for a vacation she has planned.


  • The vacation will cost a total of $1600.
  • She will put $150 every week into her account to help pay for the vacation.
  • She will have enough money for the vacation in 8 weeks.

Question for the class: how much money will she have saved in eight weeks?

The hope is that that point, the students see that 150 * 8 = 1200, so it's $1200. At this point, the teacher tells the students that so far, 1600 has nothing to do with the problem. The phrase "enough money for the vacation" is another way of saying $1200. This is not the same as the total cost of the vacation, $1600, since presumably Nina already has $400 in the bank before saving begins.

If Nina was able to save $200 a week instead of $150 a week, how many fewer weeks would it take her to save enough money for the vacation?

And since the phrase "enough money for the vacation" is another way of saying $1200, we can rewrite the question as:

If Nina was able to save $200 a week instead of $150 a week, how many fewer weeks would it take her to save $1200?

And now it becomes obvious that at $200 a week, it takes six weeks to save $1200. It now remains for the teacher only to emphasize fewer -- it's not how many weeks, but how many fewer weeks (than eight) it takes for her to earn the money. Therefore we must subtract 8 - 6 = 2.

Some people criticize the Common Core over wording in questions such as these. Indeed, yesterday and today we have two consecutive Questions 22-23 with the phrases "average rate of change" and "enough money for the vacation" -- and both are likely to trip students up.

But I'm not sure how this question can be improved. We might really be in a situation where we want to save money for a trip, but already have money in the account. Thus we must realize to consider that we already have some money, and so it's the remainder that we need to save.

Question 24 of the SBAC Practice Exam is on quadrilaterals:

Consider parallelogram ABCD with point X at the intersection of diagonal segments AC and BD.

Evelyn claims that ABCD is a square. Select all the statements that must be true for Evelyn's claim to be true.

  • AB = BD
  • AD = AB
  • AC = BX
  • Angle ABC isn't 90
  • Angle AXB = 90

Here's some Geometry -- yes, it's been some time since I posted Geometry on this Geometry blog. I'll look at the three length equations first. AD = AB is obviously true, since the sides of a square must indeed be congruent. On the other hand, AB = BD is definitely false -- the diagonal of a square is sqrt(2) times the length of a side, not the same length as a side. And AC = BX is false as well -- the diagonals of a square (or any rectangle) are congruent, and so AC can't be half of BD (which is what BX is, as the diagonals of a parallelogram bisect each other).

Now let's look at the angle statements. The statement that ABC isn't 90 is obviously false -- the angles of a square must be exactly 90. The other statement that AXB = 90 is true, since the diagonals of a square are also perpendicular. So students must select two correct answers, AB = AD and AXB = 90.

Notice that if all Evelyn knew about her parallelogram is AB = AD and AXB = 90, that would not be sufficient for her to conclude that it's a square. A rhombus, after all, also has congruent sides and perpendicular diagonals. (In fact, given that ABCD is a parallelogram, just one of these two is sufficient for her to conclude that ABCD is a rhombus.) On the other hand, adding the falsity of the claim that ABC isn't 90 (that is, the truth that ABC = 90) to either of the two selected statements is enough for Evelyn to conclude that ABCD is a square.

Both the girl and the guy from the Pre-Calc class correctly answer this question.

More on Java and Geometry

Speaking of Geometry, let me now use Java to solve some Geometry problems. Once again, anyone can cut-and-paste Lemay code into the Java compiler -- that doesn't make me a coder. I'm not a coder until I can create my own Java code.

So far, what I've learned in Java is very limited. But in today's lesson, Lemay gives a Point class, so why don't we use that class to do some simple coordinate Geometry?

In Chapter 11 of the U of Chicago text, we learn about three things we can do with points involving their coordinates:

  • Slope Formula
  • Midpoint Formula
  • Distance Formula
Let's try the Slope Formula first. The Slope Formula involves division, but Lemay never explains whether the member variables of Point are of type int or float, and so I don't know whether we'll see integer or decimal division when we write our slope program. In either case, it won't be fractional division, so don't expect to see a slope of 1/3 or anything like that.

Well, there's only one way to find out whether Point uses int or float -- just write out the code and see what happens.


import java.awt.Point;

public class PointyThings {
public static void main(String args[]) {
Point pt1 = new Point(10,10);
Point pt2 = new Point(5,15);
float slope = ((pt2.y - pt1.y)/(pt2.x - pt1.x));
System.out.println("The slope is " + slope);
}
}

Output:
The slope is -1.0

OK, so that works.

Let's try the Midpoint Formula now. Notice that the midpoint of two points is another point, so we should create a new Point object that contains the midpoint.

import java.awt.Point;

public class PointyThings {
public static void main(String args[]) {
Point pt1 = new Point(10,10);
Point pt2 = new Point(5,15);
float slope = ((pt2.y - pt1.y)/(pt2.x - pt1.x));
System.out.println("The slope is " + slope);
Point midpt = new Point((pt1.x + pt2.x)/2,(pt1.y +                      pt2.y)/2);
System.out.println("The midpoint is " + midpt);
}

}

Output:
The slope is -1.0
The midpoint is java.awt.Point[x=7,y=12]

The program compiles and there are no errors, but there are two things wrong here. First of all, we asked the compiler to println the point directly, but we can't do that -- instead, we see the Java notation for the point. (Lemay never prints points directly -- she only prints out both coordinates one at a time.)

I could fix it were it not for the second problem -- the coordinates are indeed both int. The true midpoint should actually be (7.5, 12.5), but we must use int division, which truncates down to the next integer.

Let's just forget about midpoint and see whether we can do the Distance Formula. We know that this requires a square root function. Lemay never explains how to do square roots, but they definitely sound like something that might be in the Math class. So let's import that class and try it out:

import java.awt.Point;
import java.lang.Math;

public class PointyThings {
public static void main(String args[]) {
Point pt1 = new Point(10,10);
Point pt2 = new Point(5,15);
float slope = ((pt2.y - pt1.y)/(pt2.x - pt1.x));
System.out.println("The slope is " + slope);
double dist = Math.sqrt((pt2.x - pt1.x)*(pt2.x -                        pt1.x) + (pt2.y - pt1.y)*(pt2.y - pt1.y));
System.out.println("The distance is " + dist);
}
}

Output:
The slope is -1.0
The distance is 7.0710678118654755

And yes, this works. I did notice that in order to use the Math.sqrt method, I must use double, not floatAlso, it's cumbersome to write out what I'm multiplying twice. I wonder whether the class Math contains some sort of squaring or power method.

Well, two out of three isn't bad. I'm not sure what to do about midpoint, though.

Of course, a real programmer wouldn't write the code like this. Most likely, we'd create separate methods to calculate the slope and distance, but I don't know how to do that yet.

More on the AP and SAT Exams

Today is the last day of the AP exams. And they continue to be fraught with problems whenever students try to submit them.

This week, the AP allowed students to submit their work by email. This helped out the students with second week exams, but it's too late for those with first week exams -- and recall that the first week included most subjects that we probably care about on the blog. In particular, Calculus, the hard sciences (Chemistry and Physics), and Computer Science A all tested the first week. Only Statistics has its test today.

And I can only imagine what it's like to be a young student taking the AP exams these two weeks. In my senior year, I took Calculus BC, English Literature, Physics C (both Mechanics and Electricity & Magnetism), and Government (both US and Comparative). Of those six exams, only Comparative Government is today -- the others all tested in the first three days, when it was hard to submit to AP.

Recall that my five-year-old computer had trouble downloading Java earlier this month. Thus I would likely have struggled to submit the tests during the first week.

In fact, some students are now suing the College Board over the AP submission problems:

https://edsource.org/2020/california-students-sue-college-board-after-being-unable-to-submit-ap-exams

(One commenter in that thread also mentioned the problems with time zones -- all students around the world had to take the test simultaneously due for security reasons. I'm not sure what the AP could have done about this -- no matter what time on the clock they chose, it would have been in the middle of the night for someone in the world.)

And even without the computer submission problems, my first day would have been brutal -- both Physics C exams and US Government tested on that first Monday. Yes, I know that the tests are only 45 minutes each this year, but still, three AP exams in one day is tough.

I'm not sure what the AP should have done with the exams this year. Some people believe that the AP's, just like the SAT and SBAC, should have been cancelled. This is especially true for those who believe that standardized tests only benefit the testing companies and not students or teachers.

But then again, I'm grateful that I had taken my AP tests. Due to all of my credit, I was able to begin at UCLA with sophomore status, and I used my fourth year to begin a master's degree in math. If the AP's had been cancelled my senior year, I likely never get my MA degree because I wouldn't have been able to afford it.

And so I'm not quite sure what could have been done better here. The coronavirus crisis has caught everyone by surprise this year, and it's certainly been just as difficult on the test makers as it is on the test takers.

Oh, and speaking of exams, it's official -- the SAT will no longer be required for UC admissions:

https://edsource.org/2020/in-historic-action-uc-moves-to-drop-sat-act-and-develop-a-replacement-exam-for-admissions

This means that none of the cohorts I taught at the old charter school (classes of 2021-2023) will need to take a standardized test for UC's (and I suspect the Cal States will soon follow). Recall that the dean there kept mentioning the importance of getting high SAT scores in order to get the kids to misbehave there, and as it turns out, the test won't even be needed for them.

More on the Future of Education

I'm also starting to hear more and more ideas about how to open schools in the fall. Many are emphasizing the need for social distancing if there are to be students on campus. And it's more important for elementary students to be in school, since these students can't stay home alone if both parents are at work.

One proposal I've heard is to have secondary students continue distance learning, while elementary students take over the middle and high school campuses in order to spread out. If my new district, which normally goes elementary K-6, middle 7-8, and high 9-12, were to adopt this plan, we might see something like elementary K-3, middle 4th, high 5-6, distance only 7-12.

And this worries me as a sub, since the only work subs could get would be in elementary. Notice that technically, I'm hired as a K-12 sub, though I choose to sub in secondary only. If this plan were adopted, then I'd be forced to sub for elementary students. I'd still try to avoid kindergarten, since this is outside my comfort zone -- and I'd go for sixth grade, since I did teach sixth graders at the old charter school. But there might be many other subs like me who are trying to avoid the lower grades, and they might grab the upper grade jobs quickly, leaving me stuck with kinder.

Meanwhile, my old district is a high school only district, rather than a unified K-12 district. The elementary schools in the city don't own the high school campuses, so I'm not quite sure what they'd do if the unified districts choose to house elementary kids on high school campuses.

Even so, there will be a need to hire more elementary schools -- even while falling revenues indicate that the budget for schools will be cut. And the place I fear the cuts may come could be the secondary schools -- if all teaching is online, a teacher could handle a load of 200-300 students, thus freeing funds for elementary teachers.

Conclusion

And all of this again underscores my need to learn Java. I have no idea what the future of education will bring, and what schools will look like next year. This might not be a good year to be a middle or high school teacher, whether as a regular teacher or a sub. I definitely need something like coding to fall back on.

You can expect my Lesson 5 Lemay post about a week from now.

No comments:

Post a Comment