❀✿❀ SuperLaserNino ✿❀✿

Inconsolata LGC with oldstyle numerals

18 December 2016

83 words

In my perennial quest to make everyone love oldstyle numerals, I decided to make a fork of one of my favorite programming fonts, Inconsolata, and give it oldstyle numerals.

The numbers 0 through 9 set in Inconsolata LGC using oldstyle numerals
This is what it looks like

The font can be downloaded from GitHub.

If I figure out how to properly use FontForge, I’ll also add programming ligatures at some point.

Focusing on the breath

15 November 2016

227 words

During mindfulness meditation, you’re supposed to focus on your breath. If you encounter any stray thoughts, you’re instructed to notice them and let them pass by, always returning your focus to the breath. I often find it difficult to stay focused on my breath for an extended length of time; it’s easy to start focusing on the breath, but after a short while, I’ll notice I’ve drifted off to thinking about something completely different.

I recently realized that, since it’s easy to shift my focus instead of holding it, it is much easier to focus on one breath at a time. Then, when the breath is over, instead of trying to keep focused, I’d repeat the mental motion of shifting my focus to the breath – again, only for a single breath. This way, I’ve been able to stay focused on my breathing for many minutes without drifting off into other thoughts.

So, in general, this is good, but it also feels like cheating since I’m not actually holding the focus; instead I’m doing a new mental motion after every single breath, which might put me in a less calm state than I’d be in if I could just learn to stay focused. I’d be curious to hear from people who have more experience with meditation, whether this is a bad way of doing things.

Four or five thoughts on scientific writing

18 August 2016

2567 words

A few days ago I handed in my bachelor’s thesis in physics and I had a few thoughts while writing it. Some of these thoughts only apply to literature that features a lot of mathematical equations, but some apply to all academic writing, or all writing in general.

“Cite before you write” is difficult

I have the impression that a common mistake for undergrads writing their first scientific paper is that they start writing and only insert citations later. This takes a lot of time because they have to go through the whole text and remember where they read each argument they mention. Additionally, it leads to worse quality citations because many students will get lazy and only insert citations until their supervisors stop complaining.

Like anyone who thinks they’re smart, I figured I wouldn’t make this mistake when I’m writing my bachelor’s thesis. But there I was, multiple pages written, a rough outline of the entire document finished, and I still had approximately zero citations in the text.

This surprised me because, whenever I research a topic online and take notes about it for myself, I never fail to cite sources. I gather links to sources, put them at the bottom of a markdown file, and write my notes around those links.

Why did I do it wrong in the context of my thesis? The problem wasn’t that I didn’t know citing as I write would be a good idea – I’d explicitly planned to do it. My best guess is that there was too much friction in the process. In the markdown example, all I have to do is copy the link to the source, paste it into the document, and put some identifier for the link at the beginning of the line (e.g. [example]: http://example.com "Optional title"). To get a proper citation into BibTeX, I have to find the paper on Google Scholar, click “Cite”, click “BibTeX”, copy the content of the entry, open the bibliography file, paste it in, change the identifier if it looks gross, go back to my document, and enter \cite{identifier}. It’s no surprise that people get lazy if that’s what they have to do for each source.

A solution to this problem is using citation management applications. There is, for example, Zotero, which can store all your papers in a handy library. It even gives you a button for your browser to quickly add new references without digging through cite-menus on Google Scholar. Using such an app, you just add every paper you look at into your library and, from there, export your bibliography file. Then you can copy or drag the citations from your Zotero library without having to think about the details.

I find it surprising that I hadn’t heard much or thought about them until a few weeks before my deadline.

On formal tone

I was surprised to see how much the tone of scientific papers differs from that of textbooks. So far I’d only ever read textbooks, and a lot of why I was excited to write my bachelor’s thesis was that I liked the styles of some textbooks. Authors like David Griffiths or David Halliday1 write in a way that is both whimsical and easy to understand.

Here are some fun examples:

Before leaving our review of the notion of temperature, we should dispel the popular misconception that high temperature necessarily means a lot of heat. People are usually amazed to learn that the electron temperature inside a fluorescent light bulb is about 20,000°K. “My, it doesn’t feel that hot!”2

I would be delinquent if I failed to mention the archaic nomenclature for atomic states, because all chemists and most physicists use it (and the people who make up the Graduate Record Exam love this kind of thing). For reasons known best to nineteenth century spectroscopists, l=0l=0 is called s (“sharp”), l=1l=1 is p (for “principal”), l=2l=2 is d (“diffuse”), and l=3l=3 is f (“fundamental”); after that I guess they ran out of imagination, because now it continues alphabetically (g, h, i, but skip j—just to be utterly perverse, k, l, etc.). The shells themselves are assigned equally arbitrary nicknames, starting (don’t ask me why) with K: The K shell is n=1n=1, the L shell is n=2n=2, M is n=3n=3, and so on (at least they’re in alphabetical order).3

And then I looked at articles and didn’t find a single joke in them! In fact the more papers I read, the more it felt like I was reading an entirely new language. Sentences are much longer than in non-academic writing. Most authors avoid using contractions (e.g. “can’t”, “isn’t”). Nobody puts any emotion into their writing, eliminating all traces of informality from the text. To say something “ran out” as in the second example above would probably already be too informal. It seems uncommon to add analogies to complicated explanations to make them intuitively easier to understand.

In a TED talk, linguist John McWhorter proposes that texting doesn’t harm teenagers’ writing skills because they subconsciously treat it like a form of speech rather than writing. Since writing a text message doesn’t feel like composing an essay, using lol and rofl won’t destroy the child’s ability to spell. I suspect that this compartmentalization of different means of communication is part of why formality is so important in academic writing: “Normal” written language can be imprecise but still easy to understand, if the reader and writer have shared background knowledge. Academic papers usually communicate complicated ideas where precision is important. It’s not hard to imagine that funny metaphors can easily lead to misunderstandings. So, while I don’t see how contractions would cause any problems on their own, the rule “be careful with funny metaphores” is harder to follow than “nothing even remotely informal ever”. If following either rule will lead to a well-argued paper, the latter is more efficient. Similarly, if it’s forbidden to write in terms of analogies, it’ll be easier not to be tempted to think in terms of bad analogies.

So simply writing in a way that feels very formal and fancy is a good way to make sure one’s writing stays precise without having to think about it too much.

But (1), on the other hand, “regular language” is a good tool for communication, too. We’ve all been trained to speak and write from very early on, and if you’re forced to write an basically a different language, it can slow down your thoughts and make you less efficient. Contractions aren’t “formal”, but they can make sentences more fluent and easy-to-parse. And analogies can offer valuable support for complicated explanations to steer the reader’s mind in the right direction such that they have an easier time following the text.

But (2), using formal language is not a fool-proof way to make sure all of your thinking is precise. I recently read a paper that contained the sentence, “At the inner boundary there are basically two types of reasonable boundary conditions: …” Saying words like “basically”, or “essentially”, or “reasonable” may sound fancy, but doesn’t actually explain anything.

But (3), using formal language can actually be harmful for clarity. You know how saying “I did X” sounds informal? A lot of the time, authors use “We did X” instead. This strikes me as a weird custom for papers that only have one author, but it’s still reasonably clear what the author means. It gets problematic when they start using the passive voice to sound fancy. Using the passive voice is almost always a bad idea. The reader needs to know who does what. “The stress tensor is given by …” Is that the definition? Does this follow from something? Are we assuming this? Using the passive voice is an easy way to accidentally leave out crucial information that the readers then have to figure out themselves.

Nobody ever quotes anything

I was wondering why there were so few quotations in the papers I read. Searching the internet revealed arguments like the following:

Unlike other styles of writing, scientific writing rarely includes direct quotations. Why?

Inexperienced writers may be tempted to quote, especially when they don’t understand the content. However, the writer who understands her subject can always find a way to paraphrase from a research article without losing the intended meaning – and paraphrasing shows that the writer knows what she is talking about.4

I get that you want to make sure the author understands the concepts they’re writing about and didn’t just copy–paste stuff from other papers without having read them first. But even so, it strikes me as wildly inefficient for them to paraphrase the same thoughts over and over in every paper they write on the same topic. You wouldn’t believe how many times I’ve read about the viscosity prescription being the big unsolved problem of accretion disc physics.

If you’re literally repeating what someone else already said, there is not much value in trying to come up with a new way to phrase it, unless you have a great new explanation. If everyone just quoted one really good explanation, they wouldn’t have to waste their time rewriting the same information and could instead spend their time doing more research.

Next, if you paraphrase everything you read in a paper and then just say, “see <Some paper>”, it can be hard for the reader to find the exact spot you’re referencing. Also, the reader has to have a copy of each paper you’re citing on hand, and find the statement you’re paraphrasing to check whether you actually understood the source material correctly. This is not optimal. On the web, this can be easily solved by putting a quotation of the relevant section, plus a reference to the original article, into a footnote. Then the reader can immediately see the sentence/paragraph what you’re referring to without having to seek out the source article. I can imagine the reason that this hasn’t caught on yet is that it doesn’t work well on paper. If you only have a limited amount of space, you don’t want to dilute your own text with foreign material – and, contrary to the web, footnotes must always take up physical space on the page.

But yeah, I’m always happy when I look at how Gwern cites sources using enormous footnotes.

TeXmacs is better than LaTeX (even though it has bugs)

TeXmacs is a WYSIWYG text editor that makes it easy to write sort of LaTeX-looking documents without the hassle of having to look at the source code and output files separately. What sets TeXmacs apart from other word processors is that you still get a lot of the benefits you expect from plain text editors. For example, one thing I like about writing in markdown is that I can see formatting control characters, like * for denoting the start and end of italics. Most WYSIWYG editors only show you the currently selected formatting options in a toolbar somewhere, which leads to the classic “Write an italicized word, write a normal word, delete the normal word, retype the normal word, argh now the new word is italicized too”-problem. In TeXmacs, when the cursor is in a region with formatting applied, it draws a little box around that region, so you can always tell what’s happening. Typesetting formulas in TeXmacs is the most pleasant experience I have ever had in my entire life and I never want to go back to writing LaTeX equations.

Unfortunately, when I started writing, I discovered bugs that occasionally made TeXmacs freeze up and I had to restart it. It seemed relatively dangerous to make myself dependent on a program that sometimes freezes, but, in retrospect, I should’ve stuck with it. I switched to LaTeX and it felt like placing individual atoms of ink on the paper. This decision probably cost me a lot of time and writing quality, since I had less time for editing.

I tried talking to people at my university about TeXmacs and most of them said, “I’m pretty happy with LaTeX,” or, “I’m pretty fast at typing LaTeX,” but once you see how fast you can really be, you will not want to go back.

My hope is that if many people use TeXmacs, it’ll get more code contributions and become less buggy, because that’s supposedly how open-source works.

Putting each sentence on a single line in your text file is a good idea

Say you use LaTeX for your writing anyway, or you write in markdown. There are two common ways to write plain-text documents:

  1. One line per paragraph. Each paragraph is contained in a single “line” of text, followed by an empty line. Most text editors wrap lines dynamically, such that these one-line paragraphs just look like normal paragraphs.

  2. Hard wrapped lines. Some people like to use old text editors like Vim. Vim isn’t very good at handling long lines that have to be displayed on multiple lines on the screen. So, instead of putting an entire paragraph into a single line, Vim users configure their text editor to insert line breaks after, e.g., 80 characters. This makes the files nice to look at in old text editors, but it makes editing more complicated: Whenever you change something at the beginning of a paragraph, the line breaks in the rest of the paragraph may no longer be in appropriate places, so you have to reformat the entire paragraph.

After switching to LaTeX, I wanted to try a technique I read about a few years back: Inserting a hard line break after each sentence or sub-clause. This sounds like a strange idea because it makes the right edge of your text look all jaggedy, but it is actually really useful.

LaTeX and markdown ignore single line breaks in the text, so the output you create is going to look the same as when you use methods 1 or 2. But if you place line breaks after periods, or important commas, it suddenly becomes much easier to delete, edit, and re-order individual sentences. Another nice feature is that you can easily see when you’re accidentally starting each sentence with the same words. And your version control system is going to love keeping track of your writing because version control systems natively operate on lines and not sentences. And you can now see how long your sentences are, because they’re visually separated from each other. This can help prevent the common problem where scientists write extremely long sentences.

Note that I’m only recommending putting line breaks in the source documents. Don’t put line breaks in published texts.

Footnotes

  1. Every author of good textbooks is called David. It’s true.

  2. Chen, Francis F. 1974. Introduction to Plasma Physics. Springer, New York.

  3. Griffiths, David J. 2004. Introduction to Quantum Mechanics. 2nd edition. Upper Saddle River, NJ: Pearson Prentice Hall.

  4. The University of Washington Psychology Writing Center on using quotes in scientific writing.

∞/3: Epilog · Abstraction

26 June 2016

556 words

[When I gave a draft of part 3 to a friend to read, they commented on the first paragraph, “Math isn’t about giving things funny names; it’s about giving things meaningless names!” I had a thought on this topic but when I wrote part 3, but I couldn’t really make it fit and thought it wasn’t that interesting anyway, but my friend said it was, so here goes. (Parts 1, 2, 3.)]

15-year old Nino had an idea once: “Math is stupid! When solving physics problems, you always have to take the actual physical quantities, then make up weird letters to put them through the equations, and then you have to translate them back to the physical quantities. This makes it harder to see what you’re doing because, when you glance at an equation, you only see the relations between letters and not the relationships between the actual physical quantities. In the hundreds of years that science has been around, someone must’ve come up with a more intuitive way to write equations. After all, computer scientists don’t just call their variables a, b, c, x, y, z either!”

However, the meaningless symbols are actually a good thing. As I said earlier, the scientist’s job is coming up with mathematical constructs that mirror the behavior of certain aspects of reality. They use this mathematical model to look for new unexpected behaviors and run experiments to check whether these behaviors can be observed in reality. Now, since many things in the universe kinda look the same if you squint a little, it makes sense to apply the same models to them. Thus, you can solve the complicated math parts of your model once, while getting new predictions for many different experiments. For example, you only have to solve the equations for the harmonic oscillator once to model everything that sort of vibrates a little.

Or, you write an object’s kinetic energy as Ek=mv2/2E_k=m v^2/2, and its rotation energy as Er=Iω2/2E_r = I \omega^2/2. In both cases, you have half of some property the object has (the mass mm or the moment of inertia II), multiplied by the square of what the object is doing (How fast the object is moving vv, or how fast it’s spinning ω\omega). So when you want to, e.g., form the time derivative of EkE_k or ErE_r, it still has the same form (E˙k=mvv˙\dot E_k = m v \dot v and E˙r=Iωω˙\dot E_r = I \omega \dot\omega) and you can easily see that you don’t have to do the calculation twice. Thinking about formulas in this way can also help with memorization: If you take the rule, “Energy is always1 half of a property times the square of something that changes,” what do you think the energy stored in a capacitor looks like? If you’re a person who frequently finds themselves in situations where they have to answer such questions, you may remember that the Very Important Property of a capacitor is the capacitance CC, and a thing that changes is its voltage VV. This suggests the stored energy would be Ec=CV2/2E_c = C V^2/2 which, in fact, is correct.

Footnotes

  1. I mean, obviously not always, but when you need an answer quickly, it’s better to have a heuristic than to say nothing at all.

3/3: Mathematical notation

13 June 2016

Modified: 12 October 2016

1878 words

[Part 3 is about communicating mathematical ideas. Part 1, Part 2. I took care to contain the tedious math bits in single paragraphs, so the point is still clear if you choose to only read the fun parts.1]

summary. There is no such thing as “wrong” notation. All that counts is that you get the math right and communicate your ideas clearly.


Last time I explained how it’s not accurate to say that an electron “is” a wave function, because an electron is a thing in the universe and a wave function is a mathematical object, and mathematical objects don’t live in the real universe. When people talk about wave functions, they often use the letter ψ\psi. Obviously, even though it looks all nice and wavy, the ψ\psi itself isn’t the wave function either – it’s just its name. The concept of names is one we know and love from the real world: When I point at a chair and say, “This is Bob,” it’ll be clear what I mean when I explain that Bob has three legs. While it’s a terrible idea to call a chair Bob, giving things and their relationships with each other funny names is basically what mathematics is all about.

Just like we grew up believing that dictionaries had authority over the reality of words, school taught us that ++ means you add two numbers, - means you subtract them, ×\times means you times them, and so on. But these symbols weren’t handed down from the heavens to the first humans to walk the Earth. There was a time when they didn’t exist, and then someone made them up. Now, +,,/,×+, -, /, \times are pretty basic and sometimes you may even have a use for them in every day life, so these symbols are generally assumed to refer to their corresponding arithmetic operation. There are a handful of other symbols that are pretty unambiguous in their meaning, like \sqrt{\cdot} or ==, but beyond this lies madness.

madness 1: when wrong is right and right is complicated

The slope of a function graph is called the function’s derivative. (If you’re familiar with, like, math, this may be known to you.) When your function is a straight line, you get the slope by dividing the difference between two function values by the difference of their arguments. When we write the differences as Δf\Delta f and Δx\Delta x, the derivative can be written as f=Δf/Δxf' = \Delta f / \Delta x. Here, both Δf\Delta f and Δx\Delta x are real numbers. When you have an arbitrary curve instead of a straight line, you can approximate the slope by choosing Δf\Delta f and Δx\Delta x very small. The smaller you make them, the more accurate the result will be. Want infinite accuracy? Make them infinitely small. To make it clear that you’re working with infinitely small numbers (“infinitesimals”), you call them df\mathrm d f and dx\mathrm d x, which gives you f=df/dxf'=\mathrm d f/\mathrm d x. Yay!

But … what are df\mathrm d f and dx\mathrm d x? Both are infinitely small, right? So if you try to calculate df\mathrm d f, you get 00. And if you try to calculate dx\mathrm d x, you get 00, too. If you took any other value for them, they’d no longer be infinitely small, and thus you’d get an inaccurate result. Thus, if df/dx\mathrm d f/\mathrm d x were a normal fraction like Δf/Δx\Delta f/\Delta x, it would be equal to 0/00/0, and we all know never to divide by zero. Hence, since df/dx\mathrm d f/\mathrm d x does have a value, it must be something else entirely. Remember part 2, where I wrote,

If Newtonian mechanics is wrong, why do we still use it so damn much?

In that post, I explained that Newtonian mechanics often gives us the best prediction we can make, and using a “more correct” model would not give us a better result. Maybe this situation is similar: what do we get if we pretend df\mathrm d f and dx\mathrm d x are numbers, and that we just don’t know their values?

example 1. Say you’re told to solve the equation f(x)f(x)=x2f(x) \cdot f'(x) = x^2. This may look daunting at first, but when you write the derivative as df/dx\mathrm d f/\mathrm d x instead of ff', you get

f(x)dfdx=x2.f(x) \cdot \frac{\mathrm d f}{\mathrm d x} = x^2\,.

and multiplying each side by dxdx gives you f(x)df=x2dxf(x)\,df=x^2\,dx. This looks like integrals without the integral signs, so let’s put some on both sides:

f(x)df=x2dx.\int f(x)\,df = \int x^2\,dx\,.

Now we have f2/2=x3/3f^2 /2 = x^3 / 3, so f(x)=2/3x3/2f(x)=\sqrt{2/3} x^{3/2}, and from this you can calculate the derivative f(x)=2/3(3/2)xf'(x) = \sqrt{2/3} (3/2) \sqrt x. Popping this back into our initial equation, we get 2/32/3(3/2)x3/2+1/2=x2\sqrt{2/3}\cdot \sqrt{2/3}\cdot (3/2) \cdot x^{3/2 + 1/2} = x^2. The roots of (2/3)(2/3) combine to a full (2/3)(2/3), which then cancels with (3/2)(3/2), and you’re left with x2=x2x^2=x^2, which tells you that your solution is correct. /example 1.

Owls sitting in shoes
As a reward for getting through the last paragraph, here's a picture of plush owls sitting in shoes. Inhale. Exhale.

In other words, we used a “mathematically” “wrong” approach to correctly solve a problem. In many situations, this is even a good idea. As long as you can prove that what you’re doing works, using symbols that look less mathematically rigorous but lead you to the solution more intuitively can save a lot of time and even help prevent mistakes.

The cool thing about this is: Many people have already realized this, which is exactly the reason we have f(x)=df/dxf'(x)=\mathrm d f/\mathrm d x and curlv=×v\mathrm{curl}\,\vec v = \nabla\times\vec v and so on, which means you can often be pretty wishy-washy about your notation and still end up making fewer mistakes.

madness 2: when math isn’t all clear and unambiguous

Mathematics is known for being clear and unambiguous. And yes, we can definitively2 prove that a theorem is either true or false, in contrast to the sciences where we only have falsifiable hypotheses and probabilities. But the language of math is just as bad as the language of language. Languages take shortcuts, sacrificing semantic clarity for the sake of data transmission rates. This is okay because most of the time everyone knows what you’re talking about.3 They tell you that mathematics doesn’t work that way, but I’m going to make the case that it does.

You know how you do your particle physics homework, and you use the symbol mem_e, and the only thing that symbol has ever stood for was the mass of an electron, and your teacher tries to make this elaborate argument about the importance of declaring your variables but somehow they completely miss that you never told anyone what π\pi means or what ee means or what log\log means, and so on? But then the cutoff point between what you need to define and what’s “obvious” isn’t really clear, and it becomes this huge frustrating mess? That’s the kind of thing I’m talking about. Or you say, “Let pp be the momentum operator,” and your professor complains that pp can’t be an operator because operators always need to have a hat, like p^\hat p, and you say, no, you defined pp to be the operator and shut up you’re being ridiculous, but the professor insists and you end up having to draw a little hat on every single instance of the letter pp in your equations even though leaving it out would give you 100% the correct result and cause zero confusion.

example 3. You have a function f(x,t)f(x,t) you want to integrate over xx.4 You’ll write something like abf(x,t)dx=[F(x,t)]ab\int_a^b f(x,t)\,dx=[F(x,t)]_a^b, right? And here it’s totally not clear if the brackets are to be evaluated with xx as aa and bb or tt as aa and bb. You know, from looking to the left of the equals-sign, but it isn’t clear just by looking at the right half of the equation. Likewise, some authors write volume integrals as Vf(r1,r2)dτ\int_V f(\vec r_1, \vec r_2)\,d\tau, where it’s unclear whether they’re integrating over r1\vec r_1 or r2\vec r_2. They fix this problem by putting explanations in the text and following conventions throughout the book so it’s clear from context what they mean. /example 3.

example 4. Or, instead of integrals, let’s talk about derivatives. When you have a bunch of equations with many partial derivatives, it can be frustrating to write Vx/x,Vy/x,Vx/y\partial V_x/\partial x, \partial V_y/\partial x, \partial V_x/\partial y, and so on, over and over. This is because you’re told that the components of a vector field V\vec V must always be written as (Vx,Vy,Vz)(V_x,V_y,V_z). But since all these letters are only names, you can simply rename the components. For example, you could call the vector field V=(X,Y,Z)\vec V = (X,Y,Z). This already saves you the work of writing a subscript every time you reference one of the components of V\vec V. But as an added bonus, you can now use the subscripts for other purposes, like partial derivatives. Thus, you can define Vx/x\partial V_x/\partial x as XxX_x, Vy/x\partial V_y/\partial x as YxY_x, and so on. This is much shorter and way more fun! I tried that once and my TA was hopelessly confused because they didn’t understand that indices on vectors don’t have to mean selecting the corresponding component, even though I explicitly defined what everything means at the top of the page. /example 4.

Context matters when writing down equations. Everything doesn’t have to be clear in isolation, as long as you explain what’s happening. Obviously this doesn’t mean that you can just write literally anything because then it wouldn’t be clear anymore what you mean. But what you can do is invent new notation and use that if it makes sense. Note, however, that making up your own things isn’t always a good idea: there already exists a large set of shared expectations about what many symbols do and, often, it makes sense to go with established conventions. Like if you’re using other people’s equations, you shouldn’t just exchange all the letters for no good reason, even if you feel like ξ\xi is a much nicer letter than λ\lambda.

In conclusion: Be free, be spontaneous, be brave – give your equations meaning instead of useless hats and subscripts. Sometimes, you really don’t have to repeat yourself.

Footnotes

  1. In the future, when I have a list of my most notable essays, this one will be “The Long, Confusing, Meandering One.” This is my A Feast For Crows in terms of exciting action; it’s my American Gods in terms of quickly getting to the point; it’s my Getting Things Done in terms of elegant phrasing – you get the idea. Think of this more as a piece of performance art, rather than an informative article.

  2. If you ignore external uncertainties.

  3. Except when you’re writing a 2000 word essay on how to use mathematical notation without an outline. What was this guy thinking?

  4. I’m so sorry about all the integrals. And all the footnotes.