# Matrix Types

Numbers in Wolfram Language | Complex Matrices |

Matrices in Wolfram Language | Arbitrary-Precision Matrices |

Matrices in Wolfram Language can be constructed from all the different types of objects that Wolfram Language holds. They can contain machine-precision real and complex floating-point numbers, arbitrary-precision real and complex floating-point numbers, integers, rational numbers, and general symbolic quantities. This tutorial considers the different types of matrices that Wolfram Language supports.

## Numbers in Wolfram Language

In order to understand the different types of matrices that Wolfram Language can work with, it will help to get an overview of the different types of numbers that are supported. This section only gives an overview of numbers in Wolfram Language; further information is found in "Numbers".

machine-sizeInteger | integers represented by machine hardware |

Integer | arbitrary‐length exact integer |

Rational | integer/integer (fractions) in lowest terms |

machine-sizeReal | approximate real number represented by machine hardware |

Real | approximate real number, with any specified precision |

Complex | complex number of the form number+numberI |

AlgebraicNumber | root of an algebraic equation |

exact numerical expression | composition of numbers and mathematical functions |

infinities and exceptions | various special numbers |

Intrinsic types of numbers in Wolfram Language.

These examples demonstrate the general point that Wolfram Language arithmetic traps overflows and underflows so that it can switch from machine to software numbers. Despite this it tries to use machine hardware functionality whenever possible, so that Wolfram Language computations can be fast.

### Exact versus Approximate Numbers

This demonstrates that mathematical functions, such as Sin, maintain the nature of their input. If they get an exact argument, the result will be exact. If they get an approximate argument the result is approximate. This feature of Wolfram Language is essential to maintain the system as a symbolic system, but it stands in contrast to the operation of a purely numerical environment. For example, in many languages such as C or Java the equivalent computation would coerce the integer to a double and the result would be an approximate number.

This distinction means that when you work with numbers you need to be more aware of their types than is the case in many other languages.

### Mixed Mode Arithmetic

## Matrices in Wolfram Language

Matrices in Wolfram Language can contain many different types of elements.

These different types of matrices can be put into categories according to the types of technique used for computing with them.

machine-precisionReal | standard numerical techniques |

machine-precisionComplex | |

arbitrary-precisionReal | arbitrary‐precision numerical techniques |

arbitrary-precisionComplex | |

Integer | symbolic algebra techniques |

Rational | |

exactComplex | |

symbolic |

Different types of matrices in Wolfram Language.

These three different categories are briefly reviewed.

#### Standard Numerical Techniques

In Wolfram Language, matrix computations involving machine-precision Real and machine-precision approximate Complex numbers are carried out with standard numerical techniques. In many cases computations involve optimized libraries, many of which are described in "Software References".

An important goal for many of these computations is to match and surpass the performance of any software package that is dedicated to machine-precision numbers. This is in keeping with the design goals of Wolfram Language, as described under "Design Principles of Wolfram Language". In the case of linear algebra computations, Wolfram Language makes use of a considerable amount of sophisticated technology, some of which is described under "Performance of Linear Algebra Computation".

#### Arbitrary-Precision Numerical Techniques

In Wolfram Language, matrix computations involving arbitrary-precision Real and arbitrary-precision approximate Complex numbers are carried out with special numerical libraries. These libraries are adapted from standard libraries so they can work for arbitrary-precision computations.

More information can be found in the section "Arbitrary-Precision Matrices".

#### Symbolic Algebra Techniques

Matrix computations involving exact numbers and general symbolic techniques are carried out with computer algebra techniques.

All computations provided for numerical matrices are also available for symbolic matrices. This meets the design goal of integrating symbolic and numerical computation.

### Mixed Mode Matrices

This section describes what happens if the input matrix contains a mixture of different types of entries.

In some other computation systems an input matrix of integers would be converted to a floating-point matrix. Wolfram Language does not do this, so that it can support symbolic computation. However, it means that users need to be aware of the differences. This is because the time required for a symbolic technique can be quite different from a machine-precision technique; in many cases the symbolic computation will take much longer.

## Complex Matrices

Complex matrices in Wolfram Language are defined in a way that is completely consistent with other types of matrices such as those that involve real numbers. All the functions that work for real matrices work for complex matrices.