This is an 8-hours crash course to get going with the julia computing language.
It says in the title for Economists, but that's mainly because I am one myself, and people in the profession asked me to teach this course; That said, you don't need any specific economics knowledge for this course.
We have 8 blocks of one hour each. Each block will be interrupted several times along the way to check whether what I just said makes sense to you, and to allow you to formulate questions.
We did the first session freestyle, in terminal and VScode (see below). then we switched to notebooks.
Notice that the notebooks are visible online at https://floswald.github.io/julia-bootcamp/. You will need those during the questions in class!
You can either download the notebooks from the website to run locally, or you clone this repository - the notebooks are identical, so whatever you prefer.
- assigning variables
- arrays
- datatypes
- functions and programming constructs
- performance
- plotting
- interactive plotting and dashboards
- installing julia
- installing vscode and julia extension
- Optionally in vscdoe, shift-cmd-p for command palette, then type shell command to put
code
onto yourPATH
such that you can start it from the command line.
- Optionally in vscdoe, shift-cmd-p for command palette, then type shell command to put
- Optionally customize the julia startup file at
~/.julia/config/startup.jl
- I put my
startup.jl
here into this repository for you to copy to~/.julia/config/startup.jl
on your computer if you want. - It sets sticky shell mode: if you hit
;
in the julia REPL, it will switch to shell mode (so you are on your OS console). By default that switches back after your last shell command returns - not with sticky mode, where it will only switch back if you hitbackspace
. - set vscode as standard editor: when you use the
@edit
macro for instance, it will open vscode to look at the source code.
- I put my
- running julia as standalone app
- running julia inside vscode
- starting julia from the command line
- important locations and directories, different julia versions, etc
- working with the REPL
- help mode: find
max
help and compute the maximum over numbers3,5,10
- help mode: find
ifelse
function and runifelse(3 < 5, 3,5)
- do
@edit max(3,5)
and look at source code - println function hello world
- help mode: find
- running a file in vscode:
01.jl
include
function:01.jl
- workflows for modules: https://docs.julialang.org/en/v1/manual/workflow-tips/#A-basic-editor/REPL-workflow
- assigning a variable. standard, unicode, maths
- What are packages? In words.
- How to install? Whose package? Where from?
- Different package versions and environments. the
Project.toml
file. - installing a package: distributions
- create file
02.jl
, say you want to use the Distributions package and create a normal distribution withn = Normal(1.0,0.5)
. - look at
?quantile
(last entry) and?pdf
and finally compute the value of the pdf at the 0.95 quantile of your distributionn
- create file
I have a more complete course, also more relevant for Economists, at this website. Maybe have a look there if you are looking for econ-specific applications. Another great place for such a search is by the way the QuantEcon project by Perla, Sargent and Stachurski.
I will not give you any homeworks, however, you may want to practice a bit more. I have several fully worked homeworks on my course website, which you could have a go at if you wanted.
Finally, I'm quite fond of my julia implementation of @fediskhakov 's et al discrete choice EGM paper, so check it out at https://github.com/floswald/DCEGM.jl, in particular the MLine
data type which is really cool 😎.
There are too many things to cover. Let me try with a quick list:
- https://fluxml.ai/
- https://jump.dev/
- https://makie.juliaplots.org/stable/ and https://lazarusa.github.io/BeautifulMakie/
- https://turing.ml/stable/
- https://julia.quantecon.org/intro.html
- all free courses at https://juliaacademy.com/
- DataFrames.jl
- Parallel computation guide by Jesus Fernandez-Villaverde and David Zarruk and everything on Jesus' website.
- University of Barcelona. Videos made with consent of participants.
- Bocconi
- SciencesPo
I used examples and got inspiration from several excellent tutorials out there to build this boot camp:
- Think Julia by @benlauwens is fully comprehensive and very complete intro to julia, which I highly recommend.
- The Julia Express by @bkamins is a much condensed version - great for a quick start.
- From Zero to Hero by @datseris is a great tutorial series, bit more advanced but great insights for beginners as well.
Have a look at the dedicated section on the julialang website for more great material!