In 2020, I read Lample and Charton’s Deep Learning for Symbolic Mathematics. I had graduated with a math degree less than two years before, and I thought it would be cool to apply neural networks to math. One candidate was the search for Lyapunov functions, which were crucial to my undergraduate research. Finding Lyapunov functions is like finding integrals. The two problems share a tantalizing property: solutions are easy to verify, but hard to compute. I tried to reproduce some of Lample and Charton’s work on my own, but I wasn’t a great programmer. I was also distracted with my day job—I spent 260 days at sea in 2020.
A few weeks ago I decided to give it another shot. I’ve changed a lot since 2020, and now programming is my day job. I experienced success this time, but I chose to write here about the parts I found hard, and what surprised me about this project.
I am bad at taking notes, and I want to get better. There are two main obstacles that I face when I write down things that I want to remember.
Nothing in this article is classified. Where I refer to Navy sonar and TMA data, I have cited official DoD sources in which the data has been publicly released. If you think I’ve made a mistake, you can email me at the address on my homepage.
I was lucky enough to deal with a lot of interesting problems during my time in the Navy. Today I’d like to share one that many Submariners encounter on a daily basis, and an unconventional way that I found to solve it.
Submarines employ sonar constantly to track targets, surface safely, and avoid detection. Sonar is a pretty famous technology, and you’ve probably heard that there are two principal types: active and passive. The following image is helpful.
It’s fitting that I spent my last day in uniform only steps from where I first put it on.
Norfolk is a pretty bike friendly city. I recently got a Trek FX 3 Disc to ride around, and I’ve become familiar with some of the trails. A few of my favorite spots are the Elizabeth River Trail, Back Bay, and the Great Dismal Swamp canal trail.
While cycling, I sometimes ask myself: what gear should I be in when accelerating, and what gear should I stay in while cycling at a certain speed? I wanted to use some math and simulation to explore this question. I was heavily inspired by Steve Gribble’s wattage to speed graph, but wanted to also look at how gear shifts affect the speed and power of the bike.
Below is a simulation of a person’s speed, acceleration, gear, and cadence as they accelerate from a standstill. There’s also a power graph which shows how this person’s power is used. Read on to learn how I built it, or just play with the values and see what happens.
In April, OpenAI made the news again, for a new text-to-illustration tool called Dall-E 2. Dall-E 2 is a deep learning model based on a transformer architecture. Transformers have been behind a lot of the most recent AI innovations, like GPT-3, a natural language processing model, which was used to generate the famously poetic ChatGPT. GPT-3 was also used to create OpenAI Codex, the software which powers the shockingly useful GitHub Copilot. If you’re into coding and you haven’t tried the free trial, you’re missing out.
Imagine a cannon, firing a shell into the air. What path will the shell follow? How far will it travel? How long will it remain airborne? Below is woodcut by Walther Hermann Ryff, a 16th century mathematician, examining this question. At the time, most theorists thought that cannonballs traveled in straight-line segments and circular arcs, stitched together.
My blog has been pretty quiet recently, because I’ve been focusing on studying for the GRE Mathematics Subject Test. I think this test is sort of unique among popular, standardized tests, because the problems on it are very difficult. There are 66 questions on each test, and it must be done in 2 hours and 50 minutes. That means the test-taker has 2 minutes and 35 seconds to answer questions like these:
***Check out GitHub for my code!***
This month, I begin my third year serving aboard a PCU in the shipyard. This has offered me some unique challenges, among them, personnel management. When a Junior Officer like me shows up to the boat, they need to leave to get experience aboard an operational submarine, so they can be qualified to fully contribute when they get back here. I did this myself on USS John Warner in 2020. These rides are unpredictable: boat schedules constantly shift, along with the number of people they can support aboard. People have their own commitments, at work and in their personal lives. Work in the shipyard also demands some fraction of our officer population.
I was lucky enough to get a few weeks of leave for Christmas, so I went home to my family’s house in Vermont with my wife, Jackie, and our cat. In between camping and ski-hiking, I was looking for another little project.
My parents bought the land which our house is on when we still lived in Beijing, and there’s a lot of history in the woods. Only two modern roads survive in the immediate area, but if you go into the woods it’s clear that there used to be others, which have been neglected for a long time. The woods are also home to an entire system of bike trails, maintained by the Brewster River Mountain Bike Club, of which my dad is a member. There’s a lot going on up there, but if you look at Google Maps, it’s utterly empty.
A while back I wrote an article about torpedo guidance strategy in a submarine game. The concept was to compare five different methods of torpedo control, and to implement each in C#. In this follow-up, I test each one and compare them, to see which is most effective.
Since my last post, I’ve gone backpacking a few times, and each time I try to bring a little less. No, I’m not ultralight yet (often defined as base weight under 10 pounds), but I’m pretty close. My last base weight was 12.1.
Once I went through the relatively easy phases of lightening my bag (bring smaller bottles of things, stop bringing changes of clothes, weigh my meals), I started to fantasize about buying another backpack. This time, I thought to myself, I would get one which was incredibly light. My current pack weighs almost two pounds (17% of my base weight!) and I was desperate to take a little weight off.
Over the long weekend, I took a trip with a few friends out to Seneca Rocks, WV. My friends are big rock climbers, so they spent all day on the rock face. I decided to use the time to take a step towards a long-term goal.
I’ve always wanted to go ski-camping. I have a really sweet pair of Alpine Touring (AT) skis, and I’ve used them to ski around a few resorts and state parks in my home state of Vermont.
I’ve played pretty much all the big modern submarine simulations (Dangerous Waters, 688I, Silent Service, Sub Command, etc.), and in my opinion, Cold Waters is the most fun by far. It’s not the most realistic game: there is pretty much no parallel between Cold Waters and how sonar, tracking, classification, etc. work in real life. Damage control is pretty simplistic. Driving the submarine is easy. That’s all okay, because that isn’t what Cold Waters is about. The fun part is dodging torpedos.
When I tried to design a movement controller for a submarine in Unity, I felt up to the challenge. After all, exerting forces on objects is my main way of interacting with the world. I’ve written previously about my submarine game project; essentially, I’m making a fun little game, inspired by my personal experience, where you drive a submarine around, hunt other submarines, dodge torpedos, etc. The game was never supposed to be a faithful representation of real life, it’s just for fun.
I have a confession to make.
All of this code is on Github, so check it out, if you can!
My wife, Jackie, is a medical student at UCSF, but this week she visited me! So far, we've had a ton of fun in Norfolk, and we have some great plans for the weekend.
Without fail, Jackie brings me new interesting problems every time she comes here. Right now, she's working on determining the distances from patients' homes to the hospital. For anonymity, only patients' zip codes are used. Essentially, the problem can be stated like this:
I caught COVID at work earlier this year, so I ended up with a few weeks at home in isolation. In order to pass the time, I decided to try and learn a bit about the Unity game engine. I had a blast with it, and started to wonder how hard it would be to program a (simple) video game. The 3D physics simulation within Unity reminded me a lot of the phase spaces in continuous dynamics, which I have studied a fair bit, so I felt up to the challenge.