Julia & Pluto

In the solution and simulation of DSGEM, we will use an IDE (Integrated Development Environment) called Pluto.jl. This IDE is a computing package developed for the Julia computing language. This language is easy to learn, beautiful, and extremely powerful. In the world in which we live, keeping on solving exercises that require high computational power with slow and expensive computing languages is like being still in the age of the first industrial revolution. We have to adapt quickly at the age of "Big Data", "Artificial Intelligence", and "Machine Learning", even in teaching tools and course syllabus.

Moreover, all tests in this course will be taken using a computer and Pluto IDE. It means that tests will be "open book", but students have to know how to use Pluto quite well. Students will have to learn the basic operations in Julia and Pluto.

Julia is an open-source computation language (so we do not have to pay for it), developed at MIT, user-friendly, and very fast. Today, to go with the flow, either we choose Julia or Python. Julia is better for economics and high-performance computing; for examples see here.

The installation of the software below will be done in the first session on our short-term course on computation (8 September, 14:30, Room C607, Building II). See "News" for more information.

Do not install it by yourself. You do not need more than 450MB of free space in the hard disk of your computer.

1. Install Julia. Go to the following address:

  • https://julialang.org/downloads/

  • Download the executable that suits your computer's Operating System (Windows, macOS, Linux)

  • Run the executable file.

  • Allow the executable to install the program in the default directory

  • Click on the small box: Add Julia to PATH (see box on the right hand side)

  • The installation will run quite fast.

  • Click on finish. Julia is installed.

2. Start using Julia:

  • Double click on the icon of Julia: 3 little circles

  • A black window will pop up: this is Julia's window, also called the REPL (you can make it the size you want: larger, taller)

  • Type: 3*4 , then click on enter. If the output is 12, Julia is running.

  • Julia executes under two modes:

    • Julia mode: julia> . This is the default mode, it appears whenever you open Julia. It is in this mode that computation takes place.

    • Package mode: (@v1.6) pkg> . This mode is designed to manage the packages that we want to install, upgrade, or remove.

  • To switch from one mode to the other:

    • Julia mode: start Julia

    • From Julia mode to Package mode: pressing the keyboard ] key

    • From Package mode to Julia mode: on the keyboard click on backspace.


3. Managing packages:

  • At the current time, there are more than 6000 packages available.

  • We should only install the packages that are necessary for our current work. Some packages have conflicts between themselves. In most cases, those conflicts are manageable, but sometimes some packages are just incompatible.

  • The following commands are used to manage the packages' system. Be sure you are in the Package mode: (@v1.6) pkg>

    • add PackageName --> enter : adds a package called PackageName.jl to the Julia environment (obviously, PackageName.jl is an illustration).

    • remove PackageName - -> enter :removes a package called PackageName.jl from the Julia environment. (we can use the short name rm)

    • update --> enter :updates the packages installed in the Julia environment to the latest versions. (we can use the short name up)

    • status --> enter : shows all packages installed in the Julia environment. (we can use the short name st)

4. Packages. To install the packages we need:

  • Go to Package mode and type: add PackageName, then click enter (do it one by one, in the list below).

  • These are the packages that we have to install (attention: they are case sensitive and no spaces between package names)

add LinearAlgebra

add DataFrames

add PlotlyJS

add PlotlyBase

add HypertextLiteral

add Pluto

add PlutoUI

add CSV

add HTTP

add TimeSeries

add RollingFunctions

add Dates

add MonthlyDates

add SparseArrays

add StatsBase

add ColorSchemes

add LaTeXStrings

add NLsolve

add JuMP

add Clp

add GLPK

add Ipopt

add Symbolics

add Distributions

  • If you want also install the three packages below (you may find things on the internet that use them)

add Plots

add Statistics

add Random

5. Start using Pluto:

  • In Julia mode type: using Pluto then enter (note the space between using and Pluto)

  • Then type: Pluto.run()

  • That's it: Pluto has opened a browser window. That is where you will work with Pluto using Julia as the engine at the back.

6. Opening a notebook with Pluto:


  • Copy the directory where your notebook is saved. Past that address to the small box you see on the figure on the right.






  • Click on the directory and choose the file you want to open (the file must have an extension .jl ) See box on the right.


  • The notebook is now ready to use.

7. Saving a notebook with Pluto:

  • When you apply changes to a notebook, immediately a small box displaying ctr+s appears at the top right corner of your monitor. If you click on it, the changes to the notebook will be saved. Or then, to save changes, just press simultaneously the keyboard keys : ctrl s


  • Notice that you can save a notebook in three other formats:

    • Julia file

    • HTML file

    • pdf file


  • To do that, go to the beginning of your notebook. There is a small icon with the export box at the top right-hand side of the monitor; click on it. This icon can be seen on the figure on the right.

  • The three alternative ways of saving your notebook are clearly visible at the top of the monitor.