Julia for MATLAB 使用者/核心語言/數學
下面列出的核心 MATLAB 數學 文件中描述的大多數功能在 Julia 手冊的 Base.Mathematics 部分都有等效的,通常是相同的,功能(通常語法相同)。下面標識了特定的等效項;通常這些與 Matlab 中的名稱相同,否則將註明 Julia 等效項的名稱。
參見 Julia 手冊中的 算術運算子。請注意,在 Julia 中,運算子本身是方法,可以在任何可以使用方法的地方使用。例如,參見 Base.map 文件中的示例。
參見 Julia 手冊中的 三角函式和雙曲函式。
atan 弧度制反正切
[edit | edit source]atand 度數制反正切
[edit | edit source]atan2 四象限反正切
[edit | edit source]atan2d 度數制四象限反正切
[edit | edit source]tanh 雙曲正切
[edit | edit source]atanh 雙曲反正切
[edit | edit source]csc 弧度制餘割
[edit | edit source]cscd 度數制餘割
[edit | edit source]acsc 弧度制反餘割
[edit | edit source]acscd 度數制反餘割
[edit | edit source]csch 雙曲餘割
[edit | edit source]acsch 雙曲反餘割
[edit | edit source]sec 弧度制正割
[edit | edit source]secd 度數制正割
[edit | edit source]asec 弧度制反正割
[edit | edit source]asecd 度數制反正割
[edit | edit source]sech 雙曲正割
[edit | edit source]asech 雙曲反正割
[edit | edit source]cot 弧度制餘切
[edit | edit source]cotd 度數制餘切
[edit | edit source]acot 弧度制反餘切
[edit | edit source]acotd 度數制反餘切
[edit | edit source]coth 雙曲餘切
[edit | edit source]acoth 雙曲餘切的反函式
[edit | edit source]hypot 平方和的平方根 (斜邊)
[edit | edit source]deg2rad 將角度從度數轉換為弧度
[edit | edit source]rad2deg 將角度從弧度轉換為度數
[edit | edit source]指數和對數
[edit | edit source]參見 Julia 手冊中的 冪、對數和根。
exp 指數
[edit | edit source]expm1 計算 ,對於 x 的小值,該值非常精確
[edit | edit source]log 自然對數
[edit | edit source]log10 常用對數 (以 10 為底)
[edit | edit source]log1p 計算 log(1+x),對於 x 的小值,該值非常精確
[edit | edit source]log2 以 2 為底的對數和浮點數分解
[edit | edit source]nextpow2 下一個更高 2 的冪的指數
[edit | edit source]nthroot 實數的實 n 次根
[edit | edit source]pow2 以 2 為底的冪,並縮放浮點數
[edit | edit source]reallog 非負實數陣列的自然對數
[edit | edit source]realpow 用於僅實數輸出的陣列冪
[edit | edit source]realsqrt 非負實數陣列的平方根
[edit | edit source]sqrt 平方根
[edit | edit source]複數
[edit | edit source]參見 Julia 手冊中的 複數。
abs 絕對值和複數模
[edit | edit source]angle 相位角
[edit | edit source]complex 建立複數陣列
[edit | edit source]conj 複共軛
[edit | edit source]cplxpair 將複數排序為複共軛對
[edit | edit source]i 虛數單位
[edit | edit source]imag 複數的虛部
[edit | edit source]isreal 確定陣列是否為實數
[edit | edit source]j 虛數單位
[edit | edit source]real 複數的實部
[edit | edit source]sign 符號函式(符號函式)
[edit | edit source]unwrap 校正相位角以生成更平滑的相點陣圖
[edit | edit source]離散數學
[edit | edit source]Julia 中的等效項 Base
[edit | edit source]factorial 輸入的階乘
[edit | edit source]gcd 最大公約數
[edit | edit source]lcm 最小公倍數
[edit | edit source]JuliaMath/Primes.jl 中的等效項 JuliaMath/Primes.jl
[edit | edit source]factor 素因子
[edit | edit source]primes 小於或等於輸入值的素數
[edit | edit source]isprime 確定哪些陣列元素是素數
[edit | edit source]nchoosek 二項式係數或所有組合 (Julia: binomial)
[edit | edit source]其他
[edit | edit source]perms 所有可能的排列
[edit | edit source]Julia 的 Permutations.permutations(a) 函式(Permutations.jl 包)返回一個迭代器物件(因為排列的數量可能非常大),並且以字典序而不是逆字典序排列。因此,可以構建一個直接等效項,如下所示
julia> perms(a) = reverse(collect(permutations(a)))
perms (generic function with 1 method)
julia> perms([2,4,6])
6-element Array{Array{Int64,1},1}:
[6, 4, 2]
[6, 2, 4]
[4, 6, 2]
[4, 2, 6]
[2, 6, 4]
[2, 4, 6]
rat 有理分式逼近,rats 有理輸出
[edit | edit source]這些似乎沒有直接的 Julia 等效項,但請注意,與 Matlab 不同,Julia 具有本地的 有理數型別。
多項式
[edit | edit source]請參閱 Polynomials.jl 包。請注意,此包為多項式提供了一個適當的型別,Polynomials.Poly,而在 Matlab 中,度數為 的多項式由長度為 的向量表示,該向量的元素是多項式中按降序排列的係數。
poly 帶有指定根或特徵多項式的多項式
[edit | edit source]polyeig 多項式特徵值問題
[edit | edit source]polyfit 多項式曲線擬合
[edit | edit source]Polynomials.polyfit 提供了類似的基本功能 - Matlab 函式的單個輸出引數形式,但它缺少額外的誤差估計和居中/縮放功能。
residue 部分分式展開(部分分式分解)
[edit | edit source]roots 多項式根
[edit | edit source]Polynomials.roots 提供了具有重數的根。
polyval 多項式求值
[edit | edit source]請參閱 Julia 手冊中的 Base.Math.@evalpoly。
polyvalm 矩陣多項式求值
[edit | edit source]conv 卷積和多項式乘法
[edit | edit source]deconv 解卷積和多項式除法
[edit | edit source]polyint 多項式積分
[edit | edit source]polyder 多項式微分
[edit | edit source]特殊函式
[edit | edit source]airy Airy 函式
[edit | edit source]besselh 第三類 Bessel 函式(Hankel 函式)
[edit | edit source]besseli 第一類修正 Bessel 函式
[edit | edit source]besselj 第一類 Bessel 函式
[edit | edit source]besselk 第二類修正 Bessel 函式
[edit | edit source]betaincinv Beta 逆累積分佈函式
[編輯 | 編輯原始碼]gammaincinv 不完全伽馬函式的逆函式
[編輯 | 編輯原始碼]參見 Julia 手冊中的 通用數字函式和常量。
在 Julia 中,im 等效;這允許 i 和 j 用作例如迴圈索引而不會衝突。
在 Julia 中也可用作 pi 以及 \piTab ↹ →
參見 MatrixDepot.jl 包;gallery 中的大多數矩陣以及下面列出的所有其他矩陣都可以在該包中使用,此外還提供了一些額外的矩陣。
參見 Julia 手冊中的 線性代數。
decomposition 用於求解線性系統的矩陣分解
[編輯 | 編輯原始碼]lsqminnorm 線性方程的最小范數最小二乘解
[編輯 | 編輯原始碼]eigs 特徵值和特徵向量的子集
[edit | edit source]balance 對角縮放以提高特徵值精度
[edit | edit source]svd 奇異值分解
[edit | edit source]svds 奇異值和向量子集
[edit | edit source]gsvd 廣義奇異值分解
[edit | edit source]ordeig 擬三角矩陣的特徵值
[edit | edit source]ordqz 重新排列 QZ 分解中的特徵值
[edit | edit source]ordschur 重新排列 Schur 分解中的特徵值
[edit | edit source]polyeig 多項式特徵值問題
[edit | edit source]qz 用於廣義特徵值的 QZ 分解
[edit | edit source]hess 矩陣的 Hessenberg 形式
[edit | edit source]schur Schur 分解
[edit | edit source]rsf2csf 將實 Schur 形式轉換為復 Schur 形式
[edit | edit source]cdf2rdf 將復對角形式轉換為實塊對角形式
[edit | edit source]lu LU 矩陣分解
[edit | edit source]ldl 用於 Hermitian 不定矩陣的塊 LDL' 分解
[edit | edit source]chol Cholesky 分解
[edit | edit source]cholupdate 對 Cholesky 分解進行秩 1 更新
[edit | edit source]qr 正交-三角分解
[edit | edit source]qrdelete 從 QR 分解中刪除列或行
[edit | edit source]qrinsert 將列或行插入 QR 分解
[edit | edit source]qrupdate 對 QR 分解進行秩 1 更新
[edit | edit source]planerot Givens 平面旋轉
[edit | edit source]ctranspose 複共軛轉置
[編輯 | 編輯原始碼]ishermitian 判斷矩陣是否為厄米特矩陣或反對稱厄米特矩陣
[編輯 | 編輯原始碼]issymmetric 判斷矩陣是否為對稱矩陣或反對稱矩陣
[編輯 | 編輯原始碼]randStream 隨機數流
[編輯 | 編輯原始碼]gRiddedinterpolant 網格資料插值
[編輯 | 編輯原始碼]scaTteredinterpolant 插值二維或三維散點資料
[編輯 | 編輯原始碼]fminsearch 使用無導數方法查詢無約束多變數函式的最小值
[編輯 | 編輯原始碼]見 DifferentialEquations.jl。尤其見 MATLAB/Python/R 翻譯 部分。
treelayout 佈置樹或森林
[編輯 | 編輯原始碼]reordernodes 重新排序圖節點
[編輯 | 編輯原始碼]centrality 衡量節點重要性
[編輯 | 編輯原始碼]conncomp 連通圖元件
[edit | edit source]biconncomp 雙連通圖元件
[edit | edit source]condensation 圖的凝縮
[edit | edit source]bctree 塊-割點樹圖
[edit | edit source]minspantree 圖的最小生成樹
[edit | edit source]toposort 有向無環圖的拓撲排序
[edit | edit source]isdag 判斷圖是否為無環圖
[edit | edit source]transclosure 閉包
[edit | edit source]transreduction 約簡
[edit | edit source]isisomorphic 判斷兩個圖是否同構
[edit | edit source]isomorphism 計算兩個圖之間的同構
[edit | edit source]ismultigraph 判斷圖是否具有多重邊
[edit | edit source]simplify 將多重圖簡化為簡單圖
[edit | edit source]shortestpath 兩個單節點之間的最短路徑
[edit | edit source]shortestpathtree 從節點開始的最短路徑樹
[edit | edit source]distances 所有節點對之間的最短路徑距離
[edit | edit source]adjacency 圖的鄰接矩陣
[edit | edit source]incidence 圖的關聯矩陣
[edit | edit source]laplacian 圖的拉普拉斯矩陣
[edit | edit source]degree 圖節點的度數
[edit | edit source]neighbors 圖節點的鄰居
[edit | edit source]nearest 半徑內的最近鄰居
[edit | edit source]indegree 節點的入度
[edit | edit source]outdegree 節點的出度
[edit | edit source]predecessors 節點的先行節點
[edit | edit source]successors 節點的後續節點
[edit | edit source]inedges 指向節點的入邊
[edit | edit source]outedges 從節點出發的出邊
[edit | edit source]plot 繪製圖的節點和邊
[edit | edit source]labeledge 標註圖的邊
[edit | edit source]labelnode 標註圖的節點
[edit | edit source]layout 更改圖的佈局
[edit | edit source]highlight 突出顯示繪製圖中的節點和邊
[edit | edit source]graphPlot 有向圖和無向圖的圖繪製
[edit | edit source]計算幾何
[edit | edit source]參見 JuliaGeometry GitHub 組織。
三角剖分表示
[edit | edit source]triangulation 2-D 或 3-D 三角剖分
[edit | edit source]tetramesh 四面體網格圖
[edit | edit source]trimesh 三角網格圖
[edit | edit source]triplot 2-D 三角形圖
[edit | edit source]trisurf 三角表面圖
[edit | edit source]Delaunay 三角剖分
[edit | edit source]deLaunaytriangulation 2-D 和 3-D Delaunay 三角剖分
[edit | edit source]delaunay Delaunay 三角剖分
[edit | edit source]delaunayn N-D Delaunay 三角剖分
[edit | edit source]tetramesh 四面體網格圖
[edit | edit source]trimesh 三角網格圖
[edit | edit source]triplot 2-D 三角形圖
[edit | edit source]trisurf 三角表面圖
[edit | edit source]空間搜尋
[edit | edit source]triangulation 2-D 或 3-D 三角剖分
[編輯 | 編輯原始碼]deLaunaytriangulation 2-D 和 3-D Delaunay 三角剖分
[編輯 | 編輯原始碼]alphaShape 從 2-D 和 3-D 中的點生成多邊形和多面體
[編輯 | 編輯原始碼]Julia 包 GeometricalPredicates.jl 提供了一些類似的功能。