Julia for MATLAB Users/Core Language/Mathematics
Mathematics
editMost of the below functionality described in the core MATLAB Mathematics documentation has equivalent, often identical, functionality (more often that not with the same syntax) described in the Base.Mathematics section of the Julia manual. Specific equivalents are identified below; often these have the same names as in Matlab, otherwise the Julia equivalent name is noted.
Elementary Math
editArithmetic
editSee Arithmetic Operators in the Julia manual. Note that in Julia the operators are themselves methods and can be used anywhere a method can. See e.g. the example in the documentation for Base.map
.
Trigonometry
editSee Trigonometric and Hyperbolic functions in the Julia manual.
Exponents and Logarithms
editSee Powers, logs and roots in the Julia manual.
Complex Numbers
editSee Complex Numbers in the Julia manual.
Discrete Math
editEquivalents available in JuliaMath/Primes.jl
editOthers
edit
The Julia Permutations.permutations(a)
function ( Permutations.jl package) returns an iterator object (because the number of permutations can be very large), and in lexicographic order rather than reverse lexicographic. Therefore a drop-in equivalent could be constructed as follows:
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]
There doesn't appear to be a direct Julia equivalent of these, but note that unlike Matlab, Julia has a native Rational Number type .
Polynomials
editSee the Polynomials.jl package. Note that this package provides a proper type for polynomials, Polynomials.Poly
, while in Matlab a polynomial of degree is represented by a vector of length whose elements are the coefficients in descending powers of the polynomial.
Polynomials.polyfit
provides comparable basic functionality--the single output argument form of the Matlab function--although it lacks the additional error estimate and centering/scaling features.
Polynomials.roots
provides roots with multiplicity.
See Base.Math.@evalpoly
in the Julia Manual.
Special Functions
editbetaincinv
Beta inverse cumulative distribution function
edit
gammaincinv
Inverse incomplete gamma function
edit
Cartesian Coordinate System Conversion
editConstants and Test Matrices
editConstants
editSee General Number Functions and Constants in the Julia manual.
In Julia, im
is equivalent; this allows i
and j
to be used as e.g. loop indices without conflict.
Also available as pi
in Julia as well as \pi
Tab ↹ →
Test Matrices
editSee the MatrixDepot.jl package; most of the matrices in gallery
and all the rest below are available in that package, plus some additional ones.
Linear Algebra
editSee Linear Algebra in the Julia manual.
decomposition
Matrix decomposition for solving linear systems
edit
lsqminnorm
Minimum norm least-squares solution to linear equation
edit
cholupdate
Rank 1 update to Cholesky factorization
edit
ctranspose
Complex conjugate transpose
edit
ishermitian
Determine if matrix is Hermitian or skew-Hermitian
edit
issymmetric
Determine if matrix is symmetric or skew-symmetric
edit
Random Number Generation
editrandStream
Random number stream
edit
Interpolation
editgRiddedinterpolant
Gridded data interpolation
edit
scaTteredinterpolant
Interpolate 2-D or 3-D scattered data
edit
Optimization
editfminsearch
Find minimum of unconstrained multivariable function using derivative-free method
edit
Numerical Integration and Differential Equations
editSee DifferentialEquations.jl. In particular see the section Translations from MATLAB/Python/R.
Ordinary Differential Equations
editode23tb
Solve stiff differential equations — trapezoidal rule + backward differentiation formula
edit
Boundary Value Problems
editDelay Differential Equations
editPartial Differential Equations
editNumerical Integration and Differentiation
editFourier Analysis and Filtering
editSparse Matrices
edittreelayout
Lay out tree or forest
edit
Graph and Network Algorithms
editreordernodes
Reorder graph nodes
edit
centrality
Measure node importance
edit
biconncomp
Biconnected graph components
edit
condensation
Graph condensation
edit
minspantree
Minimum spanning tree of graph
edit
transclosure
Transitive closure
edit
transreduction
Transitive reduction
edit
isisomorphic
Determine whether two graphs are isomorphic
edit
isomorphism
Compute isomorphism between two graphs
edit
ismultigraph
Determine whether graph has multiple edges
edit
shortestpath
Shortest path between two single nodes
edit
shortestpathtree
Shortest path tree from node
edit
predecessors
Node predecessors
edit
successors
Node successors
edit
Computational Geometry
editSee the JuliaGeometry GitHub organization.
Triangulation Representation
edittriangulation
Triangulation in 2-D or 3-D
edit
Delaunay Triangulation
editdeLaunaytriangulation
Delaunay triangulation in 2-D and 3-D
edit
Spatial Search
edittriangulation
Triangulation in 2-D or 3-D
edit
deLaunaytriangulation
Delaunay triangulation in 2-D and 3-D
edit
Bounding Regions
editalphaShape
Polygons and polyhedra from points in 2-D and 3-D
edit
Voronoi Diagram
editElementary Polygons
editThe Julia package GeometricalPredicates.jl provides some similar functionality.