In this lecture we will start talking
julia! We will go through a series of notebooks in tutorial style. Here is again a table with pre-rendered notebooks for you to look at:
|Defining Data Types||click for notebook|
|Intro do Differential Equations||click for notebook|
Table of Contents
How to start a julia REPL
How to run code line by line
How to run a file
More advanced features (already couple of months back, but still) are explained in this video by one of the package authors.
What is a
A separate name space.
We can group together functions from different files using the
Notice there is no relationship between function names and file names, like for instance in matlab or python.
you decide what is
exported from the package, if anything, with the
module MyExampleModule using Statistics # if any imports include("files1.jl") include("functions2.jl") include("data.jl") export xyz_fun # if any exports end # module
What's a package?
Why do we need packages?
Here an Example
The problem with user-contributed packages and open source software is that there is no central authority imposing a strict versioning.
[Why not? 👉 Because thou shall not force volunteers to do stuff (Benabou and Tirole).]
For example, my package could depend on a feature of your package.
You decide to remove that feature.
My package breaks.
What do other open source languages do here?
R: nothing. You install whichever version you want and hope it all works. Latest versions is a good idea.
python: versioning problem comes even before packages! Python 2.7 incompativel with python 3.6. So we have virtual environments for different python versions
It can get complicated really easily.
What is an environment
It's like a box inside which a certain set of versions can be assumed.
It's great for reproducibility: you know exactly which set of versions produced which set of results.
A docker container is an example of an environment in a remote data center, where you specify what kind of machine you want and what software should be available.
Pkg.jl package manager.
Environments are specified in a text file
Project.toml at the root of a given package or folder.
It specifies the required packages to run the current project (or whatever code you have in the current folder)
You can see an example here
A second file called
Manifest.toml specifies the exact list of dependencies that are implied by the packages you rely on in
Manifest.toml in a folder provides an exact snapshot of the code needed to reproduce the results.
It's a major step ahead to improve reproducibility of results.
Demonstrate how to activate a package in REPL.
] package manager commands and
You will notice that there are two different notebook formats in our course: the new Pluto.jl format, and the more traditional jupyter notebook. Here's a quick video of how to launch a jupyter notebook server on your computer to run those notebooks - on the example of our course content.