traviscj/blog

Posts

May 15, 2013

org-mode emacs to track mileage

I’ve been trying out emacs org-mode lately for keeping track of everything. One thing that seemed worth tracking is the mileage the new Focus gets. Turns out that org-mode supports a kind of spreadsheet, so I made a quick little video demo on how I use it:

read more
April 10, 2013

Getting really fast at LaTeX

Taking LaTeX notes in real time is one of my favorite useless party tricks. I started developing my techniques during the last year or two of undergraduate work at University of Washington, and was extremely good at it by the end of coursework at Northwestern. There are several keys to taking LaTeX notes in real time:

  1. Know LaTeX.
  2. Shortcut appropriately.
  3. Type keystrokes quickly.
  4. One keystroke re-renders.
  5. Type fewer keystrokes.
  6. Type fewer “strange” keystrokes (backslashes, curly braces, etc)
  7. Re-renders should scroll to your current location in the text.
  8. Extremely rapid debugging of LaTeX expressions.

Before I get started, one other note: I mention TextMate a few places, but in principle there is no reason you couldn’t configure all the same things in Vim, Emacs, or Sublime Text. If I was starting over, I might use Sublime Text instead.

read more
March 13, 2013

implementation of set operations

We got in a bit of a debate yesterday in the office over the implementation of associative containers, which I thought was pretty fun. We made up the big chart of complexity results you see below.

nomenclature:

  • $S$, $S_1$, and $S_2$ are subsets of $\Omega$.
  • Denote an element by $e\in\Omega$.
  • $n$,$n_1$,$n_2$,$N$ are the sizes of the set $S$, $S_1$, $S_2$, and $\Omega$, respectively, and $n_1 \geq n_2$.

Complexity

Operation\Approach Hash Table Hash Tree Binary List Entry List (sorted) Entry List (unsorted)
$e \in S $ $O(1) $ $O(log(n)) $ $O(1) $ $O(log(n)) $ $O(n) $
$S_1 \cup S_2 $ $O(n_1+n_2) $ $O(n_1+n_2) $ $O(N) $ $O(n_1+n_2) $ $O(n_1n_2) $
$S_1 \cap S_2 $ $O(n_1) $ $O(log(n_1)n_2)$ $O(N) $ $O(n_2) $ $O(n_1n_2) $
space complexity $O(n) $ $O(n) $ $O(N)$ bits. $O(n) $ $O(n) $

As I said–this was just what came out of my memory of an informal discussion, so I make no guarantees that any of it is correct. Let me know if you spot something wrong! We used the examples $S_1 = {1,2,3,4,5}$ and $S_2 = {500000}$ to think through some things.

read more
February 15, 2013

website basics

Several of my classmates in graduate school are considering making websites around now, and have asked me to explain it. I figured I’d explain the stack as I have it set up, and where you could make tradeoffs. For now, I’m not going to include too many detail here; I just want to outline the possibilities and lingo so that researching options is a bit easier for the uninitiated.

First off, many people are perfectly happy to use the school’s email and department web space. If you only want to have a list of relevant papers and soforth, then this is a fine approach. See the very bottom of this post for a couple potential ideas for organizing it.

read more
January 26, 2013

some tips for project euler problems

I wanted to make a list of a few tips on solving Project Euler problems that have been helpful for me while I solve them. These are general principles, even though I do most of my Project Euler coding in Python.

Without further ado:

  • If the problem is asking for something concerning the number of digits, typically this indicates that the use of the $\log n$ function is warranted.
  • If the problem is asking for the last few digits, modulo arithmetic might speed it up considerably.
  • Some might consider this cheating, but looking up some small numbers in the Online Encyclopedia of Integer Sequences is occasionally pretty helpful.
  • Many problems boil down to: Find numbers with property $X$ and property $Y$. Two solutions are:
    • Brute force: Try all numbers with tests of property $X$ and $Y$.
    • Find numbers with property $X$ and filter by a test of property $Y$.
    • Find numbers with property $Y$ and filter by a test of property $X$.
    • Find the set of numbers with property $X$ and the set of numbers with property $Y$. Compute their intersection.

I’ve found that it’s sometimes hard to predict which one will end up being the fastest. It depends on the relative speed of the tests and the generators, and the frequency of finding numbers which have that property.

read more
December 16, 2012

Some Recent Photography

My girlfriend and I were out by the lake taking pictures recently. I was trying to get the Chicago skyline, but we really weren’t in the right place for it. So instead I settled for taking some long exposure photos of stuff I found.

I think they came out pretty good, especially because it was all a ruse to get her to the lakefront so that I could ask if she would marry me. She said yes!

read more
November 20, 2012

Game of Life

When I was a sophomore in high school, I was fascinated with [ Conway’s Game of Life]. I still am. I did a pretty rudamentary study of the kinds of patterns that could form from the simple rules of the game.

One thing that wasn’t available when I was a sophomore was Youtube. Two of my favorite Game of Life videos:

  • lifeception
  • epic life

Another direction that Game of Life has gone recently is something that I really should have thought of, honestly. Many times I’ve thought that there’s at least some superficial relationship between Game of Life and diffusion equations. Turns out that S. Rafler has extended Game of Life to continuous domains through what he calls SmoothLife.

read more
October 22, 2012

Perturbation Theory Problems with bvp4c

I have been watching Nathan Kutz’ lectures on Coursera. One change he made to the course since I took AMATH 581 at University of Washington was introducing the MATLAB function bvp4c. I immediately realized that this would be nice for solving boundary layer problems that arise in asymptotics.

Following my life philosophy of doing the dumbest thing that could possibly work, I tried implementing Nathan’s code for a single-layer boundary layer problem from Holmes, Chapter 2:

read more
September 28, 2012

more stupid matlab tricks

I’ve been setting up long-ish runs on my MATLAB instance lately, which is nice because I can wanter off to do something else. The trouble is that I occasionally forget to come back or refocus on work again.

I’ve come up with two solutions to this:

  • The first is to use growlnotify to pop up a persistant growl message. This works well enough as long as I’m at the computer:
system('growlnotify -s -m "somefile is done"')
  • For more extended aways or if I’m going to take a nap while it runs, I might do something more like:
system('echo "matlab: uflX_aw_constr_log_5_15 done" | msmtp -a traviscj (mycell)@txt.att.net')

You need some setup before this works: I did a brew install msmtp and set up a .msmtprc file. After that, it should work goldenly, at least for AT&T customers. Others might need to look up their email/sms gateway number.

read more
August 16, 2012

debugging matlab mex

One thing I’ve been doing a bit of lately is debugging MATLAB mex files; it seemed worth documenting. The broad strokes:

  • recompile all mex codes with ‘-g’
  • quit MATLAB
  • From a command prompt, run
$ /Applications/MATLAB_R2012a.app/bin/matlab -Dgdb
[snip]
(gdb) run -nojvm
>> run_your_mex_file

This gives debugging output. If there is an error in the code, you’re dropped back to a gdb prompt, where you can continue debugging in a semi-normal fashion. Typically, I end up doing a ‘where’ to get a stack trace, and debug from there more-or-less like usual.

read more
  • ««
  • «
  • 9
  • 10
  • 11
  • 12
  • 13
  • »
  • »»
© traviscj/blog 2025