Rock It 《ML》JupyterLab 【戊】 Julia …

多年來,人們為著不同的目的,創造新的計算機語言。無論自己用或不用,聽聽專家意見總有益處乎?

/julia-mit

Julia for Numerical Computation in MIT Courses

Several MIT courses involving numerical computation, including 18.06, 18.303, 18.330, 18.335/6.337, 18.337/6.338, and18.338, are beginning to use Julia, a fairly new language for technical computing. This page is intended to supplement the Julia documentation with some simple tutorials on installing and using Julia targeted at MIT students. See also our Julia cheatsheet listing a few basic commands, as well as the Learn Julia in Y minutes tutorial page.

In particular, we will be using Julia in the IJulia browser-based enviroment, which leverages your web browser and IPython to provide a rich environment combining code, graphics, formatted text, and even equations, with sophisticated plots via Matplotlib.

See also Viral Shah’s Julia slides and the January 2013 Julia Tutorial videos.

Why Julia?

Traditionally, these sorts of courses at MIT have used Matlab, a high-level environment for numerical computation. Other possibilities might be Scientific Python (the Python language plus numerical libraries), GNU R, and many others. Julia is another high-level free/open-source language for numerical computing in the same spirit, with a rich set of built-in types and libraries for working with linear algebra and other types of computations, with a syntax that is superficially reminiscent of Matlab’s.

High-level dynamic programming languages (as opposed to low-level languages like C or static languages like Java) are essential for interactive exploration of computational science. They allow you to play with matrices, computations on large datasets, plots, and so on without having to worry about managing memory, declaring types, or other minutiae—you can open up a window and start typing commands to immediately get results.

The traditional problem with high-level dynamic languages, however, is that they are slow: as soon as you run into a problem that cannot easily be expressed in terms of built-in library functions operating on large blocks of data (“vectorized” code), you find that your code is suddenly orders of magnitude slower that equivalent code in a low-level language. The typical solution has been to switch to another language (e.g. C or Fortran) to write key computational kernels, calling these from the high-level language (e.g. Matlab or Python) as needed, but this is vastly more difficult than writing code purely in a high-level language and imposes a steep barrier on anyone hoping to transition from casual experimentation to “serious” numerical computation. Julia mostly eliminates this issue, because it is carefully designed to exploit a “just-in-time compiler” called LLVM, making it possible to write high-level code in Julia that achieves near-C speed. (It also means that we can perform meaningful performance experiments easily in courses where this matters, e.g. in 18.335.)

Speed, while avoiding the “two-language” problem of requiring C or Fortran for critical code, is the initial draw of Julia, but there are a few other nice points. Unlike Matlab, it is free/open-source software, which eliminates licensing headaches and allows you to look inside the Julia implementation to see how it works (since Julia is mostly written in Julia, its code is much more readable than a language like Python that is largely implemented in low-level C). For calling existing code, it has easy facilities to call external C or Fortran libraries or to call Python libraries. Multiple dispatch makes it especially easy to overload operations and functions for new types (e.g. to add new vector or numeric types). Julia’s built-in metaprogramming facilities make it easy to write code that generates other code, essentially allowing you to extend the language as needed. And so on…

 

因此補筆

/IJulia.jl

Julia kernel for Jupyter

IJulia logo

Build Status Build status

IJulia

IJulia is a Julia-language backend combined with the Jupyter interactive environment (also used by IPython). This combination allows you to interact with the Julia language using Jupyter/IPython’s powerful graphical notebook, which combines code, formatted text, math, and multimedia in a single document. It also works with JupyterLab, a Jupyter-based integrated development environment for notebooks and code.

(IJulia notebooks can also be re-used in other Julia code via the NBInclude package.)

Installation

First, download Julia version 0.7 or later and run the installer. Then run the Julia application (double-click on it); a window with ajulia> prompt will appear. At the prompt, type:

using Pkg
Pkg.add("IJulia")

to install IJulia.

This process installs a kernel specification that tells Jupyter (or JupyterLab) etcetera how to launch Julia.

Pkg.add("IJulia") does not actually install Jupyter itself. You can install Jupyter if you want, but it can also be installed automatically when you run IJulia.notebook() below. (You can force it to use a specific jupyter installation by setting ENV["JUPYTER"] to the path of the jupyter program before Pkg.add, or before running Pkg.build("IJulia"); your preference is remembered on subsequent updates.

 

安裝及驗證︰

 

 

順道告知偶見一書

/ThinkJulia.jl

Port of the book Think Python to the Julia programming language

ThinkJulia.jl

Port of the book Think Python to the Julia programming language: online version

 

或止心頭『餘波蕩漾』徘徊也!