.

Every Base is Base `10`

May 25, 2024

I came across this comic on Reddit about numbering systems. Admittedly, I had to look at the comments to get the joke. (Give me a break; I'm a retired mathematician!)

We use base `10`, so the numbers we use to count are `0,1,2,3,4,5,6,7,8,9`. The numbers that are higher than `9` are just combinations of these ten basic numbers. For example, `10` is a combination of `1` and `0`; `11` is a combination of `1` and `1`; `12` is a combination of `1` and `2`; and so on.

  • `0,1,2,3,4,5,6,7,8,9`
  • `10,11,12,13,14,15,16,17,18,19`

Also notice how both sequences of numbers follow the same pattern (the last digits are `0`, `1`, `2`, ..., `9`). So after counting `9`, we "reset" the pattern with `10`.

In the binary system, which is base `2`, there are only two numbers: `0` and `1`. Numbers that are higher than `1` are just combinations of these two basic numbers. `2` is represented as `10`; `3` is represented as `11`; `4` is represented as `100`; and so on.

  • `0,1`
  • `10,11`

Again, we can see `10` acting as a "reset" of the pattern.

Now, in base `4`, there are only four numbers: `0,1,2,3`. So `4` would be represented as `10`; `5` would be represented as `11`; `6` would be represented by `12`; and so on.

  • `0,1,2,3`
  • `10,11,12,13`

Again, `10` is the "reset" of the pattern.

The joke (or is it more of an insightful remark?) is that every number system uses `10` as the "reset" of the pattern. So technically, every base is base `10`. `10` just means something else for each number system.

.

I’ve a Thing Against

May 4, 2024

treating the "have" in "I've" as a main verb instead of an auxiliary verb.

.

The Continued Beginning

March 30, 2024

"I realise that the more interesting you are, the better your writing." No, it was not some famous person that said that (unless you're familiar with Dr. Angela Yu).

I guess I could've waited one more month to write this, but whatever. It's been 6 years since I started this blog-ish page. How serendipitous that my very first words were how I don't consider myself a great writer.

In fact, I still don't. However, I will concede that I am some sort of writer. But it's hard to write sometimes when there's nothing interesting to write about. I guess that'll happen when one is not an interesting person.

I suppose one doesn't have to be interesting to have fun though. Yes, this has been a fun adventure so far. Yes, the road is still long and I still don't know what's at the end or what I'll find along the way. However, there are other roads now. But I like the road I've been on, so I think I'll stay on it.

.

Facial Proportions

March 16, 2024

Eyes are in the middle of the face (halfway between top of skull and bottom of chin).

Ears are the same distance from the eye as the eye is from the chin.

Bottom of the ear is between the nose and mouth and where the back of the neck starts.

.

Their

March 9, 2024

"Their" as a possessive determiner for a singular owner is a hill I'm willing to die on.

There are only a few things I care more about.

They're word play and correct grammer. Or lack thereof.

.

Infituation

February 29, 2024

Have you ever done a jigsaw puzzle that just brought the greatest joy to your life? One that makes you more excited every time you fit a new piece and see more of the complete picture? But then you never get to finish it because something comes up and it remains unfinished and eventually forgotten?

Years pass by and you move on. Every once in a while, you think about the puzzle, but you don't remember the feelings of joy that came with putting the puzzle together. Yeah, that was nice, but those days are over. I don't have time to play with puzzles anymore.

Imagine you're walking on your usual route (I don't know, maybe you like to go on walks or something — humor me). But one day, you decide, for no particular reason at all, to go a different way. You walk past a toy store and, out of the corner of your eye — no way! It's the jigsaw puzzle! You quickly rush into the store and bring it home.

As you empty all the pieces out of the box, the old feelings of joy and happiness quickly rush back. Feelings you haven't felt in so long, you've forgotten what they feel like. Feelings you thought you would never experience again. And, yet, here they are! Oh it's the best feeling in the world!

Putting the pieces together, you can't help but feel something is off though. Somehow, you just know that this box contains a piece that doesn't belong. You decide to focus on the pieces that are fitting and hope to never find the piece that doesn't fit.

Week by week, you slowly work on the puzzle. You kinda don't want to finish it because then it would be over. But at the same time, you've never finished it before, so you wanna know how it's gonna turn out.

Finally, one last piece. You sit there paralyzed, basking in this momentous moment. Finally, the one thing you were never able to complete is about to be accomplished. Even though it means the fun is over, you can finally say you did it. You close your eyes and fit the piece. You take a deep breath. You let it out. You open your eyes.

The puzzle is broken. Ah, there's the piece that doesn't fit.

.

Socket Programming

September 24, 2023

I had to write a chat application that uses sockets to communicate with peers. The application allowed users to type in commands like "connect" and "send" to communicate with other users. To complicate things, a server could be connected to multiple clients and a client could connect to multiple servers. To further complicate things, the client and server code had to be in one program, meaning that a process was both a client and a server. It wasn't easy. This is, roughly, my coding journey.

Since a server can be connected to multiple clients, the code to listen for new connections has to be in an infinite loop:

ServerSocket serverSocket = new ServerSocket(port);
while (true) {
  Socket clientSocket = serverSocket.accept();
}

How can we ask the user for input if this infinite loop is running?

Use threads!

Thread setupServerThread = new Thread(new Runnable() {
  @Override
  public void run() {
    // listen for new connections
  }
});
Thread commandLoopThread = new Thread(new Runnable() {
  @Override
  public void run() {
    // ask for input
  }
});

Let's open two terminals. In terminal 1, we start the program using port 123. In terminal 2, we start the program using port 999. Back in terminal 1, we use the "connect" command to connect to terminal 2. Then we use the "list" command to see terminal 1's connections. There's only one connection and it's connected to terminal 2 on port 999. Switching to terminal 2, we use the "list" command to see terminal 2's connections. As expected, there is only one connection and it's connected to terminal 1. But it's on port 51383? Didn't terminal 1 use port 123?

(Here, terminal 1 is the client and terminal 2 is the server.) When a client connects to a server, it opens a new socket on a random port. This socket is not the same socket that is listening for connections on port 123. This new socket is for communicating with terminal 2 on port 999.

(Honestly, this confused me because our processes were both servers and clients.)

Let's say whenever a server accepts a connection, we also store the IP address and port of the client. The client knows the server's IP address and port (the client needed these in order to connect to the server in the first place). The server now knows the client's IP address and port. So when we want to send data, do we just open a socket, send data through the socket, then close it? And repeat this everytime we want to send data?

If the client is sending data to the server, then this will technically work.

But if the server is sending data to the client, then this won't work. This goes back to the previous question. When the server accepts the connection, the client's port is the random port that was used to establish the connection. So if the server wants to send data by opening a socket at that random port, it won't work because the client is not listening for connections at that random port.

So how do we send a message to an existing connection without opening a new socket?

Once a socket is created for communication (i.e., when a server accepts a connection), we can store the socket somewhere so we have access to it when we need to send data. In terms of implementation, we can create a custom class where the object will have an id and a socket. Whenever a server accepts a new connection, we create a new object of this class and store it in an array.

Socket clientSocket = serverSocket.accept();
connections.add(new ChatConnection(++id, clientSocket));

Then, when calling the send function, search the array by id and use the socket.

Once a connection is established, either side can continuously send and receive messages until someone uses the "terminate" command. This means a server has to be continuously listening for new messages, so there will be another infinite while loop involved (or a blocking call that waits for input). Something like (emphasis on something like):

ServerSocket serverSocket = new ServerSocket(port);
while (true) {
  Socket clientSocket = serverSocket.accept();
  BufferedReader bufferedReader = new BufferedReader(...(clientSocket.getInputStream()));
  while (true) {
    try {
      String msgReceivedFromClient = bufferedReader.readLine();
    }
  }
}

How do we accept more connections if waiting for input is a blocking call? (Blocking means that the rest of the code is blocked from running. Here, waiting for input is blocking the server from accepting new connections.)

Use threads! Everytime a server accepts a connection, start a new thread that continuously listens for input from that client.

Well, I'm half-joking this time. Using threads will work, but gets messy when there are many clients connecting.

We can, in fact, keep everything on one thread. We just have to use the select() API, which gives us a selector that "selects" sockets that are ready to perform a blocking operation. (Technically, a selector selects "channels", but I'll use "sockets" here.)

Selector selector = Selector.open();
ServerSocketChannel serverSocket = ServerSocketChannel.open();
serverSocket.register(selector, SelectionKey.OP_ACCEPT);
while (true) {
  selector.select();
  Iterator selectedKeys = selector.selectedKeys().iterator();
  while (selectedKeys.hasNext()) {
    SelectionKey key = (SelectionKey) selectedKeys.next();
    selectedKeys.remove();
    if (key.isAcceptable()) {
      SocketChannel clientSocketChannel = serverSocket.accept();
      clientSocketChannel.register(selector, SelectionKey.OP_READ);
    }
    if (key.isReadable()) {
      SocketChannel clientSocketChannel = (SocketChannel) key.channel();
      ByteBuffer buffer = ByteBuffer.allocate(256);
      int bytesRead = clientSocketChannel.read(buffer);
    }
  }
}

The register() function puts an alarm on a socket, and that alarm rings when a certain event occurs. If the socket is registered for reading, then the alarm will ring when there is data waiting to be read. If the socket is registered for accepting, then the alarm will ring when there is a client requesting to connect. When the alarm rings, the selector will go and handle that socket.

The select() function only selects sockets that are ready. If there are no sockets ready, then the code hangs there (the selector "goes to sleep") until an event occurs (until an alarm rings).

(Recall that a process can be both a server and a client.) Let's say terminal 1 connects to terminal 2. So terminal 2 will register the socket for reading (based on the code in the answer to the previous question). Terminal 1 can send data to terminal 2 and terminal 2 will receive them just fine since the socket is registered for reading. But what if terminal 2 wants to send data to terminal 1? How can terminal 2 send data to terminal 1 if terminal 2 registered the socket for reading?

First, a socket registered for one operation does not prevent it from being used for other operations (registering a socket simply puts an alarm on it). Second, a socket can be re-registered for a different operation at any time.

So each terminal can register the same socket for different operations. Terminal 2 can re-register the socket for writing if it needs to send data, and terminal 1 can register that same socket for reading to receive the data from terminal 2. What's happening is that each terminal is putting their own alarm on the socket, and that alarm will ring on events of their choosing.

Okay, all this putting an alarm on a socket stuff is nice, but how do we actually send data?

First, we register the socket for writing:

private void send() {
  socket.register(selector, SelectionKey.OP_WRITE);
}

Then the selector has to handle the socket when the socket is ready to write:

Selector selector = Selector.open();
ServerSocketChannel serverSocket = ServerSocketChannel.open();
serverSocket.register(selector, SelectionKey.OP_ACCEPT);
while (true) {
  selector.select();
  Iterator selectedKeys = selector.selectedKeys().iterator();
  while (selectedKeys.hasNext()) {
    SelectionKey key = (SelectionKey) selectedKeys.next();
    selectedKeys.remove();
    if (key.isAcceptable()) {
      // accept the connection
    }
    if (key.isReadable()) {
      // read the data
    }
    if (key.isWritable()) {
      ByteBuffer buffer = ByteBuffer.wrap(messageToSend.getBytes());
      ((SocketChannel) key.channel()).write(buffer);
    }
  }
}

Wait, the data still isn't sending when the send() function is called...

Recall that registering a socket only puts an alarm on it; it doesn't ring it (if I sound like a broken record, it's because it took me a long time to wrap my head around the register() function). We have to wake up the selector!

private void send() {
  socket.register(selector, SelectionKey.OP_WRITE);
  selector.wakeup();
}

Why do we have to do that? We didn't have to do that for reading data or accepting connections.

Receiving data and accepting a connection are "qualifying events". They automatically ring the alarm and wake up the selector*. When nothing is happening, the selector will go back to sleep. Registering a socket is not a qualifying event, so that alone will not wake up the selector.

*Qualifying events wake up the selector, even if there are no sockets registered for that event's operation. This makes the whole alarm analogy a bit loose. The more accurate analogy is that an event wakes up the selector and the alarm tells the selector which sockets to handle. So the purpose of the alarm isn't to wake up the selector; it's to let the selector know which sockets need to be dealt with when a certain event occurs.

Okay, so terminal 1 can finally send data to terminal 2 and terminal 2 will actually see the data. But if terminal 2 sends data to terminal 1, terminal 1 doesn't see it. Why?

If terminal 1 was able to send data to terminal 2, then that means terminal 1 had registered the socket for writing. After terminal 1 was done writing, the socket remained registered for writing. So when the socket received data from terminal 2, terminal 1's alarm didn't ring because terminal 1 didn't register the socket for reading.

if (key.isWritable()) {
  ByteBuffer buffer = ByteBuffer.wrap(messageToSend.getBytes());
  ((SocketChannel) key.channel()).write(buffer);
  ((SocketChannel) key.channel()).register(selector, SelectionKey.OP_READ);
}

.

`0.999...=1`

August 13, 2023

My favorite reason why `0.999...=1` (thanks to this video) is the fact that there's no number in between `0.999...` and `1`.

Consider the numbers between `1` and `2`. There is `1.5`. And `1.55`. And `1.555`. And `1.55583`. And `1.555583724728482824209248`. And so on. The point is, there are infinitely many numbers between `1` and `2`.

Now, tell me, what number is between `0.999...` and `1`? If you can't think of any number, then it must be the case that `0.999...` and `1` are the same number.

A few days ago, I came across this Reddit post about a proof that claims that `0.999...!=1`. It goes something like this:

`0.999...=1-lim_(n->oo)(1-1/n)=1-(lim_(n->oo)1-lim_(n->oo)1/n)=1-(1-0)=1-1=0`

So `0.999...=0`?! 🤯

Obviously, the mistake is stating that `0.999...=1-lim_(n->oo)(1-1/n)`. (Well, duh! 🙄)

The intent was to capture the idea that `0.999...` is `1` subtracted by a little tiny bit. An infinitesimally small bit. But if we want to fix the proof, we have to be a bit more precise.

`0.999...` is `1` subtracted by `0.000...001`. We can represent `0.000...001` using a fraction. But first, let's look at some other numbers we're more familiar with:

  • `0.1=1/10=1/10^1`
  • `0.01=1/100=1/10^2`
  • `0.001=1/1000=1/10^3`
  • `0.0001=1/10000=1/10^4`

So if `0.000...001` has infinitely many `0`s before the `1`, then its fraction form must be `1` divided by `10` raised to an infinitely large power. Mathematically, this is `lim_(n->oo)1/10^n`.

"`0.999...` is `1` subtracted by `0.000...001`" can now be restated as "`0.999...` is `1` subtracted by `lim_(n->oo)1/10^n`."

The proof should have started by stating `0.999...=1-lim_(n->oo)1/10^n`. Completing the proof, `0.999...=1-lim_(n->oo)1/10^n=1-0=1`.

.

Sapiosexual

August 6, 2023

If you don't know, then it wasn't meant to be.

.

Wordplay: Addition and Subtraction

July 29, 2023

if he gives the at, he attains

if he gets abs, he abstains

if he's sus, he sustains

if he asks her, he ascertains

but without the ass, he's just certain

he's the man with the eye, he maintains

contact, but no tact, he contains

love in his life, he shall obtain

.

Philosophy Final Exam Question

February 26, 2023

Which answer in the list below is the correct answer to this question?

(a) All of the below.

(b) None of the below.

(c) All of the above.

(d) One of the above.

(e) None of the above.

(f) None of the above.

Let's suppose (a) is the correct answer. Then that means (b), (c), (d), (e), and (f) are also correct. But if (b) is correct, then (c), (d), (e), and (f) are not correct, which is a contradiction since we concluded (c), (d), (e), and (f) were correct. So (a) can't be the correct answer.

Let's suppose (b) is the correct answer. Then that means (c), (d), (e), and (f) are not correct. But if (d) is not correct, then (a), (b), and (c) are also not correct, which is a contradiction since we assumed (b) was correct. So (b) can't be the correct answer.

Let's suppose (c) is the correct answer. Then that means (a) and (b) are also correct. But if (b) is correct, then (c), (d), (e), (f) are not correct, which is a contradiction since we assumed that (c) was correct. So (c) can't be the correct answer.

Let's suppose (d) is the correct answer. Then that means one of (a), (b), or (c) is also correct. Well we just proved that none of (a), (b), and (c) can be correct, so (d) can't be the correct answer.

Let's suppose (e) is the correct answer. Then that means (a), (b), (c), and (d) are not correct. We just proved that, so (e) is the correct answer.

For fun, let's suppose (f) is the correct answer. Then that means (a), (b), (c), (d), and (e) are not correct, which is a contradiction since we concluded that (e) was correct. So (f) can't be the correct answer.

.

Rotation Offset (Decrypting)

June 12, 2022

max minus value

plus offset modulus length

subtract from the max

.

Writing Style

June 5, 2022

How would I describe my writing style? Heavily dependent on overusing parentheses (among other traits).

.

An Easier Way to Solve Quadratic Equations

August 27, 2021
Po-Shen Loh explains his discovery here. (simplified.)

Rather than re-explaining his method, I want to go over the key insight that is the core of the method.

If two numbers add up to some number `b`, then those two numbers must be the same distance away from their average.

Suppose `b=8`. Well, two numbers that add up to `8` are `1` and `7`, and their average is `(1+7)/2=4`. The distance between `1` and `4` is `3`, and the distance between `7` and `4` is also `3`. The two numbers (`1` and `7`) are the same distance (`3`) away from their average (`4`).

`2` and `6` also add up to `8`, and their average is `(2+6)/2=4`. The distance between `2` and `4` is `2`, and the distance between `6` and `4` is also `2`. The two numbers (`2` and `6`) are the same distance (`2`) away from their average (`4`).

Imagine putting `8` apples on a weighing scale so that both sides are evenly balanced (so there would be `4` on each side). If you take away 1 apple from one side and put it on the other side, then one side will have 1 apple more and the other side will have 1 apple less. A painfully redundant sentence — I realize as I'm writing this — but the point is, one side will always be heavier by the same amount that the other side is lighter by.

When solving quadratics, like `x^2-8+12`, we want to find two numbers that add up to `8`* and multiply to `12`. To avoid the guess-and-check route, we could choose the two numbers to be `(4-u)` and `(4+u)` where `u` is some number that we eventually solve for. Notice that `(4-u)+(4+u)=8`, so the two numbers definitely add up to `8`. More importantly, notice that this embodies the statement I've been trying to explain: If two numbers add up to some number `b`, then those two numbers must be the same distance away from their average. Suppose `u=3`. Then the two numbers are `1` and `7`. Suppose `u=2`. Then the two numbers are `2` and `6`. Do these numbers look familiar?

Then we set `(4-u)(4+u)=12`. Once we find `u`, then our conditions are satisfied: two numbers that add up to `8` and multiply to `12`. No guess and check!

*In Po-Shen Loh's method, for a quadratic `x^2+Bx+C`, we want to find two numbers that add up to `-B`, not `B`.

.

An Upper Bound for Project Euler 40

January 23, 2021
Project Euler Link

Champernowne's constant is defined as: `0.123456789101112131415161718192021...` . "If `d_n` represents the `n^(th)` digit of the fractional part, find the value of the following expression. `d_1 * d_10 * d_100 * d_1000 * d_10000 * d_100000 * d_1000000`"

For `1 le i le 9`, we append `9*1 = 9` digits.

For `10 le i le 99`, we append `90*2 = 180` digits.

For `100 le i le 999`, we append `900*3 = 2,700` digits.

For `1,000 le i le 9,999`, we append `9,000*4 = 36,000` digits.

For `10,000 le i le 99,999`, we append `90,000*5 = 450,000` digits.

At this point, we have appended `488,889` digits, which means we need to append `511,111` more digits.

Starting from `100,000`, we will be appending `6` digits per number. So we only need to add `text(ceil)((511,111)/6) = 85,186` more numbers from `100,000`.

.

An Upper Bound for Project Euler 30

January 18, 2021
Project Euler Link

"Find the sum of all the numbers that can be written as the sum of fifth powers of their digits."

For example, a number that can be written as the sum of fifth powers of their digits is `4151 = 4^5 + 1^5 + 5^5 + 1^5`.

There is a point where the number becomes too big for the sum of its digits to match that number. `9` to the fifth power is a fairly big number, but adding a bunch of those would never result in something like `99999999999999999`.

For `999,999` the sum is `354,294 = 9^5+9^5+9^5+9^5+9^5+9^5`.

For `9,999,999` the sum is `413,343 = 9^5+9^5+9^5+9^5+9^5+9^5+9^5`.

A `7`-digit number produces a `6`-digit sum, so the sum of its digits can never be equal to the number. Therefore, the upper bound has to be a `6`-digit number.

.

Diophantine Equations in a Music Player

December 6, 2020 (last updated on December 8, 2020)

A music player that shuffles songs would theoretically assign an equal probability (to be played next) to all songs. For me, the problem with this is that a song that has recently played can be picked again. This falls in line with the randomness of shuffling songs, but sometimes it's just too recent and I wanna hear something else.

This gave me the idea for a music player that shuffles songs with weighted probabilities. Songs that have never been played before have a higher chance to be picked next than songs that have been played already. For example, let's say we have `5` songs. At the beginning, all songs each have a `1/5 = 20%` chance of being picked next. After a song is played, the remaining `4` songs could each have a `24%` chance of being picked next and the song that just played has a `4%` chance of being picked next. Or it could be `23%` each for the `4` songs and `8%` for the song that just played. Or it could be `21%` and `16%`. There are a few solutions, but the important thing is that the songs that haven't been played yet have a higher chance to be picked next than the songs that have just been played. (There would probably actually be infinitely many solutions if we consider non-integer probabilities, so for simplicity, we could look at only integer* probabilities.)

So we have probabilities that work for our situation, but how do we find probabilities that work for the next song? What if we (undoubtedly) had more than 5 songs?

Going back to our situation earlier, let's say our music player just finished playing a song and is looking for the next song to play. We can model this situation using an equation: `4x + y = 100` (where `x > y` are positive integers). Incidentally, this turns out to be a Diophantine equation where the integer solutions to the equations are the probabilties that we assign to the songs.

More generally, if we have `n` songs, then the Diophantine equation we're solving is `(n-m)x + my = 100` where `m` is the number of songs that have been played already.

We could use the Euclidean algorithm to find solutions to these Diophantine equations, but if we're programming this, it would be much easier to start with `y=1` and keep incrementing it until we find an integer for `x`.

*Unfortunately, by considering only integer probabilities, there are some sticky situations with giving equal probabilties to 3, 6, 7, ... unplayed songs. And it doesn't work for more than 100 songs.

For my music player, I'm also requiring `y > 0` to allow songs that have been played to be played again, but Diophantine equations in general can have `0` as a solution.

.

Rotation Offset

February 10, 2020

value minus min

plus offset modulus length

plus min to rotate

.

How Advancements in Computer Science Helped Us Win WWII

November 20, 2019
Written for ThoughtSTEM's blog

The bombe helped us win World War II. Nope, that's not a typo. The bombe was a machine designed by Alan Turing to decipher encrypted German messages. With the bombe, the Allies knew exactly what the Germans' plans were, allowing them to move troops out of danger and invade at opportune moments. Because of this -- and other remarkable achievements -- Alan Turing is considered to be a war hero who helped win the war.

In addition to the soldiers fighting at the front lines, Britain had another army at Bletchley Park where thousands of crossword enthusiasts, chess players, codebreakers, and mathematicians were all working toward one goal: decrypting Enigma messages. Originally a machine for commercial use, the Enigma was adopted and improved upon by the German military to send coded messages. The Enigma was definitely a complex machine; it was so complex that the Germans thought they had come up with a way to create unbreakable code.

The Enigma looked like a typewriter, except that above the keyboard was another set of 26 letters that would light up on each keypress. Pressing a key on the keyboard would result in a completely different letter lighting up. To convert a regular message into a coded message, the typist would press the key for a letter in the regular message and write down the letter that lit up. The result would be a random string of letters. For example, pressing ‘H’ might lead to ‘Q’ lighting up, and pressing ‘I’ might lead to ‘K’ lighting up. So the message "HI" would be encoded as "QK". This method of encoding is called a substitution cipher.

Part of what made it complex — and seemingly unbreakable — was that ‘H’ wasn’t always replaced with ‘Q’. In fact, pressing the same key repeatedly resulted in different letters lighting up each time. This prevented codebreakers from analyzing letter frequency and matching patterns. The letter that would light up was determined by three components: a plugboard consisting of 10 plugs, a set of three rotating wheels called rotors, and a reflector. Each component mapped each letter to a different letter. In a sample scenario, pressing the ‘B’ key on the keyboard would send an electrical current to the plugboard, where ‘B’ might be mapped to ‘S’. Then the current would go through each of the three rotors, where ‘S’ might become ‘W’, ‘W’ might become ‘A’, and ‘A’ might become ‘U’. After that, the current would go through the reflector, where ‘U’ might become ‘T’, and then go back through the rotors and the plugboard again (and thus have the letter go through four more changes) to get the final letter that would light up. What made it possible for the same letter to map to a different letter each time was the fact that the rotors would spin on every keypress, changing the path of the electrical current, and therefore the letter that would light up.

The other part of Enigma that made it so complex was the fact that there was almost 159 quintillion ways (158,962,555,217,826,360,000 to be exact) the components of Enigma could be arranged to produce a coded message. However, to complicate matters further, the Germans would change the Enigma settings everyday, all of which were listed in a codebook that only the Germans had so they knew how to set their Enigma machines. Everyday, the codebreakers at Bletchley Park had 24 hours to figure out the one configuration that was used for that day. When the next day came, all their previous work would be useless.

It was an extremely difficult task, but the codebreakers did have some help. They knew about how Enigma worked because Polish codebreakers had been working on breaking Enigma since 1931. With secretly obtained documents containing the instructions and settings for the Enigma, the Polish codebreakers had managed to actually break the Enigma with their machine called the bomba — that is, until the Germans modified their machines in 1939. Before Poland was invaded, they transferred all of their work and knowledge to Bletchley Park, where Alan Turing improved upon their bomba to design his bombe.

Alan Turing was a mathematician and codebreaker. Regarded as a genius by those around him, he is considered to be the father of computer science and artificial intelligence. Before the war, he came up with the idea of a universal computing machine, later known as Turing machines, which is a theoretical model of a simple, abstract computer. Turing machines help us understand which problems are solvable by computers.

Alan Turing was fascinated with the idea of automating tasks. Fortunately for the codebreaking team, he had the genius to recognize that he could automate the codebreaking process. A well-known flaw in the Enigma machine was that a letter was never replaced by itself. Exploiting this, the codebreakers would take stock phrases, like "weather report" for example, and compare it to an encoded message to find a pattern where the coded letters did not match the letters of the stock phrase. Alan Turing realized that this part of the codebreaking process could be automated, making it much faster. With this in mind, he designed the bombe, a large device with a bunch of rotating drums that simulated the spinning rotors on the Enigma. Instead of finding the one correct setting, the bombe exploited the flaw in the Enigma machine to rule out all the impossible Enigma settings, leaving the codebreakers only a few settings they had to manually check. Once they found the correct setting, they knew exactly what the Germans were communicating to each other. Crucial information that was believed to be hidden was now wide open, eventually leading to an Allied victory.

Historians estimate that Alan Turing’s contributions may have helped shorten the war by two to four years and saved about 14 to 21 million lives. In fact, Winston Churchill was reported to have told King George VI that it was because of decryption that they won the war. World War II was more than a war of guns and bombs. It was a war of information. It was a war where the bombe and Enigma were pitted against each other to see which machine had ultimate control over communication. This constant battle over the transmission of information sparked the Age of Information; in fact, the first modern computers were constructed right after the war using technology developed during the war.

The Age of Information began with one computer scientist who built a computer that helped us win the war. Today, one computer scientist can build a piece of software that impacts millions of lives. Today, one computer scientist can revolutionize every field of human achievement — whether it be science, technology, engineering, math, art, or even basic human communication. And this is possible because of Alan Turing’s contributions to the development of modern computing. Alan Turing, the father of computer science, gave us computer science as we know it.

.

In the World of STEM, Software is Everywhere

October 25, 2019
Written for ThoughtSTEM's blog

Sarai is a 4th grader whose favorite subject is science. Her favorite part about science class is doing experiments, like testing different conditions on the growth of bean sprouts and conducting surveys to answer interesting questions. Jackson is a 5th grader who always looks forward to participating in the Robotics Club at his school. For the past few weeks, he has been busy preparing for the upcoming competition by helping his team design, build, and test a robot that can pick up, carry, and drop off a small bag of marbles. Anika is a 3rd grader who enjoys math. She recently solidified her understanding of fractions, decimals, and percentages by making her own store and calculating the prices of items after discounts and taxes for her class project.

What do these three elementary school students all have in common? It’s pretty clear that they all have an interest in STEM. If they continue in their favorite subjects, then another thing they all have in common is that they will end up using software — or machines controlled by software — to help them complete their work.

When Sarai grows up, she will program machines with robotic arms to help her analyze protein samples in a biochemistry lab. She can also code a program to help her analyze all that data and formulate patterns and conclusions for her experiments. When Jackson grows up, he will use computer-aided design (CAD) software, like AutoCAD, to design realistic 2D and 3D models and carry out simulations for everything from buildings to robots. When Anika grows up, she will use software packages like Mathematica to perform millions of mathematical calculations in an instant. Software isn’t just hidden inside the T in STEM. It is hidden inside every one of those letters and every single sub-discipline that each of those letters represent. And for all STEM fields, software makes the work easier and allows us to do things in minutes that would previously have taken humans a lifetime to complete.

An example from math: Mathematicians often use software to create models that they can experiment with. Some mathematicians work with manifolds, which roughly speaking, are objects that look like a point, line, plane, etc. when you "stand on it". More interestingly, the shape of the object that you’re "standing on" is not the same shape that you see around you. For example, when we stand on the Earth, the land that we stand on looks like a plane (a rectangle of infinite size). It looks flat. But the Earth is round; the surface is a sphere. The surface of the Earth is a manifold. Another example is a circle. Imagine if we drew a circle on a piece of paper and shrunk ourselves really small onto the edge of the circle. If we walked on the edge of the circle, it would feel like walking in a straight line. A circle is a manifold. Studying manifolds makes analyzing complex objects simpler.

An application of manifolds shows up in image and video processing. Images contain many pixels, and the number of pixels determines its dimensions. For example, a 100x100 image has 10,000 pixels, so it exists in a space that has 10,000 dimensions (here the concept of dimensions is the same as the way we think about 2D and 3D objects). But for people working with images, they’re not interested in every single pixel. They’re only interested in the pixels that make up the parts of a stop sign, let’s say. Since there are fewer pixels, those pixels that make up a stop sign exist in a space that has fewer dimensions than the image itself. The shape of the stop sign is different from the shape of the image, making an image a manifold.

Mathematicians use this idea when working with images. Specifically, they use software (e.g. MATLAB) to build models of manifolds to try to model the parts of the image they’re interested in. Working with models allows them to manipulate them, leading to applications like generating completely new images without having a camera and restoring the pixels of images (video interpolation).

Software is also used in flow cytometry, which is a technique used to study the characteristics of cells. (Interestingly enough, cells are manifolds as well.) Researchers take blood and analyze the cells by looking at certain features and finding relationships among them. One application of flow cytometry involves deciding if someone is sick — for example, deciding if they have leukemia — by comparing their cells to those belonging to a person who is sick. These kinds of comparisons are the basic idea behind machine learning. Researchers write code to build a machine that can learn what a sick cell looks like and use that information to predict the condition of other cells. In the world of STEM, software is EVERYWHERE. It’s inescapable. From the classroom, to the lab, to the field, you are going to find software being used all the time. The nature of STEM is still the same: discovering the truths hidden in nature. Now, we have software to help us find answers faster and more efficiently.

Imagine if everyone knew how to code. Imagine if everyone was able to find answers faster and more efficiently. No longer would those fluent in STEM have to wait for those fluent in coding to help them find the answers they’re looking for. Think of all the new ideas and advancements that would be made possible by everyone’s contributions.

This is the world we are living in right now. A world driven by software built by coders.

.

What Programming Language Should My Student Learn?

September 12, 2019
Written for ThoughtSTEM's blog

Java. C++. Python. JavaScript. If you are familiar with the world of computer science, then it is likely that you have heard the names of these languages and possibly others. If you are looking to introduce computer science to your children, then you have probably wondered, "What programming language should my student learn?" It’s a valid question. And it’s one that many people ask us all the time.

Some people think you should learn the most popular language.

That sounds reasonable. If a lot of companies are using Java, then that must mean Java is a pretty good language. In fact, TIOBE, a company that checks and measures the code quality of software programs, currently lists Java as the most popular language. On the other hand, the PYPL (PopularitY of Programming Language) index looks at Google searches to determine which programming languages are most commonly searched. It lists Python at first place and Java at second place. There’s certainly no doubt that Java is a widely-used language. There’s a reason why you’ve probably heard of Java.

Some people think you should learn whatever companies are hiring for.

Again, it sounds pretty wise to make an investment now that will play well into the future. On Indeed, the job-searching platform, there are currently 70,527 jobs for Java developers. There are also 70,913 jobs for Python and 57,643 jobs for JavaScript. These are the numbers from August 23, 2019. Back in May 2019, there were about 69,000 jobs for Java, about 67,500 jobs for Python, and about 40,000 for JavaScript. While it is certainly notable that there has been a big increase in the number of jobs, what’s even more important is that the number of Python jobs has surpassed the number of Java jobs in such a short amount of time.

The ever-changing popularity of languages and the ever-changing job market lead us (and many computer science educators) to the conclusion that the most popular language isn’t always the best choice to learn. Languages are coming in and out of fashion all the time. If we examine any device over time, whether it’s an iPhone, Android phone, or laptop, we see this constant flux of different languages coming in and out of fashion:

Back in 2007, when the iPhone first came out, developers made iOS apps using a language called Objective-C. Objective-C, which is a more advanced version of C, was the language used to build the operating system for Macintosh computers. So naturally, Apple extended Objective-C support to their iPhones. Objective-C was the predominant language used to make iOS apps for 7 years until 2014, when Apple introduced a new programming language called Swift. Now, Swift is the main language used to make iOS apps. And it has been for the past 5 years. Whether or not Swift will be replaced by a new language the way Objective-C was remains to be seen. But it certainly is possible.

A similar story is playing out in the Android world. Android apps have traditionally been made with Java. While Java is still widely used to make Android apps today, the Android world is slowly starting to move towards Kotlin, a programming language that you’ve probably never heard of, created by a software development company called JetBrains. Even though Kotlin was created in 2011, it wasn’t supported on Android until 2017. And recently in May 2019, Google announced that Kotlin is now the preferred language for making Android apps. It’s a more recent transition than the one in the Apple world, but it’s happening nevertheless. Kotlin might soon replace Java as the most common language for Android apps the same way Swift replaced Objective-C as the language for iOS apps.

The big takeaway here is that even though one language seems to be popular, it isn’t always going to stay popular. Even though one language seems to be the current standard, it can (and will) easily be replaced by another language. However, this doesn’t mean that learning the popular language is a bad choice. It just means that learning computer science shouldn’t be about learning one particular language. The world of technology is rapidly changing, and programmers have to respond and adapt quickly to these changes. So, learning computer science should be about learning new languages quickly. A proper computer science education should involve being exposed to many different languages, as well as learning how to learn new languages.

And there are a lot of different languages out there. Working on large-scale software programs? There’s Java, C, C++. Working on mobile apps? There’s Kotlin, Swift, Dart. Making websites? HTML, CSS, Javascript, PHP. Handling large amounts of user data on websites and mobile apps? SQL. Dealing with machine learning? Python. Visualizing data? R. Creating video games? C#. Manipulating images or solving problems in engineering? MATLAB. Making your own programming languages? Racket. The list goes on and on. These languages are not confined to their mentioned associated field either. You can use Python to make mobile apps and analyze massive amounts of data. You can use Java to make video games. In fact, you can use any programming language to do almost anything you want. For companies, it’s all a matter of preference - there are always many languages they can choose from to accomplish their goals.

It’s very rare to see a company that uses only one language for all their systems. For most developer positions, you’re expected to know 4–5 different languages! For example, a recent job posting to be a software engineer for Google lists Java, C/C++, C#, Objective-C, Python, JavaScript, and Go as languages for desirable applicants. Even more importantly, another preferred qualification is having an "interest and ability to learn other coding languages as needed." Google understands that the programming languages they use are always subject to change.

Therefore, the strategy shouldn’t be to learn whatever languages companies are hiring for, especially for students in K–12. Almost any task can be completed with any programming language; companies just choose the languages they want to work with. In most cases, the decision comes down to the language’s convenience and ease of use. This might then lead to the question, "which language is the most convenient and easy to use?" Well for one, convenient and easy are going to be subjective and different for each person; it will also be different from project to project. But really, existing languages are being changed and improved all the time to make them easier for people to use. In addition, new languages are being created all the time with the purpose of being easier to learn and use than current existing languages. Check out this incredibly long list of languages "phone"that have been made by programmers who wanted the functionality of JavaScript without having to actually use JavaScript.

All these changes and improvements are part of the reason that languages keep moving up and down in popularity. The situation was quite different years ago. The TIOBE Index keeps track of programming language popularity over the decades in their "Very Long Term History" section. You can see how the "top 10" programming languages have changed positions considerably since 1989. Lisp was number 3 and Pascal was number 20 back in 1989; now in 2019, Lisp is at 32 and Pascal is down at 220. In 1994, Python was at 21; now in 2019, Python is number 3. SQL also made a big jump from 89 in 2004 to 9 in 2019. The point is, what used to be popular might not be popular several years from now, and what isn’t popular right now might become one of the most popular languages in several years.

Learning programming is more than just learning one language. A good computer science education should expose students to many different languages, as well as teach students how to learn different programming languages quickly and effectively. Being exposed to languages you’ve never heard of will make you more flexible and adaptable as a programmer. Learning how to learn is a transferable skill that will make picking up a new language easy, no matter how unique or difficult the language is. This is why ThoughtSTEM is constantly creating new languages for our students to learn each quarter and aims to train students not only in how to use those languages, but the best practices in learning languages. We believe this will make our students flexible and adaptable for those "popular languages" of tomorrow that haven’t even been created yet!

.

The Answer's Not in the Code

September 8, 2019

As a programmer, I don't really think about user interfaces a lot. Heck, we navigate through our computers by typing cryptic commands into a simple black window with no buttons. Our only goal is to get the program working. Making it look nice is some graphic designer's job. Even though programmers can get by without knowing a single thing about graphic design, it's still worthwhile to know a thing or two about user interfaces.

I recently redesigned one of my past Android apps that played audio.

It used a ListView as the root layout and utilized a custom ArrayAdapter to populate the list. (I know, I know. RecyclerViews are much better. I didn't know at the time.) It doesn't look like an audio player, but I actually put an OnClickListener on each list item itself.

I wanted to redesign the app, not because the UI was bad, but because I wanted a button that would show the lyrics to a particular song. And I wanted play/stop functionality within the app. Again, I'm not a graphic designer, so my thought was just to keep the same ListView implementation, but just add 2 buttons to each list item. Not too hard right?

Yeah it wasn't too hard at all. But the bugs that came with it were headache inducing. If I pushed the play button, the button would change to the stop icon, which was fine. But when I scrolled up and down, random buttons would change icons randomly. Buttons that had a play icon before going off the screen would have a stop icon when coming back onto the screen. And buttons that had a stop icon before would have a play icon when coming back.

This was because I was setting each button's icon in the ArrayAdapter's getView() method, which seemed like the only logical place to do so. The problem is that the View and position that are passed into the getView() method are relative to what's on the screen. Meaning that if the song that is currently playing is at position=1, then when I scroll up or down, it won't be at position=1 anymore. However, my code is programmed to have the stop button on the View at position=1, because the song that is currently playing used to be at position=1. So when I scroll up or down, whichever song ends up being at position=1 will have the stop button instead.

I could've kept track of each button's state in some custom class or database or whatever and used that to update the buttons. But I thought about what the students were doing in an iOS App Production class. They were creating different user interfaces for a rock-paper-scissors game. So that inspired me to try a different user interface instead.

The result was nice on several levels. Not only did I completely avoid that bug, but I also had a slightly better user interface. Namely, bigger buttons. And only 2 buttons, so no tapping the wrong play button.

When there's a bug, sometimes the answer isn't just adding more code to patch up the holes. Sometimes, the answer lies in the design.

.

Why Software Developers Need to Learn Empathy (as well as Coding)

August 26, 2019
Written for ThoughtSTEM's blog

Empathy: Caring for other people and sharing in their feelings and experiences. It’s undoubtedly an important quality for everyone to have. Empathy is also something that is taught through families, through teachers, through friends. If education is to prepare people for success in the world, then empathy has to be a big part of their education. It’s easy to see how useful having empathy would be for areas such as business, marketing, or any other type of work that requires interacting with other people. However, empathy is just as important for people in computer science.

But wait! People who code just sit in front of their computers and press buttons on a keyboard, right? What does empathy have to do with computer science? To answer that, let’s look at the — perhaps subtle — ways that technology influences the choices we make for ourselves and for our loved ones.

What are your favorite phone, tablet, or computer apps? Would you say that they’re easy to use? They probably are. Do they meet your needs? They probably do. Otherwise you would’ve stopped using them, right?

What about apps for your children? Did you spend a lot of time looking through the hundreds of educational apps trying to find the perfect ones for them? Do they do what you want them to do? They probably do. Otherwise you wouldn’t have let your children use them, right?

Easy to use and meets your needs - these are two properties of successful apps, regardless of platform (iOS, Android, macOS, Windows) or category (social, entertainment, business, food, fitness).

Let’s take a look at Google, for example. Google’s website (google.com) is more or less just a white page with a search bar in the middle. That’s it. There’s nothing fancy or flashy about it. Yet, it’s the most used search engine by far. Why is that? Well, it certainly doesn’t hurt that it is, in fact, easy to use and does exactly what you need it to. With the search bar right in the middle of an empty white page, you know exactly where to click or tap. Also, how often is the answer you’re looking for on the first page of the search results?

While a lot of time was undoubtedly spent by software developers writing the 2 billion lines of code at Google, there was probably an equally significant amount of time spent improving the design and speed. Would you continue to use Google if you had to dig around the website for the search bar? Surely you wouldn’t continue to use Google if it took more than half a minute to load the information you’re looking for. (Imagine if it was on the second page too!) A lot of time was spent making it easy for you to use.

Let’s take a look at YouTube Kids - another example. YouTube Kids was created in 2015 (10 years after YouTube was created) so that children can watch age-appropriate videos. Because of the intended audience, I’m going to go out on a limb here and say that it’s pretty easy to use. But the more important feature is that it meets the needs of parents by providing a safe, curated content for children to watch.

From a basic standpoint, YouTube Kids does pretty much the same thing YouTube does. It allows you to watch videos. So why go through all of the work to make a completely new app that does the same thing? The answer is probably obvious. With the increasing number of children that have access to phones and tablets, it’s important to make sure that kids stay safe when they are online.

It probably took a lot of effort to implement features such as excluding inappropriate videos and giving parents the option to manually select preferred channels and videos. The software developers who made Youtube Kids undoubtedly needed a lot of feedback from parents throughout the design process. But all that effort was devoted to satisfying what you were seeking for your children.

So what do Google and YouTube Kids both have in common? (Besides being owned by Google.) They were both built with the user in mind. The people who wrote the code for those websites know that we want relevant search results quickly. They know that parents want a safe educational experience for their children. They also know that apps should be easy to use so that we don’t become too frustrated to use them. As a result, they have successfully created apps that have become such a big part of our world.

Easy to use and meets your needs: As humans, we value apps that have these two properties. As humans, we also have the power to make apps that have these two properties. We just have to constantly keep in mind who our users are. Furthermore, our design processes must involve interviewing potential users and understanding their needs as completely as possible.

This is why it’s so important for software developers to have empathy. It’s important for software developers to understand and value the feelings and needs of others. It’s important for software developers to care about others; care about how users feel when using their app; care about how users can accomplish their goals by using their app. By understanding how others think and recognizing the desires and needs of others, software developers can make apps that other people can and want to use. Software developers aren’t making apps for themselves to use; they’re making apps for other people to use. They’re making apps for you to use.

.

Learning CS (A Few Words from Beginners)

August 12, 2019

I had the chance to work personally with some students who were taking introductory programming courses. The first student took a MATLAB course in person. The second person took a Java course online. Here, I want to record some of their insights before I forget them or something.

Is programming something you want to continue learning or doing?

1) Programming is interesting, but probably wouldn't pursue it as a career. Maybe for fun

2) Yes, there are several applications of programming in psychology

Here, I was just interested to see if they were "turned off" by programming after struggling through it.

If so, what would you like to learn?

1) Java

2) learn more languages

Before taking the class, did you expect it to be easy or hard? Why?

1) Hard: Other people make computer science seem hard

2) Hard: Other people say coding is hard, thought of self as not tech-savvy

I just wanna say that while computer science is hard, any other subject could be just as difficult. I find it interesting that people are quick to say that computer science is hard, but I hardly hear people saying the same thing about biology, art, history, reading, writing, etc.

There's this conception that people are naturally good at some subjects. For example, there are "math people". Do you agree with this idea after taking the class?

1) Yes, some people are naturally good at computer science

2) No, anyone can learn. Yes to a certain extent because some people are naturally good, but people can work towards it. Coding is not purely math, it involves both math and some creativity, so it activates both hemispheres of the brain

I do believe that some people are naturally good at some subjects. However, I also believe that anyone can learn anything if they want to. Just because someone isn't a "math person" doesn't mean they'll never understand math. Different subjects require different mindsets (i.e. ways of thinking) so recognizing this is a good first step.

Was there a point when things started to suddenly make sense?

1) Yes, after learning in class and doing examples in MATLAB. Learned more in labs because putting concepts into practice

2) Yes, after learning loops

Regarding computer science, I believe that there is a point where nothing makes sense at first, but everything "clicks" at a later time. I've personally experienced it for computer science and linear algebra. I struggled for the first 8 weeks of my first programming class, but around week 8, everything from day 1 just somehow suddenly made total sense to me. I didn't understand a thing about linear algebra (I got a C- or something in that class out of sheer luck) but after taking an upper div math course related to linear algebra 4 years later, most things in linear algebra suddenly makes total sense to me.

These students seemed to have a slightly different experience than I did though. Especially with the first student, it seemed to be more of a repeated process of not understanding, then understanding each topic.

What did you do that helped you understand the concepts?

1) Do the homework assignments, go over clicker questions in lecture notes

2) Make up small programs and watch YouTube videos. Can look at lecture notes all you want, but won't learn until you do it (or even just watch other people do it).

It probably goes without saying (but I'm gonna say it anyway!) that practice is invaluable. I particularly liked how the second student made small programs to try to understand the concepts, because reading code and writing code are completely different activities; knowing how to read code isn't enough.

Regarding the lecture notes, these answers aren't contradictory because they were in different situations. The lecture notes for the first student were really helpful, with some explanations and lot of practice questions. The lecture notes for the second student were not that great. There was a lot of text, few (correct) specific examples, and a lot of general, abstract examples.

Now that you've taken the class, do you feel comfortable helping others learn? What are some topics that you still feel "iffy" about?

1) For the most part. Still a little bit tough when things are combined together e.g. if statements inside while loops

2) Yes, for basic Java. Classes and objects are still a little bit hard.

What advice do you have to help other beginners learn programming?

1) Don't be afraid, practice, go over lecture notes

2) Don't get overwhelmed even though everything looks scary at first, make small programs to practice concepts

I was a bit surprised with these responses, probably because it's been so long since I've been a beginner first learning how to code. Personally, I forget that code can seem overwhelming, and I think it's really good advice for educators to keep in mind when working with students.

.

The Clock Problem

July 23, 2019 (last updated August 13, 2023)

Have you ever wondered when the hands of a clock overlap so that they're exactly on top of each other? Me too! (Wait, did you say no? I mean, me neither!)

It's very tempting to say that the hands overlap at `1:05`, `2:10`, `3:15`, ... and so on. But if you think about it, the hands aren't going to overlap exactly at, say, `10:50` because the hour hand would be closer to the `11` at this time. So does this mean they actually don't overlap exactly at `1:05`, `2:10`, `3:15`, ... ?

Let's set up the problem more formally and start with an example. Assuming the hands move smoothly and continuously, if we begin at `12:00`, when's the next time the hour and minute hands will overlap?

It will be easier to think about this problem in terms of angles. The hands will overlap if the angle between the hour hand and the `12:00` point is the same as the angle between the minute hand and the `12:00` point. Because the angle varies depending on how many minutes have passed, we can represent their angles as functions of time, e.g. `a_h(t)` and `a_m(t)` where `t` is the number of minutes after `12:00`.

So this means we're looking for a `t` such that `a_h(t)` = `a_m(t)`. In words, we're looking for the number of minutes that will go by until the angle between the hour hand with the `12:00` point is equal to the angle between the minute hand and the `12:00` point.

Instead of using typical angle measurements (degrees, radians, etc.), we'll define an angle to be the proportion of the clock from the clock hand to the `12:00` point. The minute hand makes one full revolution around the clock in `60` minutes. Which means after `t` minutes, the minute hand will travel a distance of `t/60`. So `a_m(t) = t/60` is the function that represents the angle between the minute hand and the `12:00` point after `t` minutes.

The hour hand makes one full revolution around the clock in `720` minutes (It takes `60` minutes to reach an hour; since there are `12` hours, it will take `60*12 = 720` minutes.) So `a_h(t) = t/720` is the function that represents the angle between the hour hand and the `12:00` point after `t` minutes.

Now that we know what `a_h(t)` and `a_m(t)` are, we can set them equal to each other and get our answer. Well, not quite.

If the clock hands start out overlapping, then it takes at least `60` minutes for them to overlap again. The minute hand needs to go around the clock once to reach the hour hand again. That means we need to know how many minutes it takes for the angles to be equal after the minute hand has gone around the clock once. This can be represented by `a_h(t) + 1/12 = a_m(t)`. The `1/12` comes from the fact that the hour hand travels a distance of `1/12` in one hour, the time it takes the minute hand to go around the clock once.

Solving for `t`, we get:

`a_h(t) + 1/12 = a_m(t)`

`t/720 + 1/12 = t/60`

`1/12 = t/60-t/720`

`(11t)/720 = 1/12`

`11t = 60`

`t = 60/11`

So after `60/11` minutes, or about `5` minutes and `27` seconds, the hands will overlap at `1:05:27`.

To generalize this for the `n^(th)` time the hands overlap, we need to recognize that this means the minute hand needs to go around the clock `n` times. So the generalized equation is `a_h(t) + n/12 = a_m(t)`.

For `n = 2`, the hands will overlap at `2:10:55`.

For `n = 10`, the hands will overlap at `10:54:33`.

For `n = 11`, the hands will overlap at `12:00`.

This leads to another interesting result: the hands of a clock overlap only `11` times in a `12`-hour period.

.

Infinity

July 11, 2019

"what else is a loop but a way of representing an endless process in a finite way?"

- Douglas Hofstadter

.

MATLAB as a First Programming Language

July 10, 2019

Java. C. C++. Python. Javascript. Those who taught themselves computer programming likely wondered which programming language to learn first. Those who are looking to teach themselves computer programming are likely asking the same thing.

What's interesting is that among all the names of languages that get thrown out there, MATLAB isn't one of them. Well, as it's pretty much only used in the engineering fields, maybe it's not so surprising.

MATLAB is pretty different from the other "conventional" languages (like the ones mentioned above). Those differences, however, kind of make MATLAB a nice first language to learn.

In MATLAB, indices start at 1. So if we have vec = [5,4,7], vec(1) would be equal to 5. And the third element would be vec(3). Using 1-based indexing makes accessing elements in vectors/arrays/lists more intuitive. It's a bit weird to beginning programmers to access the second element by vec(1), where the index doesn't match the position you're looking for.

In MATLAB, function headers are defined as: function [output] = functionName(input). Having the variable for the return value in the header makes it a bit clearer the function is going to "return" the output value. It's easier to see this in MATLAB than it is in Java (public int functionName()) or even Python (def functionName:). I would even argue that it makes the concept of return clearer.

.

Closest Point

May 12, 2019

So you have a set of equally-spaced points. The task is to find the `2` closest points to any random point that's given to you. For notation, let `h` be the space between `2` points and let `z` be the random point.

For example, you could have a set of `5` points with a difference of `h = 2` between each point: `{2, 4, 6, 8, 10}`. The closest points to `z = 7` would be `6` and `8`.

For another example, you could have a set of `6` points with a difference of `h = 3` between each point: `{0, 3, 6, 9, 12, 15}`. The closest points to `z = 11` would be `9` and `12`.

(Imagine you have a set of `100` equally-spaced points from `-pi` to `pi` and you want to find the closest points to `z`.)

Solution:

To do this, we could do `z - (z text( mod ) h)` to get the left point, and then add `h` to get the right point.

`7 - (7 text( mod ) 2) = 7 - (1) = 6`

`6 + 2 = 8`

`11 - (11 text( mod ) 3) = 11 - (2) = 9`

`9 + 3 = 12`

In the case of the second example, what we're doing is counting by `3` until we reach `11`. `3` doesn't divide into `11` evenly, so there's going to be some remainder. This is why we subtract off the remainder from `11` to find out what the closest point was that was evenly divisible by `3`.

.

If Then If Then

April 28, 2019

If `f` is a differentiable function and `f'(x_0) lt 0`, then there exists some number `r gt 0` so that if `x` is in `[x_0, x_0+r]`, then `f(x) lt f(x_0)`.

For the longest time, I had trouble wrapping my head around proving a statement of the form "If _, then if _, then _." Naturally, I thought you had to assume the green part was true and show that the blue part was true.

If `f` is a differentiable function and `f'(x_0) lt 0`, then there exists some number `r gt 0` so that if `x` is in `[x_0, x_0+r]`, then `f(x) lt f(x_0)`.

It's not really intuitive to assume the green and blue statements are true (and then assume the red part is true and show that the purple part is true) because that's not typically what you do with if-then statements.

But then it all made sense when I said, "If I'm right, then [there exists a possibility so that] if I do this, then it should work."

.

Fair Rations

April 14, 2019 (last updated on April 15, 2019)
HackerRank link

So there is a line of people who are getting bread. Some of them may or may not already have bread. When you give a loaf of bread to Person A, you also have to give a loaf either to the person directly in front of or directly behind Person A. The task is to find the lowest number of loaves you have to give out so that everyone in line has an even amount of loaves. (Or determine if it's not possible.)

For example, we could have `2`-`5`-`7`, which means that the first person has `2` loaves, the second person has `5` loaves, and the third person has `7` loaves. We could give out `1` loaf of bread to the second person and `1` loaf of bread to the person behind, which is the third person. Then it becomes `2`-`6`-`8`. Everyone has an even number of loaves, and we had to distribute `2` loaves to get there.

Solution:

The brute force solution might involve checking how many loaves each person has every time we give out loaves. But it turns out that we don't even need to know how many loaves each person has.

Instead of looking at how to actually solve this problem, I want to look at knowing when it is impossible to distribute loaves such that everyone has an even amount. That is, it might be possible that no matter how many loaves we give out, there will always be at least one person with an odd number.

It will be impossible for everyone to have an even number in this case: `2`-`3`-`2`. But not in this case: `5`-`2`-`3`-`2`. Why is that?

Let's look at the total number of loaves that people already have in each case. `7` and `12`. Since this problem deals with even and odd, let's look at those numbers that way. `7` is odd and `12` is even. So it looks like it won't work if the total number of loaves is odd, and it will work if the total number of loaves is even?

Yes, that is actually true. But why?

Let's start with `2`-`3`-`2` and reorganize it so that the people with an even number of loaves are on the left and the people with an odd number of loaves are on the right. `2`-`2`-`3`. We're not going to give loaves to the first or second person because they already have an even number of loaves. So let's give a loaf to the third person. According to the rules, this means we also have to give one to the second person (the person directly in front). `2`-`3`-`4`. Reorganizing the line again, we get `2`-`4`-`3`. We end up with one person with an odd number again. And this will continue forever, because adding `1` to an even number will result in an odd number (and there will always be an even number to add `1` to because adding `1` to an odd number results in an even number).

Now let's look at `5`-`2`-`3`-`2` and reorganize that. `2`-`2`-`3`-`5`. Giving loaves to the third and fourth person, we end up with `2`-`2`-`4`-`6`. Everyone has an even number of loaves, so we're done.

Generalizing this, we can pair up odd numbers so that when we give each person in a pair one loaf, they turn into even numbers. If there are an even amount of odd numbers, then every odd number will have a partner and each one will turn into an even number. If there are an odd amount of odd numbers, then pairing them up will always result in one odd number left without a partner. So it will be impossible for everyone to have an even number of loaves.

It also turns out that adding even numbers with an even amount of odd numbers results in an even number. Adding even numbers with an odd amount of odd numbers results in an odd number. This is why we can distribute loaves if the total number is even, and we can't when the total number is odd.

.

Manasa and Stones

April 14, 2019 (last updated on August 13, 2023)
HackerRank link

So there are a number of stones on a path that are numbered starting from 0. Each consecutive stone differs by one of two values. The task is to find out all the numbers the last stone could have.

For example, we could have: 0 `->` 2 `->` 11 `->` 13. The difference between each consecutive stone is either 2 or 9. Assuming there are a total of 4 stones, all the possible numbers the last stone could have are 6, 13, 20, 27. Example paths to get these are:

  • 0 `->` 2 `->` 4 `->` 6
  • 0 `->` 2 `->` 11 `->` 13
  • 0 `->` 9 `->` 18 `->` 20
  • 0 `->` 9 `->` 18 `->` 27

Solution:

The brute force solution is to generate all the possible paths and then find the last number in each path.

How could we do better? Well, we know that one possible path is where the differences between each stone are all 2s. So the last stone would be 6.

0 `obrace(rarr)^2` 2 `obrace(rarr)^2` 4 `obrace(rarr)^2` 6

Another possible path is where the differences are all 9s. So the last stone would be a 27.

0 `obrace(rarr)^9` 9 `obrace(rarr)^9` 18 `obrace(rarr)^9` 27

So now the only options left are situations where [two differences are 2s and one difference is 9] and [two differences are 9s and one difference is 2]. (However, this doesn't mean that there are 2 paths left. There are actually 6 paths left because we don't know which stones have the difference of 2 and which stones have the difference of 9. For example, the differences could go `obrace(rarr)^2,obrace(rarr)^2,obrace(rarr)^9` or `obrace(rarr)^2,obrace(rarr)^9,obrace(rarr)^2` or `obrace(rarr)^9,obrace(rarr)^2,obrace(rarr)^2`.)

So how do we generalize this? First, notice that there are 3 differences between 4 stones. Generally, there are `n-1` differences between `n` stones. Second, recall how we generated the first two paths: considering the situation where all the differences were the same. This is the same as multiplying the first difference `n-1` times to get the first path and multiplying the second difference `n-1` times to get the second path. This makes sense because if there are `n-1` differences and each difference is the same number, then the last number is the result of multiplying the difference by the number of differences (`n-1`).

0 `obrace(rarr)^2` 2 `obrace(rarr)^2` 4 `obrace(rarr)^2` 6

`2*3=6`

Third, note that paths with differences like `obrace(rarr)^2,obrace(rarr)^2,obrace(rarr)^9`, `obrace(rarr)^2,obrace(rarr)^9,obrace(rarr)^2`, and `obrace(rarr)^9,obrace(rarr)^2,obrace(rarr)^2` all result in the last stone having the same number.

0 `obrace(rarr)^2` 2 `obrace(rarr)^2` 4 `obrace(rarr)^9` 13

0 `obrace(rarr)^2` 2 `obrace(rarr)^9` 11 `obrace(rarr)^2` 13

0 `obrace(rarr)^9` 9 `obrace(rarr)^2` 11 `obrace(rarr)^2` 13

This is because we're essentially adding all the possible combinations of 2s and 9s to get the last stone. Addition is commutative, meaning we can switch the order of the numbers and still get the same result. Recognizing this is crucial because this means we don't have to waste time generating paths that will give us the same result anyway.

Combining these three points give us the following approach to solving the problem:

In words, we're considering all the possible combination of 2s and 9s for 3 differences (4 stones means there are 3 differences.)

In general, this algorithm considers all possible combinations of differences. Combinations because order doesn't matter.

Note: There are `2^(n-1)` total possible paths (`n-1` differences, `2` choices for each difference). If `n` is really big (i.e. there are a lot of stones) then the brute force approach would take a really long time. Also recall that some of those paths resulted in the same answer for the last stone, so it's also inefficient.

Second note: It's also no coincidence that there is a pattern in the last number of the last stone. Notice how each last number differs by 7 (e.g. `6 + 7 = 13`, `13 + 7 = 20`), which also happens to be the difference between the differences 2 and 9 (i.e. `9 - 2 = 7`). This is because, as we're going down the table, we taking away a 2 and adding a 9 (i.e. doing `9 - 2`), resulting in adding a 7.

Third note: I believe the number of stones always equals the number of unique last numbers, simply because there are `n` numbers between 0 and `n-1`. (We're trying to find the last stone when there are 0 differences of 9, 1 difference of 9, 2 differences of 9, ..., `n-1` differences of 9.)

`2+sum_(k=1)^(n-2)(((n-1),(k)))/(n-1)=n`

I'll be convinced if this equation is true. Unless my equation is wrong.

.

Flatland Space Stations

April 13, 2019
HackerRank link

So there are some cities and some space stations on a route. For simplicity, they can be thought of as being lined up in a straight line, so that when you walk on that line, you will walk through a city or a space station. And every city and space station are 1 km apart from each other. The task is to find the longest distance between a city to the nearest space station.

Solution:

The brute force solution is to find the distance between every city and the nearest space station to it.

How could we do better? We could get a better solution by observing the position of a city that would be at the farthest distance from the nearest space station. Let's suppose we're placing a city between two space stations such that it results in the longest distance possible to the nearest space station. We can't place it near the space stations because the farthest distance to the nearest space station would be really small. So we should put it somewhere in the middle of the two space stations.

Let's consider placing it directly in the middle of the two space stations then. This means that the distance to one space station is exactly the same as the distance to the other space station. Moving it a little bit to the left or right makes it closer to a space station (and thus it's no longer at the farthest distance possible).

This suggests that the farthest distance a city can be from any two space stations is half of the distance between the two space stations. So instead of looking at the distance from every city, we look at the distance from every two space stations and calculate the distance to their midpoint. The largest distance from doing that should be the farthest distance from any city to the nearest space station. (Notice that this supports the situation in the first picture. Also notice that this works even if there an even number of cities between two space stations.)

There are edge cases, but this is the main idea.

.

Mnemonic Devices

April 10, 2019 (last updated on April 15, 2019)

IHMDIM. I hate mnemonic devices in math. Well, actually, hate is a bit strong. I guess "dislike" is a more appropriate word.

(Here, I define a mnemonic as a series of steps, a shortcut, or a memorization technique.)

I don't dislike all math mnemonics. The only ones (I can think of at the moment) that I'm okay with are:

  • PEMDAS
  • SOAP
  • FOIL
  • the quadratic formula
  • SOHCAHTOA

My dislike for mnemonics is guided by my idea of what it means to truly understand math (or at least whatever you're learning): understanding the intuition/reason behind why things are done.

Mnemonics are hard to remember (at the moment and/or in the future).

Some of us were taught how to factor quadratic polynomials using an "x". Well, what numbers go where in the "x"? It's hard to remember because there is no intuitive reason behind where the numbers go. Also, nothing about an "x" suggests what should be done with the numbers. It's just a specific series of steps that we were taught to memorize. And because they're so specific, we forget them once we stop working with them.

It's much easier to know how to factor polynomials if we understand that the resulting product has to multiply to the original polynomial. From there, we can come up with a method for factoring.

Mnemonics abstract away what is going on underneath.

Some of us were taught that we could find the roots of a polynomial by "switching the signs." You know, if there's an `(x-3)`, then a root is going to be `(3,0)` because we changed the negative to a positive. Of course, this isn't the only way that's taught, but it is a shortcut that is introduced, which we come to rely on because, well, it's a shortcut. Since this shortcut doesn't always work (for something like `(2x—3)` for example), we forget how to find roots for more complicated situations.

This hides the fact that roots are solutions to the equation `f(x) = 0` where `f(x)` is a polynomial. Roots are inputs that result in an output of `0`. Which is why they're sometimes also called "zeros". Understanding this makes it easier to remember that we should set each quantity of a factored polynomial equal to `0`.

Some of us were taught about solving for `x` when there were fractions involved by doing cross multiplication. Now, cross multiplication is fairly easy to remember (because it's in the name), but it is hiding the fact that what we're really doing is multiplying both sides by each denominator, canceling them out.

Mnemonics lead to situations where we explain how to solve problems by saying "because that's how we do (insert mnemonic device here)." But we don't solve problems by doing what we've memorized. We solve problems by looking at what we have and using what we know to get to a solution. And part of that is understanding what the problem really is.

So why do I not dislike the mnemonics I mentioned earlier?

  • PEMDAS is a defined set of rules. Since they're defined, they're not abstracting away anything. And the order of the letters is intuitive: they (mostly) represent the order of the operations that we should perform.

  • With SOAP, it just saves a lot of time finding the factored form of a difference of cubes. Trying to derive that form — although it would be interesting to do so — is time-consuming to do every time.

  • FOIL is barely hanging on to this list. I believe that FOIL is abstracting away the actual process of multiplying quantities (treating a group of terms as one quantity and distributing that to each term). But thinking abstractly like this is on another level that high school students usually don't need. So FOIL just makes things easier.

  • Like with SOAP, the quadratic formula saves time trying to derive `x` each time. Again, it's interesting to do so, but it's too time-consuming to do every time.

  • SOHCAHTOA is a set of definitions. Not abstracting anything here either.

As much as I dislike mnemonics, a recent interaction with a teacher has changed my perspective on this. It seems that mnemonics are easier for students to understand. Wait, let me rephrase that so it's more enlightening: intuitive reasoning is generally harder for students to understand (in the time frame with which teachers have to work). My guess is that students have grown up thinking that math is about solving a bunch of problems by performing a specific sequence of steps that the teacher wants them to do. Whatever the case may be, I'll definitely have to rethink my approach to helping students.

Do you remember what letters I used in the beginning of this post and how many there were? (If you do, then forget them so I can prove a point.) Will you remember them years from now? (There's no reason to, but humor me.) Would it be easier to remember them by memorizing the letters themselves, or by understanding the meaning of my message?

P.S. I guess IAMDIM would've been much easier to remember, but who uses "abhor" anyway?

.

Recursion as Settings

March 10, 2019

With all the stack frames to keep track of, recursion gets a little bit tricky. One confusion with recursion is where the program continues executing after a recursive call. Does it go back to the place where the previous recursive call was made? Does it go back to the first place where the recursive call was made? Does it go back to main?

Figuring out where the program continues executing after a recursive call can be compared to navigating the "Settings" section of your phone.

On Android, you can do "Settings" -> "About phone" -> "Status".

On iOS, you can do "Settings" -> "General" -> "About".

When you're on "Status" or "About" and you press back, you would expect to go to the previous page from which you came (either "About phone" or "General"). You wouldn't press back and go to the very first page ("Settings").

The same applies to recursion. You go back to the recursive call from which you came (which is going to be the most recent call).

.

Students as Processors

March 5, 2019

Computer processors are like students. Processes (e.g. interacting in web browsers, playing Spotify) are to processors what classes are to students. Computer processors don't run every single application that's open on your computer all at the same time, just like students aren't focused on all their classes at the same time (For example, students aren't simultaneously finishing their math homework while writing an essay.) A computer processor constantly switches back and forth between each application, giving each application a little chunk of time. A student switches their focus from one class to another, giving each class a little chunk of time. The only difference is that processors switch between processes so quickly, they give the illusion that all the processes are running simultaneously.

Let's ignore the whole multiple-core idea just to make this analogy work. Even then, it can be true if there are enough processes running.

.

Practical Romantic

March 3, 2019

I keep thinking about her every day. Every waking moment of my life. Even when I don't see her, she's there. Even when she's not there, her presence is looming over me. I can't do anything without her somehow crossing my mind. I can't go anywhere without thinking that I'll run into her.

I keep looking for signs that aren't there. Signs that seem to confirm my fears when I'm feeling low. Signs that give me hope when I'm feeling like myself. Signs that make me come to the realization about who I really am. Signs that make me come to the realization that others see me in a way I don't see myself.

I don't know how other people do it. So seemingly easily and effortlessly. Countless times, I've thought about confronting her. Countless times, I've given up at the last minute. There are so many things that could go wrong. There are so many what if's waiting to be answered.

I've never really dealt with something like this before. I've experienced it in the past, but it has never made me feel what I'm feeling right now. Somehow I was always able to ignore it. Or run away from it. Perhaps those weren't the best choices to make.

But this time will be different. I can't keep going on believing that things will work out the way I want them to. I have to change. I promise that I will go up to her. I promise that I won't back out at the last minute. I promise that I'll take the chance with her. If things don't work out, then at least I could say I tried.

Oh, have I told you her name? Her name is Insecurity.

Binary Search

February 28, 2019

Start with search space, `n`

Keep dividing it by `2`

End up with one left

.

Coding on a Chromebook

February 19, 2019

Here's the TLDR: Coding on a Chromebook (using crouton) is possible and sometimes convenient, but not really practical or efficient given its limitations — namely, its slow processor.

Note: To put this in perspective, I've had my Chromebook for about 7 months now.

I hated carrying around my heavy 15-inch laptop everywhere, so I bought a cheap, lightweight Chromebook as a secondary machine. Because I was heavily maintaining this website at the time, I was looking to use my Chromebook more for web development than for hard-core programming (e.g. compiling Java programs).

Based on several online resources, the most popular option for coding seemed to be installing crouton. (Well, using online cloud platforms was pretty popular too, but I wanted to do all coding offline. Also, wiping ChromeOS and replacing it with Linux was an option, but I wanted to keep ChromeOS.) Basically, crouton is like a program that allows you to run Linux alongside ChromeOS. It's like being able to run Windows and MacOS on one machine at the same time. This was the best solution for me since it kept the speed and stability of ChromeOS with the coding-friendliness of Linux. The biggest problem with crouton is that you have to put the Chromebook in developer mode, which compromises security. I didn't care.

crouton is pretty easy to install, but this is an opinion coming from someone who has (very) basic scripting knowledge and familiarity with the Linux environment. I imagine it's a bit overwhelming and scary for those who don't.

I tried Ubuntu with Unity and Ubuntu with Xfce and went with Xfce (Unity wouldn't run on my Chromebook.) I never encountered any problems switching from ChromeOS to Linux, but it wasn't as seamless as I thought it would be. You have to press like 4 buttons at the same time and wait a few seconds for it to switch.

After doing the classic sudo apt-get update and sudo apt-get upgrade, I installed Visual Studio Code, which was really the only thing I needed that I couldn't get on ChromeOS. What I like — and sometimes dislike — about Visual Studio Code is that it auto-closes HTML tags, something I didn't get out-of-the-box with Vim, Atom, Sublime, or Notepad++. (We could get into this whole thing about using Markdown or whatever, but I didn't know about that at the time.) However, I wasn't able to conveniently take advantage of auto-closing tags because I would have to wait a few seconds for it to happen, which was simply too long.

At the time, I was typing up my math notes onto my website. I used MathJax to render math symbols and equations. Here's the thing: typing up notes for a whole math course leads to a lot of math symbols. Every time I wanted to test my changes, I would have to refresh the page and wait a full minute for the symbols to fully render.

Another slight inconvenience was the lack of home and end keys, which I often use to quickly navigate to the start or end of a line. A workaround for that is using the shift key though. One more slight keyboard inconvenience was the lack of a numpad, which prevented me from typing alt-codes. I also thought having no caps-lock button would bother me, but it never did.

Recently, another option to code on a Chromebook appeared in the form of Crostini, which allows you to run Linux apps on ChromeOS, meaning you don't have to install Linux to run apps like Visual Studio Code, Android Studio, and Gimp. I personally like this option the best.

Conclusion: Getting a Chromebook for coding is a good option if you're out a lot and/or you don't want to spend a lot of money on a laptop. It can handle running a Linux environment just fine. The dealbreaker is speed and (maybe) storage space.

.

Hyphen (-)

February 7, 2019

used to connect words

adjectives in front of nouns

written-out numbers

.

En Dash (–)

February 7, 2019

a range of numbers

or a connection, such as

"a north–south highway"

.

Em Dash (—)

February 7, 2019

break or pause; used like

parenthesis or commas

but more emphasis

.

Observations as an Instructor Aide for a Beginning iOS Class

February 2, 2019

I'm currently an instructor aide for a beginning iOS programming class. It is a very hands-on class where the instructor projects his code onto a large screen and the students follow along on their computers. It is also an interesting class because the students start typing lines of code before learning the fundamentals of coding, like variables, loops, and functions. Here are my observations — in light of the aforementioned situation — from working with students with no prior programming experience.

Some students:

  • Worry about making sure line numbers match with the instructor's
  • Mistakenly type code outside of functions (sometimes as a result with trying to match line numbers)
  • Don't close opening curly braces
  • Don't put opening curly braces after an if statement
  • Are not experienced with typing on a keyboard (and, as a result, fall behind)
  • Misspell variable names without realizing and run into uninitialized variables when copying the instructor's code
  • Copy the instructor's comments verbatim without realizing that comments aren't code

Sometimes I:

  • Tend to give nonspecific instructions like "Do this" or "Can you go (move your mouse) over here?" instead of "Can you resize the window so we can see the error message?"

.

Writing Math Notes

January 30, 2019

This idea came to my mind as I observed a student trying to understand how to add fractions. She had all the steps written out — namely, multiplying the numerator and denominator by a factor of the LCD. She had the steps in her notes; she had the steps on her homework. But she didn't understand why we were doing that step.

She raised her hand twice throughout the lesson to ask about it. Of course, asking questions is a good thing, but the fact that she asked about the same thing twice made me wonder if she was retaining the information. Now, adding fractions isn't always an easy thing to do, so it's expected to take some time to understand.

What I was wondering though, was if she had written out the reason in words in her notes, would she have understood it better?

Many students in a math class are likely to take notes by copying verbatim (is there a word for copying "number for number"?) whatever is on the board. As a result, notes end up being pages full of numbers. Looking back at pages of numbers is kinda hard to understand, especially weeks or months after taking those notes. Also, teachers tend to verbally explain things while writing, but the verbal explanation doesn't make it to the board. They'll say, "We can only add fractions if the denominators are the same" without writing that. As a result, students won't write down that important piece of information. Looking back at notes and seeing a bunch of steps and numbers doesn't automatically reflect "making the denominators the same". "Wait, why did we multiply by 5?", "We went from this step to this step, but I don't remember why."

Moreover, if students are doing in-class problems in their notes and they make a mistake, they're likely to just cross it out and write the correct step(s). They might figure out where/why they went wrong at that moment, but forget weeks or months later. Looking back at just some steps crossed out next to the correct steps doesn't immediately remind them of what misconception they were holding on to.

What I imagine would help — and have recently found helpful for me — is taking notes in both numbers and words. Copying down the steps, and writing down the teacher's verbal justification for each step.

"Adding fractions needs same denominators. Find LCD so they have same denominators"

"IMPORTANT: do PEMDAS inside parentheses"

"Multiplying fractions: multiply across"

I'm also seeing open-notes tests slowly becoming a thing. Having those words written out — especially colored or in big letters — makes looking through notes much faster. It's easy to remember to make the denominators the same when adding fractions if you read it rather than studying numbers carefully to deduce that.

They say writing things out helps with retention. I think it's better to remember words than it is to remember a bunch of numbers.

P.S. Unless those numbers are digits of pi.

.

2 Mod 3

January 29, 2019

Why is 2 % 3 (2 mod 3) = 2? I easily knew 4 % 3 = 1 when I first started learning programming. I remember asking a friend about it, but he wasn't exactly sure either. He did tell me, "I guess if the number on the left is smaller, then it's just equal to that number." I definitely use that shortcut whenever I encounter modulus problems. But I don't think that explanation flies with people who really want to know why 2 % 3 = 2.

My explanation?

There's something about dividing a smaller number by a larger number to get a fraction that seems to trip up some students.

.

I Think

January 27, 2019

We're told by teachers — or at least I was — that using the phrase "I think" or "I believe" or any other variant of that in our writing is pointless. "I think that schools should start later." Of course you think that, you wrote it on your paper! You don't have to say "I think"; the paper's written by you, so we're gonna assume that that's what you believe!

I see how that makes sense, especially for papers with word limits. But I think (hah!) that sometimes not saying "I think" removes the personal touch. Cuz sometimes I want to state something that I think, but I don't want it to sound like I'm an expert or anything. "I think bilingual education is good." vs. "Bilingual education is good." See what I mean? Well, anyway, that's what I think.

.

Locking a Bike

January 25, 2019

And this is why you lock the wheel AND the frame.

.

Emptying the Cup

November 13, 2018

"M! You're trying to sleep right now? I swear, I see you sleep in sixth period all the time.", exclaimed K.

Wait what's your sixth period?", I asked.

"Physics. Like, literally, he just has his head down and sleeps through the whole class."

"Hey, physics is hard, man. I don't understand anything in that class.", replied M.

"Yeah, physics is hard. I dropped out of that class when I took it."

"Really? You think physics is hard?" M was doubtful or relieved. Or a bit of both.

"Yeah."

"Do you have any advice for me?"

"Advice about what?"

"Advice for physics."

"You just gotta memorize all the formulas.", said G.

"Yeah, physics is a lot of math.", I said.

"It is! And I'm not that good at math.", said M.

"Well, my advice to you is to go ask your teacher for help. Like during lunch or afterschool or something. Just go into his room and ask him for help."

"But I don't wanna go in there and have it be all like, 'What do you need help with?' 'Everything!'"

"Yeah, that's why you go now. You start early so he doesn't have to go through so much."

"Ok, I'll try going early. I'm not good at school. I don't know what I want to do with my life."

"Well, what do you like to do at home?"

"Sleep!"

"Ok, what about when you're not sleeping?"

"Play video games."

"What video games do you play?"

"Fortnite."

"Hey, I used to play Fortnite too."

"But then you had to focus on life and stuff, huh?"

"Yeah. That and I wasn't that great at it."

"Yeah, see. I still don't know what to do in the future."

"What subjects do you like then? Like, English or history?"

"I don't really like anything. It's just easy or hard. That's it. Like, I don't like English, but it's easy. I don't think anyone likes any subject."

"I like math.", said G.

"Really? You like math? You use it at home?" M was skeptical. Admittedly, I was a bit too at first, but still ready to make a case for G.

"Yeah, I use it all the time when I draw. Like, I just keep drawing patterns and measuring stuff. It's all patterns."

"I like the way you put it.", said M.

"Yeah, I want to go into art when I grow up."

"You know, I put this all on myself. I'm the one that cares about doing good in school. Like, not even my parents care."

"They actually tell you they don't care? Or you can tell that they don't care?", I asked.

"I can tell they don't care. They don't tell me to do good in school. They just be like, 'just do yo thing'."

"Well, why do you care about doing good in school?"

"Because I don't want to be messed up, you know? Like, work hard now so I can relax later, you know?"

.

Barnga

November 10, 2018

He stared at the door. The door stared back at him. He put his hand on the handle. Then he took it off. He wasn't nervous before, but being one step away brought the reality of it all back to him. One step away from a totally new world. At that moment, he wished he was home. Not just his apartment several miles away. But back home. Where the smell of his favorite foods was always in the air. Where all his favorite places were just around the corner. Where all the people he saw were familiar faces. Where he felt at home.

He put his hand on the handle once again and slowly pushed the door forward.

All eyes turned on him. Their paralyzing stares held him in place. In an attempt to avoid them, he looked around the room, darting his eyes back and forth, focusing on nothing in particular. As long as he couldn't see their eyes drilling into him, he felt a bit calmer. A bit less alien. He didn't know where to go though, so he stood there fixed in place until he saw the teacher motion for him to take a seat in an empty chair. He sat down. On his left, a student turned to him and acknowledged him with a simple "hey". He didn't understand but smiled back politely anyway.

Before he could adjust to his new surroundings, the teacher continued talking. He didn't understand, but smiled back politely whenever the teacher looked his way. For a brief minute, he finally felt comfortable. Now that he was where he was supposed to be, he could focus on moving forward. But the brief comfort gave way to worry. What happens now? What's supposed to happen? What do I do next?

He didn't know the rules. Was he allowed to raise his hand for assistance? Judging by everyone's silence, he probably wasn't allowed to talk. Which was probably a good thing since he didn't know what to say anyway.

All of a sudden, the teacher stopped talking. He looked around and saw several hands go up. Was he supposed to raise his hand too? One student spoke and the teacher smiled and nodded, seemingly in agreement and approval. What did she say? What did the teacher ask? He felt his face getting warmer. What if he was the only one who didn't know the answer?

The anxiety. The confusion. The embarrassment. The swirl of emotions rushing through his head and chest made him feel sick inside. He couldn't take it anymore. Without warning, he jumped out of his seat and ran out of the classroom. He didn't know where he was running to, but he just wanted to get as far away from the classroom as possible. The tears forming in his eyes made it hard for him to see. He turned a corner and crashed into someone. Quickly, he got up and started apologizing repeatedly. He didn't stop to think that the person probably wouldn't understand him. He just kept apologizing.

"Stop it already. I'm fine. How about you, are you ok?"

He didn't answer. Not because he didn't understand what he was saying. But because he actually understood what he was saying. It was the first time he heard someone speak his language since coming to school. Wiping away the tears from his eyes, he smiled at him and said, "Yeah, everything's ok now."

.

Language Barriers

October 26, 2018

(Note: I use double quotes for thoughts and spoken words and single quotes for written and typed words.)

Today was the first time I truly met a student dealing with a language barrier. It was interesting, to say the least.

I knew that being in a community where the minorities were a majority meant that English might not have been some students' first language. But that had never seemed to be a major problem for me or the students before. Admittedly, I tend to assume every student can speak and understand English enough to learn the material.

2nd period started with the teacher handing out to each student a paper with grid coordinates on it and a line. Their task: find the slope of the line and draw a line with slope `2/5`. I walked around the room, looking at how students solved the problem. Most were drawing horizontal and vertical lines from one point on the line to another point on the line. Some correctly concluded that the slope was `3/1` or `3`. Others mixed up the definition of slope and got `1/3`. One student's paper caught my eye in particular. She had drawn two triangles, but it wasn't apparent what they were for or what they were measuring. Just two arbitrary triangles on the line. At first I thought, "Wow, I've never seen anyone solve for slope like this."

When the students were done, they went to the back of the classroom and put their paper in one of three boxes. One was labeled: 'I understand the material and could teach it to someone else'. Most of the students who finished early put their papers in this box. Most of them were right. The second box was labeled something along the lines of: 'I almost understand the material, but I'm still a little fuzzy'. Some of the papers in this box were right. The third box was labeled: 'I don't understand the material'. This box had the fewest papers. When I looked at the top one, the paper turned out to be the one with the two triangles. Maybe she didn't know what the triangles were for either.

After this, the teacher had students get laptops. I wasn't sure what they needed them for. I didn't really pay too much attention to it. Some time later, the teachers paired up students to work with each other on the slope problem they were doing earlier. The students who got the correct answer got matched with those who got the wrong answer. The students who got the correct answer were leaders who helped their partner by asking guided questions to help them think about how to solve the problem.

In my casual stroll around the room, I ended up near the student who had drawn triangles. Sitting around her were two other girls, who appeared to be trying to help her. I walked closer to them to observe. I looked at the laptop in front of them, and it was open to Google Translate. What was more shocking was the language they were translating to. 'What is the slope of the line?' translated into a collection of swirly symbols I had never seen before. That's when I realized the student who had drawn triangles — the student who had put her paper in the 'I don't understand the material' box — didn't understand English.

I watched in awe as the girls tried to get her to copy one of their papers to show her how to do the problem. The magnitude of the situation was overwhelming. She doesn't understand what the teacher and her classmates are saying, and there's nobody around who spoke Amharic.

Unfortunately, the girls' efforts weren't successful. When the teacher decided to move on, I asked if I could work with her individually. Upon his approval, I sat down next to her and opened up Google Translate on my phone.

Before, when I was watching the girls help her, I had a suspicion that she didn't know what a line was, which was pretty important because the definition of slope — as they were taught — is vertical length / horizontal length. I typed into Google Translate: 'Do you know what a line is?'. She shook her head. I drew a line on her paper. "This is a line". Repeating the pencil motion, I repeated, "line". Softly, she repeated, "line". 'Can you draw a line?'. She drew a line on her paper just as I had.

"How long is the line?". She looked at me blankly. 'How long is the line?'. Still no response. I drew two points on the line and told her that it was "`1`". I drew another point and asked her again. "`2`". "From here to here?". "`3`". I drew another line. "How long is this line?". 'How long is this line?'. "`4`". "How long is this line?". "`1`".

She now seemed to be able to measure the length of lines. Then I wanted to make sure she understood the concept of horizontal lines and vertical lines. 'Do you know what horizontal means?'. She nodded. 'Do you know what vertical means?'. She nodded again. "What type of line is this? Is it horizontal or vertical?". No response. I asked again, this time moving my pencil in the corresponding motion. "Horizontal? Or vertical?". "Horizontal", she replied softly. I pointed to a vertical line. "Horizontal? Or vertical?". "Vertical".

I moved on to the concept of points. 'Do you know what a point is?'. She shook her head. I drew a point on her paper. "This is a point.". "Point". 'Can you draw a point?'. She successfully drew a dot on the paper. Sliding my finger along the line, I asked, "Can you draw a point on this line?". 'Can you draw a point on this line?'. She drew a (good) point on the line. I was ecstatic. "Can you draw another point on this line?". She then drew a (bad) point on the line. My heart dropped. Well, at least it was on the line. I had absolutely no idea how to explain that the points she should be drawing had to be on the line and where the grid points were.

The teacher then told everyone to pack up. Quickly, I moved back to lines and lengths. "How long is this line?". 'How long is this line?'. "`4`", she said. "Is it horizontal or vertical?". "Vertical". I made the up-down-left-right motion and asked again, "Horizontal or vertical?". "Horizontal". "How long is this line?". "`3`". "Horizontal or vertical?". "Vertical".

With that I ended our little session and she packed up and left. That session was pretty enlightening though. I never realized how hard it was for non-native English speakers to learn. I never realized how hard it was to teach someone who didn't speak English.

.

A Fork in the Hill

October 22, 2018

Imagine you're sledding down a hill with your favorite stuffed tiger. Those familiar with the reference will know that this hill is dangerous. There are many trees and rocks you have to avoid. Being the amazing six-year-old that you are, you manage to avoid them in the beginning. Also, being the philosophical six-year-old that you are, you're probably busy asking your companion deep questions about life. Too busy to notice the ledge. Of course, you fall off of it. And the comic would end with you buried face-flat under the snow and pinning the blame on your tiger.

But I'm not Bill Watterson so this comic takes a different turn.

Somehow, the sled breaks into two when it lands on the ground and you're standing on both pieces, one foot on each side. Then, by some unfortunate phenomenon, the ground below you splits, leaving a giant fissure between your feet.

Now you're speeding down a hill essentially on two different paths. What now?

.

Going off to College

September 29, 2018

The familiar feeling grabs a hold of me. It's the feeling of excitement mixed with longing. It's the feeling of "I can't wait!" and "Just one more week. Please!"

It's like an ocean suddenly in high tide. Without even realizing it, I somehow got dragged so far out. And with every passing second, I end up deeper in the ocean. Exceeding the line of balance between excitement and fear. Excitement because I'm adventurous, but fear because I'm not that great at swimming. So before I'm too deep, I try to swim back to shore. To comfort.

But everytime the waves ebb away, they push me back out. Like I'm not allowed to be where I once was.

Here I am now, stranded out at sea. It's calm and quiet. It's peaceful. Heck, it even smells nice. It'll do. But I know pretty soon, the waves will push me back to shore. It always has.

I guess I better enjoy it while I can. This might be my last time going out to sea.

.

For the Culture

September 23, 2018 (last updated on May 19, 2021)

I like the little intricacies of English like the way someone might go to an art museum just to seem "cultured" rather than for the art itself.

I'll say I like English/grammar/writing, but I'll probably not be able to analyze any piece of writing smartly.

"Let's face it. We're aesthetes." -Calvin

.

I'm Tiled of This

September 10, 2018

So I had to replace some kitchen countertop tiles recently. It was hard, to say the least. Keep in mind that I have no experience whatsoever with stuff like this.

I have no idea when and how that ever happened. To make things worse, I have no idea where the piece went.

For some reason, my mind jumped to making a crescent-shaped piece somehow. It would've been much easier to glue it on than to remove and replace the tiles.

But alas, there were no crescent-shaped tiles.

Yep. By removing one tile, I made the problem worse. The hole — originally spanning across two tiles — now spanned across three tiles. Great. Just great.

Removing one tile was hard enough. I mean, have you ever tried "sawing" through a rock with scissors? I imagine it's probably something like that.

It's also hard mentally as well. It's demoralizing when you're sawing and prying away at a broken tile — which you never broke by the way — only to break pieces off of the perfectly good tiles next to it. Well, then you would have to take off those freshly ruined tiles. And oops. You just inevitably broke more pieces off of more good tiles next to those freshly ruined tiles.

That was the third most satisfying thing to see in this whole experience.

Did you know that it is difficult finding a store that stocks v-cap tiles in the size you need? That was the second most satisfying thing to see.

And that was the most satisfying thing to see.

.

Neither Plural nor Possessive

September 6, 2018

Reading through a somewhat recent email, I came across the word "anyway". The first time I had ever seen it used.

I dismissed it the first time I read it. I really don't know why it didn't sound weird at the time. Anyways. Anyway. It sounds so weird without the 's'.

Well, I just found out that "anyway" is actually correct, making "anyways" incorrect.

Apparently, it's because "anyway" is an adverb, and adverbs can't be plural.

Anyway, it's reminiscent of Kent Davison describing Daylight Saving Time: "It's neither plural nor possessive."

.

Little Steps

September 5, 2018

The bent knees. The pointed toes. The flurry of steps. I didn't like it.

Maybe it's because I didn't like dancing. Well I've never danced before (this class), so I guess I can't really say that.

Maybe it's because dancing is difficult. But then again, everything is difficult in the beginning.

Maybe it's because I was worried about other people's (nonexistent) judgements. Well, that kinda went out the window when I cut my hair the way I did.

Maybe it's because it required a surprisingly good amount of mental energy to do seemingly simple movements. Oh. Yeah. It. Did.

Maybe it's because ... nah, let's just leave it at that.

The forward heels. The arm positions. The flurry of steps. I didn't like it.

At first.

Now: I really enjoyed it.

It was a nice "step" away from STEM classes.

.

A Bit Weird

August 25, 2018

A speck of snow falls from the sky, slowly drifting down towards the earth. It lands on his nose. He's shocked. Then pleasantly surprised. He looks up, expecting more snow flakes. But there are none.

Lately, I've been taking a page out of someone's book and going to restaurants by myself. It feels a bit weird walking into a restaurant alone and seeing families or groups of friends or couples seated at the tables. It feels a bit weird holding up my finger and saying "one" when I'm asked, "How many people?"

I imagine it looks a bit weird to other people too. But I've stopped caring about what other people think of me since I cut my hair.

He brings his hand to his nose and wipes the snowflake off. He looks up at the sky once more, hoping to see more snowflakes. Then he wakes up. Of course it was just a dream. Snow in the summer is just a bit weird.

.

Not a Coincidence

August 9, 2018

I've never really liked driving. Well, it's not the actual act of driving that I don't like. It's being on the road with other drivers. Impatient, easily annoyed, unforgiving. I'm-right-you're-wrong. I guess I'm looking through half-colored glasses whenever I'm on the road. (You decide if they're half-full or half-empty.)

Somewhere else, someone is telling their friend about how they hate cyclists.

Lol.

.

Racketeering

August 6, 2018

I've been coding a lot in Racket lately. Not for ThoughtSTEM, but for my own practice. I've mentioned several times — well, at least once anyways — that functional programming seemed hard to me. I might've also suggested that I didn't like Racket and functional programming.

Well, I suppose you already know what this post is gonna be about.

I've also mentioned before that my mind about functional programming might change. It definitely is a change of pace. And a completely different way of thinking.

The problems I've been solving were intended to be solved primarily in Java. At least, I think so, because they're from a beginner's programming competition at UCSD, and the first language you learn at UCSD is Java.

I haven't done a whole bunch yet, but for most of the problems, I kept thinking about how much easier it would be to do them in an imperative style. (Another reason why I think they're intended to be solved using Java.) If you see a question involving checking whether a string has a character, one of the first thoughts to pop into your mind would probably be creating a simple loop to traverse the string and check each character. Easy-peasy.

It's a bit frustrating when I hit a roadblock and I think, "This would be so much easier with a loop." or "This would be so much easier with variables." But forcing myself to turn away from those has improved my coding skills.

For one, I am much more comfortable with recursion now. For some reason, I used to never be able to wrap my head around (and around and around and around) recursion. I mean, I knew that you needed a base case and a recursive call with a smaller input, but I never knew what to put for the base case and/or input. And the whole "going up the stack" or whatever used to confuse me too. (I was relieved when my professor said that loops are generally preferred over recursion because it's easier to debug a loop.)

Another thing is that the code is more concise. Having outputs of functions be inputs of other functions make for a lot of one-liners. I mean, one-liners aren't necessarily signs of good code, but resorting to higher-level functions (I kinda am referring to higher-order functions and kinda not at the same time) that strip away the details of lower-level stuff, like loops and variable manipulations, sometimes makes code easier to understand than the lower-level code, which become confusing simply because there are so many lines. (E.g. recursively traversing a tree vs. looping through a tree.)

With that said, I still don't see myself switching over to functional programming. It's a little bit like writing in cursive: it's not really done on a large scale (I don't think) and print writing is easier anyways. (Also like functional programming, cursive is arguably the better writing technique but harder to read.) I definitely do see how it works though. A little bit more anyways.

.

Biking with the Prose

August 1, 2018

It never ceases to amaze frustrate me how other cyclists go so much faster than I. (I guess that makes me a conjunctionist?)

Like, I'm going as hard as I possibly can
and they're just relaxing.

Like, my legs are furiously pushing on the pedals
and they're just breezing.

Like, my body is at its wit's (a what? Oh, a wit!) end
and they're just starting.

Like, my full-blown failed attempt to catch up to them
is just their warmup.

Like, I'm using all these words to describe my effort
and they just press .

.

Learning How to Code (Part 2)

July 26, 2018

That's not to say that learning programming languages is pointless. Just that computer science knowledge/expertise shouldn't be measured by the number or popularity of languages one knows. (Except for MATLAB and HTML/CSS. Those aren't "real" programming languages. According to jokes anyways lol.)

Especially with the high school students, most of whom having had significant programming experience (is that grammatically correct? I suspect not.), getting through a module/quest has been very easy because they easily understood what was going on. While one other student has said Racket was easier than imperative programming languages, I think they were getting it not because of the "easiness" of Racket, but because of something else. (I still don't think Racket is easier than imperative programming languages, but that's my heavily biased — and somewhat stubborn — opinion.)

Because of something else. What is that something else? It lies in (one of) the goal(s) of Morugamu, which aims to teach computer science without the computer. It sounds weird, doesn't it? Maybe because learning computer science seems to be associated with learning how to work/talk with computers or knowing how to code in a dozen programming languages. But knowing how to do those things requires something more basic. Ah, there's that "something" again.

Admittedly, I've imagined scenarios involving confused (at the least) parents wondering about why their children weren't learning Python or whatever when Python — or whatever — was in the name of the class. I don't think my answer is better than that of whoever is answering that question.

My response would've been 'something' like, "learning how to code is more about developing logical reasoning skills — and, more generally, developing a programming mindset — than learning a language."

Ah, there's that "something" again.

.

Learning How to Code

July 25, 2018

As it gets further into the week, and ultimately into the summer, my thoughts on learning computer science — and what it actually is — are slowly changing.

When I found out I would be helping out with camps teaching Python and Java and virtual reality and Android apps and web design, I didn't think it would all be done in Racket. I imagine the students didn't think that either. Oh, and their parents too, of course.

I initially thought that was unfortunate for the students. I mean, they're working with a language they're unlikely to see or use again; and if they were to learn Java or Python, their experience with Racket wouldn't really be of much use. The same way learning a language that compiles to Javascript isn't the same as learning Javascript.

But I watched the students learn. I watched them vigorously copying code from the slides. I watched them work through their errors and learn from their mistakes. And I watched them create awesome things from whole worlds to explore in virtual reality to creative websites featuring their favorite games or TV shows, and proudly showing them off to everyone.

They were just getting familiar with the material and then running off with their imagination to build whatever they desired.

Which, I think, is what learning how to code is really about.

.

I'm in-this-try ing to Learn CS

July 19, 2018

As a CS undergrad, you should try to learn a language that isn't used in industry. Sounds like crippling advice to me.

Don't get me wrong, I don't disagree with this. I agree to some extent. Also, I don't mean to offend the person who said this. (I actually greatly admire him.) It just seems counterintuitive at first.

I guess it's because, from my perspective, going to college for a CS degree means gaining the skills necessary to work in industry, i.e. college is a job-preparation thing for students pursuing a CS degree.

The opposite would be college is a place for learning as much as possible for the sake of learning rather than for the sake of getting a job. Being a Math-CS major, I've experienced both sides of the spectrum.

I say it's crippling advice because I imagine telling CS students to learn a language not used in industry and seeing them balk at the idea. They would probably call it a waste of time because they could've used that time to learn something "useful". Or maybe they would say that it makes them undesirable because they know some no-name language while everyone around them is scribbling away in Python, Java, C, C++, Javascript.

Everyone will inadvertently have to be better than the next CS student to get a job in industry. And how do they get a job in industry? By working with the tools used in industry. After all, if you're a company working primarily with Java, you would want to hire someone experienced in Java. I presume.

And, also, if we don't get a job by the time we graduate, our lives are officially over. Heh.

.

Brought to You Today by the Number 9 (and by the letters C and S)

July 18, 2018

For the past 3 weeks, I've been riding my skateboard or bike — depending on the week — to get the mail. This week is skateboard week. Today, however, I came home a bit late and decided to walk instead.

My skateboard is kinda loud already and riding over cracks in the sidewalk just makes it even louder. It was a little after 8:30, so I thought maybe there were children sleeping — or getting ready to go to sleep. (I suspect that the area I live in is half families and half students.) I have no idea if that is true; I only thought that because I remember I had to go to bed around 9 when I was younger.

It was about 10-13 years ago, but I remember that because I would lie in bed and stare at my digital clock. It wasn't because I couldn't sleep; it was because I was doing mental math with the numbers on the clock. Specifically, division. I don't remember if I liked doing division or not, but, for some reason, I stayed up doing it. The numbers were aligned so that I could imagine a division bar (whatever it's called) between the hour and the minutes and do division by 9.

I did this so often that I eventually came up with an algorithmic way of dividing (two digit) numbers by 9. It went something along the lines of: the first digit of the quotient is going to be the first digit of the dividend. So, for 23 ÷ 9, the first digit of the answer is going to be 2. For 34 ÷ 9, the first digit of the answer is 3. I was excited about my discovery until the time was something like 9:29.

I modified my algorithm: if the digits of the dividend add up to 9 or greater, then the first digit of the quotient is going to be 1 greater than the first digit of the dividend. So, for 29 ÷ 9, the first digit of the answer is going to be 3, since 2 + 9 = 11 ≥ 9.

For the second digit, it was the sum of the digits of the dividend. So, for 23 ÷ 9, the in-progress answer would be 2.5 since 2 + 3 = 5. For 34 ÷ 9, the in-progress answer would be 3.7 since 3 + 4 = 7. For edge cases, like 29 ÷ 9, the in-progress answer would be 3.2 since 2 + 9 = 11 and 1 + 1 = 2. For 58 ÷ 9, the in-progress answer would be 6.4 since 5 + 8 = 13 and 1 + 3 = 4.

I don't think I was able to stay up after 9:58.

It was by creating that algorithm (especially the second digit part) that I inadvertently memorized single digit division by 9. 1/9 = .111..., 2/9 = .222..., 7/9 = .777...

What I didn't realize — until now (almost literally) — was that I was using fundamental computer science concepts in creating my algorithm. Well, first of all, by creating an algorithm. But also by using "if statements" for special cases. And also by generalizing the algorithm so that it worked for any digits. It worked as long as I was in bed and awake between 9:10 and 9:59 anyways.

It wasn't a very useful algorithm. (I'm pretty proud of it though lol.) But it was fascinating to me at the time. What's most surprising to me is that I developed that way of thinking with no exposure to computer science. Well, whatever computer science is.

.

See How It Works?

July 14, 2018

Recently, I was asked to proofread an essay to check for grammatical errors. My friend has always been asking me to do so throughout high school and college. And it's always been the same every time: receive his horrible essay by email and trudge through it, stopping every few seconds to cry as I try to understand what he's saying and see how to fix it.

Joking aside, this time was a little different. I only cried every few minutes. Ok, no more jokes.

(On an unrelated note, it was different for another reason. When I proofread my friend's paper, I sometimes tease him through my comments only because he knows I'm not really making fun of him. What I didn't know was that this was my friend's friend's paper. Oops.)

This time was different because one of the first thoughts that popped into my mind was functional programming.

Having been working with Racket for the past 3 weeks, functional programming has been on my mind lately. I'm still not sure of what functional programming is actually. I guess it's partly because I'm a little uncomfortable with functional programming. I still prefer imperative programming, but only because I've been doing it for the past 4 years. My mind may change.

The reason I thought of functional programming when asked to proofread for grammar was because I thought they were related. Pretty closely related. I think successfully working with them follows from knowing how to visualize the structure of their elements. (Though that could be said of almost any subject really.)

Racket is driven by parentheses. Thus, getting programs to work correctly requires knowing where to put them. (For some students, it's been knowing how many parentheses are needed.) In fact, it's probably the main source of problems among students. At first, the biggest issue is missing the ')'. But, later on in the week, it becomes putting the ')' too early, cutting off the rest of the code and causing it to not show up on the program.

Because of its list-like nature, it's very easy to get lost in the code and see where you have to put the ')'. Knowing how to visualize the pieces of code might possibly solve ~99% of problems involving parentheses. (The 1% is knowing when to start code with '('.) By knowing when to close off parentheses, you start seeing a Racket file as pieces of code put together rather than one long wall of code.

Grammar is also very dependent on structure. The biggest fundamental mistakes I think are issues with incomplete sentences and run-on sentences. Being able to visualize sentences as parts solve* these — and many others — issues. Specifically, being able to recognize the subject(s), verb(s), and modifer(s). (*I intentionally made a grammar mistake in the third sentence of this paragraph to prove a point. I intentionally made a grammar mistake in the fourth sentence of this paragraph for style reasons. #grammar_rules) Yeah, I enjoyed making sentence diagrams in my English class.

In terms of Racket, incomplete sentences would be closing off parentheses too early and run-on sentences would be not knowing when to close off parentheses.

I don't necessarily think being good at grammar implies being good at (functional) programming and vice versa. Actually, I would be surprised if there was some correlation. I do think being good at visualizing pieces of the whole will help in understanding what is going on though.

.

What's the Difference?

July 12, 2018

"There is a difference between 'creepy' and 'disgusting'."

A friend said that today in response to an amusing (not serious, not inappropriate) situation. That sentence immediately brought back a memory of one of my most thought-provoking experiences that had been unintentionally suppressed for several years.

I know I said it was one of the most thought-provoking experiences, but I unfortunately don't remember a lot of the details. I do remember it happened in my AP English Language and Composition class. On that day, we got back our papers. I don't remember the topic, but it had something to do with analyzing the author's choice of word usage. Specifically, why the author chose to use two different words when they both had the same meaning. I really wish I could remember those words right now.

They were pretty much synonyms, so that's what I wrote in my paper. One had a slightly more subtle darker/negative connotation I think, but, to me, they meant the same thing.

"Why are there two different words for the same thing then?" That's more or less what my teacher wrote on my paper in his messy-but-readable, authoritative handwriting. I was mind-blown. It got me thinking about how there are words that are interchangeable because they mean the same thing and why they even exist in the first place. Like, why did we need to have multiple versions of the same word if that word was perfectly fine to use?

There might be an obvious difference between "creepy" and "disgusting". I don't really know how to explain what the difference is, but I guess one would be more appropriate in different situations. Regardless, my initial, immediate mental response to my friend's statement was, "Yeah, they are two different words for a reason."

.

Isn't It Weird?

July 3, 2018

Here's an interesting experiment. Answer polar questions (yes-no questions) with only "yes" or "no". That's it. No extra justification or additional confirmation. Just "yes" or "no". Sounds simple enough, doesn't it?

Yes.

Isn't it weird how we answer "yes" to questions with "not" when we are actually answering the question without the "not"?

"Yes".

.

The Point of Some Return

June 21, 2018

The concept of "return" is a difficult one. To understand and to explain.

When I first started learning how to code, I did not understand what return meant. No matter how many times the professor went over it (he wasn't bad!), I just couldn't wrap my head around it. I don't remember exactly — or even vaguely, for that matter — what words he used to explain what return does. I do remember the context in which it was introduced though.

public int addTwo(int x) {
  int y = x + 2;
  return y;
}

Not the exact example, but something more or less like this was on the slides. Just a random function that did something and returned a value. Whatever return meant. If I had to guess, I imagine the professor explained return by saying it "passed back the value" or "sends the value back" or something. Back WHERE?? WHERE did the value go when it was "returned"?

The curious thing about explaining return is that it's really hard to explain in words without restating the definition of return.

Of course, the concept of return totally makes sense to me now. But I still don't really know how to explain it. In words anyways. If I had to try to explain it, I would probably give an example and hope that it makes sense.

public int addTwo(int x) {
  int y = x + 2;
  return y;
}
int a = addTwo(3);

Or in Python:
(Which might be easier to understand)

def addTwo(x):
  y = x + 2
  return y

a = addTwo(3)

In either case, a is equal to 5.

Seeing that extra line at the end (a = addTwo(3)) along with the function definition is when I finally understood return.

Hmm. Now that I think about it, I could explain return without restating the definition. I would say that return is the output of a function. Besides being a piece of code that is reused to perform a task - or being something that does something - a function is like a machine that takes in an input and spits out an output. Return is what does the spitting out.

2/1/2019: I believe he said something like, "return sends the value back to the caller". At the time, I had no idea what a "caller" was.

.

Imagining Things

June 20, 2018 (last updated on August 13, 2023)

I feel so weird. So unknowledgeable. So helpless.

I’m a math major, so a problem like "What is `(2+3i)(3+4i)`" shouldn’t be too hard right? (Well, one doesn’t have to be a math major to know this). Solving this, I get:

`(2 * 3) + (2 * 4i) + (3i * 3) + (3i * 4i) = 6 + 8i + 9i + 12i^2 = 6 + 17i + 12i^2 = -6 + 17i`

Wait, what happened to the `12i^2`?

I, along with students learning about imaginary numbers could just tell you that `i^2` is actually equal to `-1`.

The operative word being just.

Why in the world is `i^2 = -1`? I don’t know — it just is.

I’ve never really thought about what `i` was. That’s why I feel so weird.

I’ve never really thought about why `i^2 = -1`. That’s why I feel so unknowledgeable.

I don’t really know how to explain why `i^2 = -1`. That’s why I feel so helpless.

These emotions are bouncing around in my head in my Practicum in Math Tutoring class. When we were told about "learning with meaning", I was not expecting to feel this confused. Especially, for a topic that would normally be covered in 10 minutes (unfortunately). But this confusion only fueled my desire to realize the imaginary numbers.

There's a constant battle in my head between "There must be an intuitive reason why `i^2 = -1`" and "It just is. That's the way you learned it, and that's how it shall be learned." Learning with meaning versus rote learning. It's so easy to end the battle now and give the victory to "that's the way things are".

Though not deserving of the win, the latter is seemingly effective. Why spend so much time explaining why things work, when it takes so much less time to present as is? There’s only so much time to make sure these students pass these tests! It was certainly the mindset my AP Calculus teacher in high school adopted.

He wasn’t a bad teacher. In fact, he was the exact opposite. Every student who has had him as a teacher will say that he is very smart, dedicated, hard-working, and caring. What other teacher would go to great lengths to provide us with notes he wrote himself to make calculus easier to read? What other teacher would make hundreds of copies of past AP exams for us to practice? What other teacher would write his own "handbook" and give them to us as study aids?

We were learning calculus because of his efforts. For the past 9 years, more than 100 students, each year, have passed the AP exam, with an average of 127 students passing. His total class size each year was 150 or less. Surely, we were learning. But not really with meaning.

So, what exactly is the "meaning" in "learning with meaning"? It is:

  1. Drawing a number line
  2. Showing that an arrow starting from 0 and pointing to 1 is rotated 180° counter-clockwise when multiplied by -1
  3. Showing that the arrow starting from 0 and pointing to 1 can be rotated 90° counter-clockwise, then rotated another 90° counter-clockwise to get to -1
  4. Emphasizing that one rotation is one multiplication and two rotations is two multiplications
  5. Showing that when the arrow rotated 90° counter-clockwise, it pointed upward — not to any number on the number line. Not to anything in particular actually
  6. Drawing a vertical number line extending upwards and downwards from that arrow and introducing it as the imaginary number line
  7. Showing again that the arrow starting from 0 and pointing to 1, when rotated once 90° counter-clockwise (one multiplication), points to some imaginary number, call it `i`
  8. Showing that one 90° rotation was multiplying by `i`, so another 90° rotation is multiplying by `i` again
  9. Pointing out that we've answered the question, "What number multiplied by itself twice equals -1?"

It’s certainly a lot easier to just say `i^2 = -1`, isn’t it?

All of a sudden, the battle in my head ceases. The confusion fades away and is replaced by a newfound sense of empowerment. It’s a curious feeling. A little unusual, but also a little familiar. It’s the void of cluelessness and helplessness being filled with knowledge. Knowledge I never knew I needed.

8/3/2018: And then there's this. The title text is one of the few times I've been able to apply what I've learned from abstract algebra.

8/13/2023: Manim is great.

.

Biking for the First Time

June 7, 2018 (last updated on June 13, 2018)

So I rode a road bike for the first time today. It was absolutely amazing. And terrifying.

Which came as a surprise to me. I learned how to ride a bike when I was like 7 or something. I've been cycling semi-seriously for maybe 7 years? Not 7 years straight, but within that time frame. And yet, riding a road bike was scary.

Maybe it's because I've been riding a mountain bike all those years. For those who don't know, mountain bikes generally have thicker wheels, so it's easier to ride on different types of terrain. Road bikes have (very) thin wheels because they're meant for riding fast on flat surfaces, like roads. Can you imagine balancing your life on two wheels about as thick as your thumb?

Not to mention I was riding pretty fast. Faster than I was used to anyways. Not on purpose. Road bikes are built to go fast. It's sort of like driving on the freeway for the first time. You know what to do, but the prospect of getting into an accident is pretty scary considering the fact that you're driving at such high speeds.

I guess I'll have to get used to it. It's certainly a lot better than my old bike. Not just because it was a mountain bike, but because it was from Target. The main problem, for me anyways, with bikes from places like Target and Walmart is that they are heavy. Because they are built with cheap parts. They're only $200 after all.

Amazing and terrifying. A pretty good combo if you ask me.

6/13/2018: It took me 1 hour and 30 minutes to go 14.5 miles on my mountain bike. Google Maps estimates that it takes 1 hour and 15 minutes. I can do it in 1 hour and 5 minutes on my road bike.

.

Spring

June 6, 2018

Love is in the air. Weaving in and out. Bobbing up and down. Hitting me and then backing off. It hurts.

Is there something about spring that brings it out? Or am I breathing the wrong air in the other seasons?

Actually, it's not even love. It's something though. Something's messing with me.

Spring is coming to an end. So is "whatever" it is. Maybe it does have something to do with spring. Or maybe it's just the fact that the quarter is ending. I don't know if I like it, but it'll probably come back.

I'll probably not be ready for it either. I've never really been good at boxing.

.

Switching to the Light Side

May 12, 2018

A woman is walking towards me. She looks at me. I start to open my mouth, the word "Hi" ready to jump out. Then she gives me a weird look. I close my mouth before the letter h escapes and walk past her, not saying anything. I'm confused.

Oh, right. My hair. I totally forgot about my haircut. I forgot it was ugly.

It's only been two weeks and, already, I feel normal. Even with the right side of my head shaved to a buzz cut and the left side mostly untouched. Actually, I feel more than normal.

I feel strangely confident.

Part of it is that I actually like this style. Which is weird. I don't think anyone would admit this hairstyle looks cool — much less get it. However, two people with whom I have familiarized myself have complimented it. Thank you very much. But not the response I was really looking for. I guess that makes the compliments so much more meaningful though. Perhaps there is some sort of beauty in this ugliness I have carved for myself.

The other part is, I finally feel like I have some sort of defining feature that makes me stand out. Not that I cut my hair for that reason, but it is a rather nice consequence. For a good part of my life, I just wanted to not be judged. I wanted to be just another person you saw and never thought about again. I wanted to blend in wherever I went, like another brick in the wall.

I never realized the light was so comforting.

.

Grammar Rules(!) (get it?)

May 11, 2018

I'm a grammar Nazi. Well, ok. I used to be. If you somehow stumbled upon this website and read my other posts, you might think my grammar is a little lacking. I admit, my grasp on correct grammar rules and mechanics isn't as good as it once was.

What I liked about grammar was all the rules. A comma must be placed before a conjunction separating two independent clauses. A dependent clause cannot stand alone as a sentence (incomplete sentences). A sentence cannot have more than two conjunctions separating independent clauses or predicates (run-ons). A phrase describing an object must be placed next to the object being described (dangling modifiers). The last item in a list must have an appropriate conjunction before it, like "and" or "or". A sentence shouldn't end with a preposition. That's probably my favorite.

So. Many. Rules.

Even the word "grammar" sounds so proper and formal doesn't it?

I was born into the near-ludicrous, strict world of English. I stayed in it for years. Then I left. I no longer care about whether I should've put a comma at a certain place, or whether I'm using dashes correctly. I no longer care about maintaining consistent verb tense or a single point of view. I no longer care about forming complete sentences or cutting up run-ons. Because, in the end, it doesn't really matter for me anymore. I believe that adhering to grammar rules is a little bit inhibiting, and breaking those rules allows me to express my ideas in a much better — or at least a more interesting — way.

There are some rules that shouldn't be broken though. Like subject-verb agreement. Using could've instead of could of. Eh, there aren't a lot. Or I just can't remember them right now.

I'm on the fence about using the correct comparative/superlative form of an adjective. From my experience, this is probably the most common mistake both native and non-native English speakers make (as a result of the fast-paced nature of conversation). On one hand, the meaning of "more better" is totally understandable. On the other hand, "better" is already the correct comparative form and should actually be used instead. An even harder one to detect, especially in conversation, is using the superlative in a situation with only two objects and using the comparative with more than three.

Really, the only reason why I'm writing about grammar is because I started this "free" writing. Someone, upon reviewing my previous posts, told me that I had a strong sense of grammar rules. Wait, what? My post was scattered with grammatical errors. (Or so I thought at the time. Turns out, the ones she read didn't have as much as I thought it did.)

It turns out there's a general consensus that breaking rules is ok when you understand them and why you're breaking them. I don't really know if I understand why I'm breaking a rule. Does "cuz it sounds good to me" count? It's pretty much the only reason why I write anything the way it is. Like this.

Do you have to be good at grammar to be a good writer? I'm not a good writer so I don't know. Part of me still thinks that content is more important. One can follow the conventions of English perfectly but write boring garbage. Another part of me thinks that wonderful ideas can lose their meaning through poorly structured sentences.

A small part of me thinks, "Who cares? (sometimes "Who's reading?") This is fun. Just forget about everything and write."

.

Writer's Block

May 10, 2018

So you're writer's block. I was expecting something ... a little more ... well, more.

I can't even see you. Not because of your size, but because you have no form. Yet I can feel your presence looming over me. Taunting me. You enjoy seeing me suffer don't you? I suppose it's because I'm a fresh target.

Oh, you've been watching me ever since I could write? I wonder why I've never noticed you before then. I swear I didn't avoid you on purpose. I've heard about you, but you were just another one of those things I thought were never going to happen to me.

I've done so much writing in school though. Why have you never attacked me? Is it because prompts and deadlines are barriers you can't get through? Fine, I'll admit it if you won't. They're barriers I can't get through. Give me a prompt and my imagination becomes a tightrope on which I must balance. One small step away, and I fall. Give me a deadline and my imagination quickly runs to meet it, not stopping to enjoy the scenery.

Oh, that's it isn't it? You feed off of creativity don't you? You're nothing but a block filled with other people's thoughts. And now mine.

I'll let you have this win. I guess I'll have to get used to your presence. Unless I stop thinking. But that's not poss—.

.

The Greatest Experiment

May 7, 2018

"Where is everybody?" Said Enrico Fermi.

Our universe is enormous. And very old. Yet, over the course of 14 billion years, Earth is still the only known place able to sustain life? A tiny speck in the possibly infinite expanse of space, and there's only one Earth? This is the Fermi paradox.

What if aliens do exist, but they're purposely avoiding contact with us? Watching us, like we're animals at the zoo. This is the zoo hypothesis.

What if, we could find another Earth, and watch how life evolves? Would we see the same thing happen on that Earth as it did on this one? Plants, animals, dinosaurs, early humans, modern-day humans. The Stone Age, the Renaissance, World War 2. The lightbulb, phone, car, computer. Religion, language, culture.

Would life on that Earth go through the exact same process that life on our Earth did? Would those people make the same advancements and the same mistakes? Or did all of whatever occured on our Earth just happen by chance, and that Earth has creatures we have never seen; inventions we have never made; ideas we have never thought. What if they're aliens to us, and we're aliens to them? This is what I call the greatest experiment.

.

Going Against the Grain

May 5, 2018

Have you ever held something in your hands and you know what to do with it, but you don't do it because you tell yourself you don't know how to do it?

Ok, so maybe I really didn't know how to cut hair — much less my own — but I knew what I had to do with the clippers in my hand. Yet, I never put them against my head. I looked back and forth between the instructions and my head in the mirror, hoping that something in my brain would just "click" and I would suddenly know what to do. The instructions were clear enough: split your head into three sections and, starting at the bottom, cut against the grain. Yet, I never put them against my head.

Ironically, my somewhat-irrational fear of messing up was preventing me from cutting. Ironic, because I wanted to have an "ugly" haircut. Somewhat-irrational, because it would grow back anyways. However, the only thought going through my mind was, "Once I cut my hair off, there's no undoing it". That idea gripped my hand and held it in place, as if it was blackmailing my brain. Telling me, "Don't do it, or else".

But my brain isn't always rational.

Zzzzzzzzzzzzzzzz. Oh wow. I did it. I actually did it. It wasn't that bad. And it was so liberating! I felt as if I had broken off chains I didn't even know were weighing me down. In a way, I was free - free from the expectations of getting a good haircut. Free from my boring, generic, could-be-anybody look. Free from myself. I changed to a smaller guard and kept going.

I actually didn't cut off a lot of hair. But it was enough to make people stare at me and wonder what happened. Which was what I wanted, in a way. Not to be some weirdo with a horrible sense of fasion or no sense of self-respect. But to be someone different.

Someone new.

.

They Say Teaching Is the Best Way to Learn

May 3, 2018

A few weeks ago, I read part of Habits of Mind: An Organizing Principle for Mathematics Curricula by Al Cuoco, E. Paul Goldenberg, and June Mark. They touched upon a point — or rather, centered their argument around a point — that I was slowly experiencing, but never really realized until now: math isn't really about knowing all the different shapes and their geometric properties or knowing how to do complex calculations with a ton of variables and symbols. Math is about knowing how to think.

Being a good student — or, perhaps not mutually exclusive, a blind and naive one — I never questioned what I was learning. I never asked myself, "Why do we have to know how to complete the square?" or "Why do we need to learn how to prove two triangles are congruent?". I just did them. Sure, some things are useful, like knowing how to calculate area and computing percentages, but when and how often am I ever going to be in a situation where it would be useful to know that `sin(pi/6)` is `1/2`?

I've been asked by high school students before, "Do you need to know this for college?" My simple answer: "No." My more accurate but perhaps not the most motivating answer: "No, I haven't done this in forever." I already know what they're thinking, even if they don't say it out loud: "Then why do we need to learn this?" My high school self would've just said, "I don't know, just do it and get it over with."

For the past few days, the class for which I've been tutoring has been learning about how to prove triangles are congruent. Admittedly, I don't remember much about it. But I never realized how similar doing geometry proofs was to doing higher-level math proofs for theorems. You start with what you're given, use your knowledge to find out what else you can claim, and make your conclusions.

A student asked for help proving triangles are congruent. I had no idea how to do it. I immediately started thinking, "Well, what do we know from the picture?", "Can we say this?", "Will that help?". That's when I realized that those were the types of questions they should've been asking themselves. Learning how to prove triangles are congruent isn't about making sure you know (and remember) about the side-side-side postulate or side-angle-side postulate. It's about looking at the picture and using what you know to work towards the last step in the proof. In other words, it's about learning how to think and problem solve.

"Do you need to know this for college?" Probably not, at least to pass your classes anyways. I mean, you might be in a cryptography class where you have to complete the square, or you might be solving a combinatorial problem involving triangles. What's more important, I now have learned, is realizing you're learning about critical thinking — not about triangles.

.

High School Culturalism

April 30, 2018

I'm sitting in a chair, but I don't fit in it. It's a normal, plastic chair that an average-sized adult could sit on. It's a normal, plastic chair behind a normal-sized table in a normal-sized room. It's a normal, plastic chair.

It's early in the morning, and I'm in a high school classroom. If you walk into the room and look around, you would see a bunch of students. If you happened to look at me, you would think I was just another student. There was nothing about my faded blue sweater, light gray t-shirt, and coal black jeans that made me look different from everyone else. Just another student. Yet I didn't feel like I was one of them. Yeah, I was a college student tutoring at a high school. But that wasn't it. After all, I was still a student, and I had been in their shoes only 4 years ago. I was sitting in a normal, plastic chair just like they all were. The problem was, I wasn't part of their "student culture" anymore.

I wasn't actually "part" of it, just around people who were. It was normal to hate school and, therefore, normal to not try in anything school-related. I get it. It's so much more fun to be talking with friends, and it's so much easier to be on our phones. It also doesn't help that everything coming out of the teacher's mouth either isn't making sense or is just plain BORING. Those people around me weren't bad people, but I could see why they wouldn't pay attention in class or skip it altogether.

I'm sure everyone wasn't like that — they just chose to present themselves that way to fit in with everyone else. I mean, that's why nerds get bullied and picked on right? Pretty soon, you start hearing things like "I hate school" or "I don't wanna do this s***" and murmurs of agreement everywhere you go.

At my high school, that type of student culture wasn't as harsh as I may have made it seem. Or I was just at the "wrong" place at the "wrong" time. Either way, I thought I left it behind coming into college. Selfishly, I thought to myself, "I won't have to feel uncomfortable being around those type of people ever again". But here I am now, at a high school helping students I so selfishly wanted to avoid. Ouch.

Again, they weren't bad people — I just felt like I didn't belong with them.

It's early in the morning, and I'm sitting in chair in a high school classroom. A normal, plastic chair behind a normal-sized table in a normal-sized room. I still don't feel quite right in it, but, this time, I feel slightly more comfortable. Because next to me, is another student who, although he doesn't like school, is at least willing to try.

When I get out of my chair, I look back, and I see something strange in the corner of my eye. The chair looks different. Then I blink and everything is back to normal. I'm probably imagining things. After all, I probably would've noticed if I was sitting on a cushion the whole time.

.

Something That Does Something

April 29, 2018

What is a function? Those of you familiar with programming might say that a function is a piece of code that is reused throughout your code to perform a task. Those of you thinking in terms of higher-level math might define it as a mapping from a set to another set. Those of you more comfortable with lower-level math might describe it as ... well, I'm not sure actually.

I remember being asked this question at an interview. It was for a tutoring position where I would have to help children with programming. So I had to explain what a function was so that a child could understand.

This question — a rubber ball to the prepared and a spear to those who weren't — was thrown at me. Its sharp point grazed my brain. My brain stopped for a few seconds in shock, realizing what could've happened if it had been thrown a few more millimeters to the side. I had been programming with functions for 2 years and I still didn't know what they were?! My brain started running around in circles. It fell, got back up, started running, fell again, got back up again, started running again, ... When it finally stopped to rest, it came up with "a function is something that takes in an input, does something with it, and returns an output".

Not the best answer, but the best I could come up with in such a short amount of time. After saying it, I immediately thought of functions with no parameters and void signatures (functions with no input and no output). But that wasn't the main issue with my answer. My answer was no better than telling you that a function is something that does something.

I didn't get the position, which was no surprise to me. It wasn't just that question that killed my chances, but that's a different story. That spear left a lasting impression on me that still hurts to this day. How many concepts have I been using for a long time without thinking about what they were?

How many of those do I actually know how to explain?

.

The Beginning

April 28, 2018

I've never fancied myself a great writer. Or even a writer, for that matter. In fact, I don't even know why I'm writing this. Not just this post, but this sentence.

This word.

This letter.

Letter. Maybe that's it. Maybe I'm just writing a letter and mailing it to no one in particular. Maybe someone will open their mailbox and find this letter waiting to be opened and read. Or maybe it will get lost in the mail and never be read.

I suppose this would be the beginning of this blog-ish page. The problem with the beginning is you never know what's at the end or what you might find along the way. Perhaps that's not such a bad thing. But does the road through the beginning always have to be such a long and difficult one? There are no other roads and I've already come this far. So I might as well just keep going. Who knows? This might turn out to be a fun adventure.