Getting Started With Julia
Install Julia
Grab the installer for Windows at http://julialang.org/downloads/. If using Ubuntu, run the following:
sudo add-apt-repository ppa:staticfloat/juliareleases
sudo add-apt-repository ppa:staticfloat/julia-deps
sudo apt-get update
sudo apt-get install julia
Install Light Table and Juno
R users are quite spoiled by RStudio. Julia used to have Julia Studio, but it seems the developers from Forio who developed Julia Studio are no longer employed there. It may be a while (or never) before development starts up again. In the meantime, Juno, and even more recently JuliaBox, may be the way forward for Julia IDEs. Since JuliaBox isn’t quite ready, I chose to go with Juno.
- Download Light Table from http://lighttable.com/
- Follow the instructions from here
-
tar -xzf LightTableLinux*.tar.gz
-
sudo mv LightTable/ /opt
-
sudo mousepad /usr/share/applications/light-table.desktop
[Desktop Entry] Version=1.0 Name=Light Table GenericName=Text Editor Exec=/opt/LightTable/LightTable Terminal=false Icon=/opt/LightTable/core/img/lticon.png Type=Application Categories=GTK;Utility;TextEditor;Application;IDE;Development;
-
sudo ln -s /opt/LightTable/LightTable /usr/local/bin/ltable
-
- Install the Juno plugin within Light Table
- Open Light Table and hit
Ctrl+Space
. - Type in “show plugin manager” and select.
- Search for “juno” and install.
- Hit
Ctrl+Space
and select “user behaviors”. - Change “default” to “june” or “june-night” in the config file. (june not a typo)
- Restart Light Table. It should start spinning up Julia and show it’s connected.
- Open Light Table and hit
I’ve noticed, at least under Ubuntu, that after loading a Julia package, Light Table and Julia peg the cpu at 7%. I’m assuming this is a bug… For an alternative, check out the Sublime Text Julia plugin.
Running Code
To evaluate a line of code in Juno, use Ctrl-Enter
. Run Pkg.installed()
to see the currently installed Julia packages.
Plotting
# Install the Gadfly graphics package
Pkg.add("Gadfly")
# Load the Gadfly Graphics package
using Gadfly
# Plot a function
plot(sin, 0, 2)
Statistics
# Install some extra statistics packages
Pkg.add("HypothesisTests")
Pkg.add("Distributions")
# Load the packages
using HypothesisTests
using Distributions
# Create some random data
rnorm = rand(Normal(), 30)
# Create a confidence interval
ci(OneSampleTTest(rnorm))