HyperMath

Vector and Matrices

Vector and Matrices

Previous topic Next topic No expanding text in this topic  

Vector and Matrices

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Vector and matrix data types are supported in HyperMath to enhance numerical computing.

HyperMath supports up to a 2-dimensional matrix data type.  The 1-dimensional case is referred to as a vector.  Only numerical entries are permitted.  Many of the standard mathematical matrix operations, such as inversion, can be performed on this data type.

Matrices are created using a pair of square brackets, [].  Each element is separated by a comma.  Below is an example of a vector creation (1-dimensional matrix).

> x = [1,2,3]; print(x)

[Matrix] (1 x 3)

1 2 3

The above example creates a row vector, that is, its dimensions are 1 row by 3 columns (1x3).  To make a 3x1 vector, separate the entries by a semicolon (;) like this:

> x = [1;2;3]; print(x)

[Matrix] (3 x 1)

1

2

3

A 2-dimensional matrix is created by extending the above idea.  Here is a 2x3 matrix:

> x = [1, 2, 3; 4, 5, 6]; print(x)

[Matrix] (2 x 3)

1 2 3

4 5 6

Elements of a matrix can be accessed using a pair of parenthesis, ().  For example, the third column of the second row can be accessed as :

> print("The value in 2nd row & 3rd column is:", x(2,3) )

The value in 2nd row & 3rd column is:    6

Vector and matrices of complex numbers are supported as well.

>  x=[1+2i, 3+4i; 5, 7i]; print("The complex matrix is:",x)

The complex matrix is:    [Matrix] 2 x 2

   1 +     2i      3 +     4i

            5      0 +     7i

Matrices support many more functionalities.  See Vector and Matrix Data for more information.