[<< wikibooks] Pulsars and neutron stars/Introduction to Julia for pulsar astronomers
== Introduction ==
Julia is a relatively new language that is extremely powerful, but the current documentation is difficult to find and understand.  Here we provide some notes of interest to pulsar astronomers.  Many of the figures in this wiki-book were produced using Julia. Julia can easily be [downloaded and installed on most computers.  It has its own powerful routines, but it is also possible to use Python or C code directly.  It has been designed for parallel or distributed computing and the programmers take pride in the speed that the code runs - it is much faster than Python.

== Getting started ==
Julia can be run from a personal computer, using Julia notebooks or using a webhosting service.  Julia can be used as a simple calculator

It is also possible to write algebraic expressions (in a simpler manner than in most languages)

Strings can easily be created:

Note that the use of the ";" on the end of the line.  If used then no output is given for that line.

== Making arrays of values ==

will allocate 100 values from 0 to 99.  The second command will add 10 to each element in the array.
To set an array that is initialised to zero, we can use:

will allocate an array of 100 zeros.
To allocate random Gaussian noise with zero mean and variance of 1, we can write:

Note the use of the # symbol as a comment.

== Making plots ==
There are multiple ways to make plots in Julia, but they require the addition of new packages.  The packages are:

GastonTo install the package, e.g.,:

=== Gaston ===
Gaston is based on gnuplot, which needs to be independently installed on your system.

We can also use two arrays:

=== Winston ===
This produces MATLAB style plots

Figures can also be built up from multiple components as follows:

=== pyplot ===
Pyplot using the python plotting routines

Aitoff projections can be plotted using:

== Reading and writing files ==

== Maths routines ==