これはなに
10.9.5 mavericks にJuliaをインストールしたときのメモ。
インストールメモ
Julia 関連のリンク
- 公式サイト http://julialang.org/
- Julia Studio公式 http://forio.com/labs/julia-studio/
Julia Studioの罠
Julia StudioはJulia環境が含まれているので、Julia Studioだけ落とせば基本的にJuliaが動く環境が出来る。
しかし、Mac版は最新版ではないJulia0.2がバンドルされる点に注意。
というわけで、今回はJulia Studioの導入はあきらめた。
Juliaのインストール
公式サイト http://julialang.org/downloads/ からインストール。
特にインストールに特別な作業はいらず、アプリケーションフォルダにぶち込むだけ。
ダブルクリックすると、ターミナルが動く。
$ exec '/Volumes/Julia/Julia-0.3.1.app/Contents/Resources/julia/bin/julia'
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.1 (2014-09-21 21:30 UTC)
_/ |\__'_|_|_|\__'_| | 'Official http://julialang.org/ release'
|__/ | x86_64-apple-darwin13.3.0
julia>
plot環境のメモ
パッケージ調査
プロットをするためのパッケージが何種類かある。http://julialang.org/downloads/#Graphics.in.Julia
公式には下記の2つが載せられていた。今回はGadflyをためしてみた。
Gadfly
公式の例に従って下記のようにインストール&サンプルプロット
julia> Pkg.add("Gadfly")
INFO: Initializing package repository /Users/yourname/.julia/v0.3
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
INFO: Cloning cache of ArrayViews from git://github.com/lindahua/ArrayViews.jl.git
INFO: Cloning cache of Codecs from git://github.com/dcjones/Codecs.jl.git
INFO: Cloning cache of Color from git://github.com/JuliaLang/Color.jl.git
INFO: Cloning cache of Compat from git://github.com/JuliaLang/Compat.jl.git
INFO: Cloning cache of Compose from git://github.com/dcjones/Compose.jl.git
INFO: Cloning cache of Contour from git://github.com/tlycken/Contour.jl.git
INFO: Cloning cache of DataArrays from git://github.com/JuliaStats/DataArrays.jl.git
INFO: Cloning cache of DataFrames from git://github.com/JuliaStats/DataFrames.jl.git
INFO: Cloning cache of DataStructures from git://github.com/JuliaLang/DataStructures.jl.git
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Cloning cache of Distances from git://github.com/JuliaStats/Distances.jl.git
INFO: Cloning cache of Distributions from git://github.com/JuliaStats/Distributions.jl.git
INFO: Cloning cache of FixedPointNumbers from git://github.com/JeffBezanson/FixedPointNumbers.jl.git
INFO: Cloning cache of GZip from git://github.com/JuliaLang/GZip.jl.git
INFO: Cloning cache of Gadfly from git://github.com/dcjones/Gadfly.jl.git
INFO: Cloning cache of Hexagons from git://github.com/dcjones/Hexagons.jl.git
INFO: Cloning cache of ImmutableArrays from git://github.com/twadleigh/ImmutableArrays.jl.git
INFO: Cloning cache of Iterators from git://github.com/JuliaLang/Iterators.jl.git
INFO: Cloning cache of JSON from git://github.com/JuliaLang/JSON.jl.git
INFO: Cloning cache of KernelDensity from git://github.com/JuliaStats/KernelDensity.jl.git
INFO: Cloning cache of Loess from git://github.com/dcjones/Loess.jl.git
INFO: Cloning cache of PDMats from git://github.com/JuliaStats/PDMats.jl.git
INFO: Cloning cache of Reexport from git://github.com/simonster/Reexport.jl.git
INFO: Cloning cache of Showoff from git://github.com/dcjones/Showoff.jl.git
INFO: Cloning cache of SortingAlgorithms from git://github.com/JuliaLang/SortingAlgorithms.jl.git
INFO: Cloning cache of StatsBase from git://github.com/JuliaStats/StatsBase.jl.git
INFO: Installing ArrayViews v0.4.6
INFO: Installing Codecs v0.1.2
INFO: Installing Color v0.3.10
INFO: Installing Compat v0.0.2
INFO: Installing Compose v0.3.9
INFO: Installing Contour v0.0.5
INFO: Installing DataArrays v0.2.3
INFO: Installing DataFrames v0.5.10
INFO: Installing DataStructures v0.3.3
INFO: Installing Dates v0.3.2
INFO: Installing Distances v0.1.1
INFO: Installing Distributions v0.5.4
INFO: Installing FixedPointNumbers v0.0.4
INFO: Installing GZip v0.2.13
INFO: Installing Gadfly v0.3.9
INFO: Installing Hexagons v0.0.2
INFO: Installing ImmutableArrays v0.0.6
INFO: Installing Iterators v0.1.6
INFO: Installing JSON v0.3.8
INFO: Installing KernelDensity v0.0.2
INFO: Installing Loess v0.0.3
INFO: Installing PDMats v0.2.4
INFO: Installing Reexport v0.0.1
INFO: Installing Showoff v0.0.2
INFO: Installing SortingAlgorithms v0.0.2
INFO: Installing StatsBase v0.6.8
INFO: Package database updated
julia> using Gadfly
julia> draw(SVG("output.svg", 6inch, 3inch), plot([sin, cos], 0, 25))
ホーム以下に output.svgというファイルができている。
SVGができるってのはwebとすごく相性よいですね。
公式のgithub https://github.com/dcjones/Gadfly.jl#optional-cairo-pango-and-fontconfig みると依存ライブラリをいれるとpngやpdfで出力できるようです。
個人的にはSVGで出力できればそれでいいかも。
感想
数値計算は確かに速いと鳴り物入りのJuliaですが、plotはRの方が速い感ある。
そして、SVG出力は素敵。