# Introduction to Matrices in Python

## Some very basic notions 

We can think of a *matrix* as a rectangular box full of numbers, like 
$$ \begin{bmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \end{bmatrix}$$

These numbers are called the entries of the matrix, and can be *real* or *complex* (or many other, but we will focus on those, mostly, on matrices with real entries). 

As you surely know, the entries of a matrix form *rows* (horizontally) and *columns* (vertically). 

For example, the matrix above has two rows, and four columns. We usually say this is a 4 by 2 matrix.

The set of matrices of real numbers, having $m$ rows and $n$ columns will be denoted by $\R^{m \times n}$.

### Representing matrices in code

In Python, there are several different ways of representing matrices. 

Here we will introduce two very useful packages, $\texttt{numpy}$ and $\texttt{sympy}$. They are usually imported into our code like this:


```python
import numpy as np
import sympy as sp
```

With $\texttt{numpy}$, we represent matrices with the type $\texttt{np.array}$. The method 


```python
A = np.array([[1,2,3,4],[5,6,7,8]])
```


```python

```

652ec0a7e378264773dca08d246f53d0cf49da3f
ipynb
Jupyter Notebook
notebooks/Introduction to matrices in Python.ipynb
lfsequeira/ALC
159f895944f1f657a06f478d301237e3e01bc8a2
MIT
notebooks/Introduction to matrices in Python.ipynb
lfsequeira/ALC
159f895944f1f657a06f478d301237e3e01bc8a2
MIT
notebooks/Introduction to matrices in Python.ipynb
lfsequeira/ALC
159f895944f1f657a06f478d301237e3e01bc8a2
MIT
Qwen/Qwen-72B
1. YES
2. YES