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

## Elementary Math
### 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 Base.map.

#### bsxfun Apply element-wise operation to two arrays with implicit expansion enabled
### Trigonometry

See Trigonometric and Hyperbolic functions in the Julia manual.

#### rad2deg Convert angle from radians to degrees
### Exponents and Logarithms

See Powers, logs and roots in the Julia manual.

#### sqrt Square root
### Complex Numbers

See Complex Numbers in the Julia manual.

#### unwrap Correct phase angles to produce smoother phase plots
### Discrete Math
#### Others
###### perms All possible permutations

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:

###### rat Rational fraction approximation, rats 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, Polynomials.Poly, 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.

#### polyfit Polynomial curve fitting

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.

#### roots Polynomial roots

Polynomials.roots provides roots with multiplicity.

#### polyval Polynomial evaluation

See Base.Math.@evalpoly in the Julia Manual.

#### polyder Polynomial differentiation
### Special Functions
#### psi Psi (polygamma) function
### Cartesian Coordinate System Conversion
#### sph2cart Transform spherical coordinates to Cartesian
### Constants and Test Matrices
#### Constants

See General Number Functions and Constants in the Julia manual.

#### i, j Imaginary unit

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

#### pi Ratio of circle's circumference to its diameter

Also available as pi in Julia as well as \piTab ↹ → $\pi$

#### Test Matrices

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

#### wilkinson Wilkinson's eigenvalue test matrix
### Linear Algebra

See Linear Algebra in the Julia manual.

#### subspace Angle between two subspaces
### Random Number Generation
#### randStream Random number stream
### Interpolation
#### scaTteredinterpolant Interpolate 2-D or 3-D scattered data
### Optimization
#### optimset Create or edit optimization options structure
## Numerical Integration and Differential Equations

See DifferentialEquations.jl. In particular see the section Translations from MATLAB/Python/R.

### Graph and Network Algorithms
#### graph Graph with undirected edges
#### graphPlot Graph plot for directed and undirected graphs
## Computational Geometry

See the JuliaGeometry GitHub organization.

### Elementary Polygons

The Julia package GeometricalPredicates.jl provides some similar functionality.