Julia

I expect to record some of my early experiences with Julia in this article. For now, I have but a few disjointed notes.

I started with Julia in November 2019. The first exposure I had was based on this book:

Mykel J. Kochenderfer and Tim A. Wheeler
Algorithms for Optimization
MIT Press (March 12, 2019)

Not only were the code examples written in Julia but the entire book was created within Julia: http://tim.hibal.org/blog/how-we-wrote-a-textbook/.

This inspired me to write this entire blog in Julia's Documenter. I can generate both the web site version and a PDF document from the same sources. The process has not gone entirely smoothly but it has overall been worthwhile:

  • I can write in Markdown and LaTeX.
  • I can write example code in Julia and execute the code at document compile time having the results (including plots) embedded in the text.
  • There a macros for cross-references, inclusions, and other operations.

Some problems I encountered stemmed from:

  • The slightly non-standard dialect of Markdown.
  • A bug in the generation of nested lists caused by Windows using CRLF instead of LF as a default line delimiter. Converting all of my sources to use only LF solved the problem. (I have reported this bug to the developers.)
  • A bug where PDF generation prematurely cut-off output of Julia execution output required me to manually patch the code from a published but not incorporated pull request. Fortunately, the PR was easy to apply.
  • A bug where PDF generation does not add an inserted line break using a single backslash at the end of a line (the build process bombs early). I have created a patch to LaTeXWriter.jl which appears to work and will need to report this issue.
  • The documentation for Documenter leaves a lot to be desired. There is a "Showcase" that provides a number of examples that are of considerable help.
  • I need to remember to run MikTex as administrator whenever I re-build the blog. I've forgotten occasionally have been puzzled why nothing worked. Experience and pain make good teachers.

I had considered using Literate.jl which generates Markdown pages for Documenter.jl, Jupyter notebooks, and other platforms. Another alternative considered was Weave.jl. Amd last, I also looked at JuDoc.jl plus JuDocTemplates.jl.

I am serving this blog's static content with nginx. I looked at LiveServer.jl, a Julia web server compatible with live-reload capability.

I had a problem with an update to Julia in Visual Studio Code. The REPL no longer worked properly (it frequently crashed). This may be fixed by now but it motivated me to move any Julia work to ATOM.

I use TeXstudio as a sandbox for LaTeX development. The LaTeX used in the blog is supported by KaTex, an alternative to MathJax for mathematics typesetting.

Overall, I love Julia. I'm not thrilled by the quality of the documentation. I'm writing a signal processing system (a phase vocoder and related functions). I will have a better feel for Julia after I am done. So far, I find it favorably compares to MATLAB - especially being open sourced and is far superior to R.