Julia for MATLAB Users/Core Language/Mathematics

= Mathematics =

Most 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.

Arithmetic
See 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.

Trigonometry
See Trigonometric and Hyperbolic functions in the Julia manual.

Exponents and Logarithms
See Powers, logs and roots in the Julia manual.

Complex Numbers
See Complex Numbers in the Julia manual.

All possible permutations
The Julia  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]

Rational fraction approximation, Rational output
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
See the Polynomials.jl package. Note that this package provides a proper type for polynomials,, while in Matlab a polynomial of degree $$n$$is represented by a vector of length $$n+1$$whose elements are the coefficients in descending powers of the polynomial.

Polynomial curve fitting
provides comparable basic functionality--the single output argument form of the Matlab function--although it lacks the additional error estimate and centering/scaling features.

Polynomial roots
provides roots with multiplicity.

Polynomial evaluation
See in the Julia Manual.

Constants
See General Number Functions and Constants in the Julia manual.

, Imaginary unit
In Julia, is equivalent; this allows   and   to be used as e.g. loop indices without conflict.

Ratio of circle's circumference to its diameter
Also available as  in Julia as well as  TAB → $$\pi$$

Test Matrices
See the MatrixDepot.jl package; most of the matrices in    and all the rest below are available in that package, plus some additional ones.

Linear Algebra
See Linear Algebra in the Julia manual.

Numerical Integration and Differential Equations
See DifferentialEquations.jl. In particular see the section Translations from MATLAB/Python/R.

Computational Geometry
See the JuliaGeometry GitHub organization.

Elementary Polygons
The Julia package GeometricalPredicates.jl provides some similar functionality.