Julia語言

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
(重新導向自Julia (编程语言)
Julia
編程範型多範式多分派, 程序式, 函數式, 元程式設計, 多階段編程英語Multi-stage_programming
設計者Jeff Bezanson, Alan Edelman, Stefan Karpinski, Viral B. Shah
實作者Jeff Bezanson, Stefan Karpinski, Viral B. Shah等[1][2]
釋出時間2012年,​12年前​(2012[3]
目前版本1.10.2[4]在維基數據編輯, 2024年3月1日, 54天前
實作語言Julia, C, C++, Scheme, LLVM[5]
系統平台x86-64, IA-32, ARM v8(64位元), CUDA, ARM (32位元), PowerPC, 網頁瀏覽器 (JavaScriptWebAssembly)[6]
作業系統macOS, Windows, Linux, FreeBSD[7], Android[8]
許可證MIT許可證
副檔名.jl
網站JuliaLang.org
啟發語言

Julia是一種進階通用[13]動態程式語言,它最初是為了滿足高效能數值分析計算科學的需要而設計的,不需要直譯器,速度快[14][15][16][17],也可用於客戶端和伺服器的Web用途[18][19]、低階系統程式設計或用作規約語言[20]

Julia設計的獨特之處包括,參數多型的型別系統,完全動態語言中的類型,以及它多分派的核心程式設計範式。它允許並行並列分散式計算,並直接呼叫CFortran庫而不使用粘合代碼

Julia擁有垃圾回收機制[21],使用及早求值,包含了用於浮點計算、線性代數亂數生成正則表達式匹配的高效庫。有許多庫可以使用,其中一些(如用於快速傅里葉變換的庫)已經預先捆綁在Julia裏[22]

歷史[編輯]

一群擁有各種語言豐富編程經驗的Matlab進階用戶,對現有的科學計算編程工具感到不滿——這些軟件對自己專長的領域表現得非常棒,但在其它領域卻非常糟糕。他們想要的是一個開源的軟件,它要像C語言一般快速而又擁有如同Ruby動態性;要具有Lisp般真正的同像性而又有Matlab般熟悉的數學記號;要像Python般通用、像R般在統計分析上得心應手、像Perl般自然地處理字串、像Matlab般具有強大的線性代數運算能力、像shell膠水語言的能力,易於學習而又不讓真正的黑客感到無聊;還有,它應該是互動式的,同時又是編譯型的。[23]

該專案大約於2009年中開始。

功能[編輯]

主要用於數值計算。

特點[編輯]

  • 核心語言非常小。標準庫用的是Julia語言本身寫的
  • 呼叫許多其它成熟的高效能基礎代碼。如線性代數亂數生成快速傅里葉變換、字串處理。
  • 豐富的用於建立或描述對象的類型語法
  • 高效能,接近於靜態編譯型語言。包括用戶自訂類型等
  • 為平行計算和分散式計算而設計
  • 輕量級協程
  • 優雅的可延伸的類型轉換/提升
  • 支援Unicode,包括但不限於UTF-8
  • 可直接呼叫C函數(不需要包裝或是藉助特殊的API
  • 有類似shell的行程管理能力
  • 有類似Lisp巨集以及其它元程式設計工具
  • 可與Jupyter notebook 一起使用

範例[編輯]

生成Mandelbrot集合[編輯]

function mandel(z)
    c = z
    max = 80
    for n = 1:max
        if abs(z) > 2
            return n-1
        end
        z = z^2 + c
    end
    return max
end

隨機矩陣統計[編輯]

using LinearAlgebra: tr
using Statistics #导入std, mean等函数

function randmatstat(t)
    n = 5
    v = zeros(t)
    w = zeros(t)
    for i = 1:t
        a = randn(n,n)
        b = randn(n,n)
        c = randn(n,n)
        d = randn(n,n)
        P = [a b c d]
        Q = [a b; c d]
        v[i] = tr((P'*P)^4)
        w[i] = tr((Q'*Q)^4)
    end
    std(v)/mean(v), std(w)/mean(w)
end

參考資料[編輯]

  1. ^ LICENSE.md. GitHub. [2020-03-24]. (原始內容存檔於2021-01-23). 
  2. ^ Contributors to JuliaLang/julia. GitHub. [2020-03-24]. (原始內容存檔於2021-01-23). 
  3. ^ 3.0 3.1 3.2 3.3 3.4 3.5 3.6 Why We Created Julia. Julia website. February 2012 [2013-02-07]. (原始內容存檔於2019-02-19). 
  4. ^ Download Julia. 
  5. ^ Julia. Julia. NumFocus project. [9 December 2016]. (原始內容存檔於2017-02-21). Julia's Base library, largely written in Julia itself, also integrates mature, best-of-breed open source C and Fortran libraries for ... 
  6. ^ Fischer, Keno. Running julia on wasm. 2019-07-22 [2019-07-25]. (原始內容存檔於2020-11-21). 
  7. ^ Download Julia - Currently supported platforms. Julia. [2020-03-24]. (原始內容存檔於2021-01-26). 
  8. ^ The Julia Language: A fresh approach to technical computing. Termux/Android. Github. [2020-03-24]. (原始內容存檔於2020-12-27). 
  9. ^ Stokel-Walker, Chris. Julia: The Goldilocks language. Increment. Stripe. [23 August 2020]. (原始內容存檔於2020-11-09). 
  10. ^ 10.0 10.1 10.2 10.3 Home · The Julia Language. docs.julialang.org. [2018-08-15]. (原始內容存檔於2021-01-11) (英語). 
  11. ^ Programming Language Network. GitHub. [6 December 2016]. (原始內容存檔於2020-12-20). 
  12. ^ JuliaCon 2016. JuliaCon. [6 December 2016]. (原始內容存檔於2021-02-03). He has co-designed the programming language Scheme, which has greatly influenced the design of Julia 
  13. ^ The Julia Language (official website). [2018-09-22]. (原始內容存檔於2017-02-21). General Purpose [..] Julia lets you write UIs, statically compile your code, or even deploy it on a webserver. 
  14. ^ Bryant, Avi. Matlab, R, and Julia: Languages for data analysis. O'Reilly Strata. 15 October 2012 [2018-09-22]. (原始內容存檔於2013-05-24). 
  15. ^ Singh, Vicky. Julia Programming Language – A True Python Alternative. Technotification. 23 August 2015 [2018-09-22]. (原始內容存檔於2020-11-09). 
  16. ^ Krill, Paul. New Julia language seeks to be the C for scientists. InfoWorld. 18 April 2012 [2018-09-22]. (原始內容存檔於2014-09-13). 
  17. ^ Finley, Klint. Out in the Open: Man Creates One Programming Language to Rule Them All. Wired. 3 February 2014 [2018-09-22]. (原始內容存檔於2016-12-20). 
  18. ^ Escher : With Escher you can build beautiful Web Uls entirely in Julia. Shasi.github.io. [2017-05-31]. (原始內容存檔於2016-03-04). 
  19. ^ Getting Started with Node Julia · Node Julia. Node-julia.readme.io. [2017-05-31]. (原始內容存檔於2020-10-21). 
  20. ^ Moss, Robert. Using Julia as a Specification Language for the Next-Generation Airborne Collision Avoidance System. 26 June 2015 [29 June 2015]. (原始內容存檔於2015-07-01). Airborne collision avoidance system 
  21. ^ Suspending Garbage Collection for Performance...good idea or bad idea?. Groups.google.com. [2017-05-31]. (原始內容存檔於2011-01-22). 
  22. ^ (now available with using FFTW in current versions; that dependency is one of many moved out of the standard library to a package because it is GPL licensed, and thus is not included in Julia 1.0 by default.) Remove the FFTW bindings from Base by ararslan · Pull Request #21956 · JuliaLang/julia. GitHub. [2018-03-01]. (原始內容存檔於2019-02-16) (英語). 
  23. ^ Why We Created Julia. [2012-04-19]. (原始內容存檔於2016-01-18). 

參閱[編輯]

外部連結[編輯]