Mathematical Programming Workflow with Julia

Table of Contents

Introduction

One of the 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 this kind of problem using the capabilities of modern code editors and programming languages. It increases your productivity and makes 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. We require LaTeX for creating PDFs from Markdown using Pandoc, which 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

Packages are what give Atom its powers. Packages can be added from Edit > Preferences > Packages. Here is a shortlist 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 (optional but improves the readability of Julia code since Julia uses a similar syntax as Haskell for some operations)
  • language-markdown
  • markdown-preview-plus uses Pandoc to preview markdown files. It enables support for equations 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 problem 1 using naive and efficient algorithm.
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 harder problems.

  1. <problem>.jl: Write the algorithm into the Julia file. A 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 @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 step is optional but useful for complicated problems.
Jaan Tollander de Balsch
Jaan Tollander de Balsch
Computer Science & Applied Mathematics

Jaan Tollander de Balsch is a computer scientist with a background in applied mathematics.

comments powered by Disqus

Related