Getting Started with Julia
Introduction
This course uses Julia as the primary programming language for assignments and projects. Julia is a high-level, high-performance programming language for technical computing. Julia is designed for numerical and scientific computing, and it is fast, flexible, and expressive.
This short guide will help you get set up with Julia and start writing and running your first programs.
1. Installing Julia
1.1 JuliaUp (Recommended)
JuliaUp is a convenient tool for installing and managing multiple versions of Julia on your system:
Follow the instructions at JuliaUp on GitHub.
Once installed, you can open a terminal (or PowerShell on Windows) and run:
This will launch the Julia REPL (Read-Eval-Print Loop).
1.2 Direct Installation
Alternatively, you can install Julia directly from the official Julia website. Download the appropriate installer for your operating system, follow the installation prompts, and then run the julia
executable.
2. Using Julia in VS Code
Visual Studio Code is a popular editor for Julia:
- Install VS Code from the official website.
- Add the Julia extension:
- Open VS Code, go to the Extensions tab (left-hand side), and search for “Julia”.
- Install the Julia extension.
- Configure Julia Path (if needed):
- Press
Ctrl + Shift + P
(orCmd + Shift + P
on macOS) and type “Julia: Select Julia executable path”.
- Select the path to your Julia installation.
- Press
You can now open a .jl
file, and VS Code will automatically provide syntax highlighting, inline execution, debugging features, and more!
3. Running Julia in a Jupyter Notebook
Jupyter notebooks allow you to mix code, results, and explanations in one place:
Install Jupyter (if you have Python/Anaconda):
Add the IJulia package in Julia:
Launch Jupyter from your shell/command prompt:
Create a new Julia notebook from the Jupyter interface.
You can now write and run Julia code in Jupyter cells!
4. Experimenting with Pluto
Pluto.jl is a reactive notebook environment for Julia:
Install Pluto:
Start Pluto:
Follow the link that appears in the Julia REPL to open a new Pluto notebook in your browser.
Pluto notebooks reactively update outputs whenever you modify a cell, making it easy to experiment and visualize results quickly.
5. Report Writing Tools
These tools can help you write reports and documents in Julia. Once setup, they are easy to use and can generate beautiful documents:
Final Tips
Julia REPL: Press
?
at the Julia REPL for help on any function (e.g.,?println
).
Package Manager: Press
]
in the REPL to enter package mode. For example:Official Documentation: Visit docs.julialang.org for the complete Julia manual, tutorials, and more.
Discourse Forum: The Julia Discourse forum is a great place to ask questions and learn from the community.
Enjoy exploring Julia for computational optimization! If you have any questions, please reach out on our class forum.