Jaan Tollander de Balsch

Computer Science & Applied Mathematics

Mathematical Programming Workflow with Julia and Atom

One of the many challenges at university, studying applied mathematics, has been finding tools for efficiently solving mathematical and algorithmic problems, and documenting them using a computer. This post covers how to improve your workflow for these kinda of problems using the capabilities of modern code editors and programming languages. These will increase your productivity and make problem-solving more fun and documenting easier.

Required Software

The list of software and tools we are going to be using

  • Atom is modern, cross-platform code editor built using web technologies. The use of web-technologies allows Atom to be extensible, customizable and it enables lots of useful features to work.
  • Julia is high-level, a high-performance dynamic programming language for numerical computing.
  • Pandoc is a tool for converting markup formats into another.
  • Markdown is a lightweight markup language with plain text formatting syntax. Markdown is commonly used to write web content such as blog posts or documentation. Markdown files can be converted into HTML for web documentation or PDFs via Pandoc.
  • LaTeX is a high-quality typesetting system, designed for the production of technical and scientific documentation. LaTeX is required for creating PDFs from Markdown using Pandoc. This is useful for creating handouts from assignments.

Installation instructions

Add Julia, Pandoc, and LaTeX to the path if they were not added to the path during installation.

Atom Packages

Atom preferences
Atom preferences

Packages are what gives Atom its powers. Packages can be added from Edit > Preferences > Packages. Here is a short list of the packages that are needed:

  • language-julia
  • uber-juno
  • latex-completions (This does not work with markdown files when language-markdown is enabled. I don’t yet know how to fix it. Works fine otherwise.)
  • hasklig (optinal but improves readability of Julia code since Julia uses similar syntax as Haskell for some operations)
  • language-markdown
  • markdown-preview-plus uses Pandoc to preview markdown files. This enables support for equation through mathjax and support for citations through pandoc-citeproc.

Some configurations you should configure in the plugins

  • Enable mathjax for markdown-preview-plus plugin

Practicing Skills

Project Euler workflow using Julia and Atom. This image shows how to solve the problem 1 using naive and efficient algorithm.
Project Euler workflow using Julia and Atom. This image shows how to solve the problem 1 using naive and efficient algorithm.
Example of using Markdown with markdown-preview plugin
Example of using Markdown with markdown-preview plugin

One of my favorite ways to practice algorithmic problem solving is Project Euler. Project Euler contains various problems that require both programming and mathematical skills to obtain a solution, especially for the harder problems.

  1. <problem>.jl: Write the algorithm into the Julia file. Common pattern to write the
    • Write the actual algorithm. Julia has a lot of useful properties for mathematical programming which can be found by reading documentation.
    • Use assert(...) to test that your algorithm works for example values that were given in the problem description.
    • Use @time macro to receive running time and allocated memory. Be sure to do this after compiling the function once to obtain a good measurement.
  2. <problem>.md: Write the relevant mathematics into the markdown file. Use markdown preview to preview the HTML version. This is optional but useful for complicated problems.