- Getting Started with Julia
- Ivo Balbaert
- 397字
- 2021-07-23 20:34:07
Installing and working with IJulia
IJulia (https://github.com/JuliaLang/IJulia.jl) is a combination of the IPython web frontend interactive environment (http://ipython.org/) with a Julia-language backend. It allows you to work with IPython's powerful graphical notebook (which combines code, formatted text, math, and multimedia in a single document) with qtconsole
and regular REPL. Detailed instructions for installation are found at the GitHub page for IJulia (https://github.com/JuliaLang/IJulia.jl) and in the Julia at MIT notes (https://github.com/stevengj/julia-mit/blob/master/README.md). Here is a summary of the steps:
- Install Version 1.0 or later of IPython via
easy_install
orpip
(on OS X and Windows, this is included in the Anaconda Python installation). On Linux, useapt-get install ipython
. (For more information, refer to the IPython home page). - Install
PyQt4
orPySide
forqtconsole
. - Install the IJulia package from the REPL with
Pkg.add("IJulia")
. - Install the PyPlot package with
Pkg.add("PyPlot")
.
You can work with IJulia in either of two ways:
- Start an IPython notebook in your web browser by typing the following command in a console:
ipython notebook --profile julia
- Start
qtconsole
with:ipython qtconsole --profile Julia

The IJulia dashboard on Ubuntu
Verify that you have started IJulia. You must see IJ and the Julia logo in the upper-left corner of the browser window. Julia code is entered in the input cells (input can be multiline) and then executed with Shift + Enter. Here is a small example:

An IJulia session example
In the first input cell, the value of b
is calculated from a
:
a = 5 b = 2a^2 + 30a + 9
In the second input cell, we use PyPlot
(this requires the installation of matplotlib
; for example, on Linux, this is done by sudo apt-get install python-matplotlib
).
The linspace(0, 5)
command defines an array of 100 equally spaced values between 0
and 5
, y
is defined as a function of x
and is then shown graphically with the plot as follows:
using PyPlot x = linspace(0, 5) y = cos(2x + 5) plot(x, y, linewidth=2.0, linestyle="--") title("a nice cosinus") xlabel("x axis") ylabel("y axis")
Save a notebook in file format (with the extension .ipynb
) by downloading it from the menu. If working in an IPython notebook is new for you, you can take a look at the demo at http://ipython.org/notebook.html to get started. After installing a new Julia version, always run Pkg.build("IJulia")
in the REPL in order to rebuild the IJulia package with this new version.
- 計算思維與算法入門
- Java 開發從入門到精通(第2版)
- Microsoft Application Virtualization Cookbook
- 零基礎玩轉區塊鏈
- Java入門很輕松(微課超值版)
- Unity Shader入門精要
- Drupal 8 Configuration Management
- The Complete Coding Interview Guide in Java
- 全棧自動化測試實戰:基于TestNG、HttpClient、Selenium和Appium
- 從零開始學Linux編程
- 區塊鏈技術進階與實戰(第2版)
- QGIS 2 Cookbook
- Building Dynamics CRM 2015 Dashboards with Power BI
- Mastering Embedded Linux Programming
- Android高級開發實戰:UI、NDK與安全