Writing math articles: be a good leader

The end of the semester is upon me (and many others). It’s time for editing papers and reviewing lots of things, as well as working on my own writing. I’ve got three senior project students, three other research groups, and my own papers-in-progress. Some themes recur.

Big analogy: You’re waltzing or salsa-ing at a delightful party. Pick the music to suit your paper.

  • The paper author is the leader in this dance. A good leader shifts pressure back and forth from the base of the palm of the hand to the fingers, and up and down, to tell the following dancer what he intends, three-quarters of a beat before it is to occur. I’m not a great dancer, but when I am partnered with a great lead, I know exactly what’s coming and I can do my best to execute — and I end up looking like a good dancer! In the math paper, tell the reader what move is coming. It is ok to say, “Now I’ll define factorials, which are the number of ways n objects can be arranged in order.” If the reader knows what is coming, she can prepare, and she’ll feel successful!
  • Build trust with your reader/follower before asking for faith. Before you can carry out fancy moves, you need trust with your reader/dance follower. Don’t ask the reader to read three pages of complicated stuff without telling them where you’re going. Do tell them explicitly where they’re going first. Don’t confuse motivation with explicit signals like this — telling your dance partner, “This will be great in an hour!” is not the same as telling your dance partner, “You will twirl and then we’ll go backwards for a measure.” The second builds trust. The first sounds good, but the reader may not trust you yet.
  • The number of words you write is proportional to the faith you ask. Reading takes time, as does dancing, and time is something we can’t recover. If I’m not dancing with the person I’m in love with, I like best dancing with someone who alternates between fancy moves & relaxing bits. Dancing salsa with someone who never does turns or twirls is boring. Box stepping through an entire waltz is boring. Too many words without math ideas is boring! One easy way to start dealing with this is deleting words if they aren’t necessary. “In some sense these are dual to one another, where we define dual to mean…” -> “These are dual to each other: define dual as…”  “We will present a defintion…” -> “We define…” It helps you get to the fancy moves faster 🙂
  • It’s a party! Introduce your guest to everyone! References and citations are not just for information you used to do the math. They’re also resources for the reader if she’d like to learn more or follow up on a tangent or know who else worked on this. So introduce your reader to everyone else at the party! and use names! Rather than, “See [1],” it’s so much more hospitable to say, “To read more about algebraic varieties, see the excellent book by Smith, “An Invitation to Algebraic Geometry.””
  •  Seriously, introduce your guest. Here are the people I hang out with (mathematically) all the time and their related papers. Here are the folks I totally disagree with in approach, but we talk about the same math. Here are the people who did the original work on this problem — it was 40 years ago but they can still dance! Here are some good additional resources. Besides being hospitable, references show that you have a command of the field, they make other authors feel good (someone read my paper?!), they allow the reader to potentially notice that there’s a set of articles on the same topic but in math physics that you never heard of and you should really get introduced…!

Ok, that’s it for now. I’m by no means a perfect writer, but it’s a skill I work on regularly. Good luck!

(Yes, I know my dance example here is super heternormative, but trying to do something clever about it would not help the reader or the message…)

Topological data analysis at Minnesota Developers Conference

I’m at the Minnesota Developers Conference today, talking about topology and data. Hoping it’ll be fun to talk to developers about math and data! In the meantime, looking at cryptography and microservices and containerization. I’m working on trying to containerize some of my own projects…. but you might hear about that if you come to my talk.

Ok, links:

  • Here’s an older Github repository of info about TDA in R. There, launch a binder to try out the code yourself! Just press the “binder” button! This uses Docker to give you an R environment.
  • Here is a link for exploring super-level sets in Dow Jones data during the period 1991-2002, leading up and through the dotcom bust. You can change the threshold (what level of correlation you want to cut off the graph edges at) and you can play with the year.
  • Here is a link to an R Shiny page for exploring persistent homology in Dow Jones data during the same period, 1991-2002. Warning: it’s slow to load due to the persistent homology calculation at the beginning — give it a minute. Watch the red dots slide down and to the left as the crash happens. Why are there two groups of red dots at one point, in 2001?

If you want to learn more about using topology with big data, here are some links:

  • I’ve enjoyed creating visualizations with Kepler-mapper, a Python package. In my talk, some of the images of macroeconomic data are created using Kepler-mapper. Check out the examples there — they’re beautiful.
  • To make prettier mapper visualizations in R, I make heavy use of networkD3 and IGraph. IGraph also has Python bindings.
  • In Python, computation of Betti numbers for analysis of the stock crash-recovery cycle was done using moguTDA.
  • In R, I use TDAmapper for mapper visualization and TDA for persistent homology.

If you’re looking for other resources, my free Preparation for Math Finance course textbook is accessible and often-updated since I’m teaching right now. What else? Flash sale on coloring books 🙂

Installing Dionysus for Python

Today I finally managed to install Dionysus 2, a library for computing persistent homology. I easily set up Kepler-mapper a long time ago, and had given up on Dionysus previously. Dionysus 2 is a re-write that streamlines many things and promises to make installation easier and implement more plotting. Again, I had trouble installing the package, but this time I didn’t give up and eventually met with success.

First, I’ll say that I’m using the Anaconda distribution for Python etc. I have Python 2.7 as the base installation but have almost entirely switched over to Python 3 for my other work. I was merrily going on my way trying to install Dionysus 2 in my Anaconda Python 3.4 environment for a while. First I tried pip, following the commands under the “Get, Build, Install” section  link. I ran into some permission problems, some problems with Boost. Given that, I tried cloning the git repository. Still problems with Boost, though I had a fresh install of that as well. After the cmake .. command, I got problems like this:

— Could NOT find Boost

— pybind11 v2.2.0

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:


and then a string of things. I modified my CMakeCache.txt file; modified the  CMakeLists.txt file; tried all sorts of things. Failures. Ok, incremental progress — I think I got it finding the Boost libraries and managed to get my error messages to 

— The C compiler identification is Clang 7.3.0

— The CXX compiler identification is Clang 7.3.0

— Check for working C compiler: /usr/bin/cc

— Check for working C compiler: /usr/bin/cc — works

— Detecting C compiler ABI info

— Detecting C compiler ABI info – done

— Check for working CXX compiler: /usr/bin/c++

— Check for working CXX compiler: /usr/bin/c++ — works

— Detecting CXX compiler ABI info

— Detecting CXX compiler ABI info – done

— Could NOT find Boost

— Found PythonInterp: /Users/kaisa/anaconda/envs/py34/bin/python (found version “3.4.5”)

— Found PythonLibs: /Users/kaisa/anaconda/envs/py34/lib/libpython3.4m.dylib

— Performing Test HAS_CPP14_FLAG

— Performing Test HAS_CPP14_FLAG – Success

— pybind11 v2.2.0

— Performing Test HAS_FLTO

— Performing Test HAS_FLTO – Success

— LTO enabled

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:


Through Googling, I found a message thread talking about using conda to install instead. I hadn’t realized it was a conda package! I tried

conda install -c conda-forge dionysus

instead — and there I learned many things!  It listed many packages to download or upgrade, and then

The following packages will be DOWNGRADED:

pillow: 3.3.0-py34_0 –> 3.2.0-py27_0conda-forge

pyqt: 4.11.4-py34_4–> 4.11.4-py27_2 conda-forge

python: 3.4.5-0–> 2.7.14-0conda-forge

python.app: 1.2-py34_4 –> 1.2-py27_0conda-forge

Proceed ([y]/n)? n

What? It wants to downgrade my Python version? Is this the whole problem?!

I switched environments to my Python 2.7 install and repeated

conda install -c conda-forge dionysus

and it installed with no problem.

Had to remind myself that for my Python 2.7 install, I use “ipython notebook” to make new notebooks, rather than “jupyter notebook”, but after that I was able to interact with Dionysus 2 and run all the examples from the tutorial.

So, that’s my story. Maybe there’s a Boost problem, a path problem, whatever, but I think the real problem is that Dionysus 2 is built for Python 2.7 not Python 3.*, and so I’ll just have to make full use of the Anaconda distributions easy environment-switching. This Python version issue is not noted anywhere I saw online.