# Lecture Mathematical Foundations
Horacio Gomez-Acevedo

BMIG 6120

UAMS


# Basic Concepts of Linear Algebra

Mathematical quantities are normally associated with sets of numbers. For instance points on the plane have two coordinates $x$ and $y$, whereas on the space they will have three coordinates $x$,$y$ and $z$. We further extend this idea to say that $(x_1,\ldots,x_n)$ is a point (or vector) in the $n$-dimensional space (normally denoted as $\mathbb{R}^n)$. We will denote vectors by bold face symbols, for instance $\pmb{x}=(x_1,\ldots,x_n)$ 

Some basic operations on vectors are:

\begin{align*}
\pmb{x}+\pmb{y}&=
(x_1,x_2,\ldots,x_n)+(y_1,y_2,\ldots,y_n)=(x_1+y_1,x_2+y_2,\ldots,x_n+y_n)\\
\pmb{x}-\pmb{y}&=
(x_1,x_2,\ldots,x_n)-(y_1,y_2,\ldots,y_n)=(x_1-y_1,x_2-y_2,\ldots,x_n-y_n)\\
\end{align*}
The **dot product** of two vectors $\pmb{x}$ and $\pmb{y}$ is defined as

\begin{align*}
\pmb{x}\cdot\pmb{y}&=(x_1,x_2,\ldots,x_n)\cdot(y_1,y_2,\ldots,y_n)=x_1\cdot y_1+ x_2\cdot y_2,\ldots+x_n\cdot y_n\\
&=\sum_{i=1}^n x_iy_i\\
\end{align*}
The length of an $n$-vector is given by
\begin{equation*}
\| \pmb{x} \| = \sqrt{ \pmb{x} \cdot \pmb{x}}  = \sqrt{x_1^2+x_2^2+\ldots+x_n^2}= \sqrt{\sum_{i=1}^n x_i^2}
\end{equation*}



## Matrices

A matrix is a collection of numbers, arranged in a particular way, for instance
\begin{equation*}
\left( 
    \matrix{1 & 2& 3\\ 4&5&6}
    \right)
\end{equation*}

We can think of a matrix as a square section of a table. 
A matrix of size $n\times p$ is a table with $n$ rows and $p$ columns like
\begin{equation*}
\left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right)
\end{equation*}

We will denote matrices with capital bold variables such as $\pmb{X}$. 

Matrices can be represented as either column or row vectors. 


## Matrices operations

The matrices have similar operations as vectors

\begin{equation*}
\pmb{X}+\pmb{Y}= \left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right) +
\left( 
\matrix{ y_{1,1} & y_{1,2} & \ldots & y_{1,p} \\
y_{2,1} & y_{2,2} & \ldots & y_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
y_{n,1} & y_{n,2} & \cdots & y_{n,p}
}
\right)= 
\left( 
\matrix{ x_{1,1}+y_{1,1} & x_{1,2}+ y_{1,2} & \ldots & x_{1,p}+y_{1,p} \\
x_{2,1}+y_{2,1} & x_{2,2}+y_{2,2} & \ldots & x_{2,p} +y_{2,p}\\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1}+y_{n,1} & x_{n,2}+y_{n,2} & \cdots & x_{n,p}+y_{n,p}
}
\right)
\end{equation*}

\begin{equation*}
\pmb{X}-\pmb{Y}= \left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right) -
\left( 
\matrix{ y_{1,1} & y_{1,2} & \ldots & y_{1,p} \\
y_{2,1} & y_{2,2} & \ldots & y_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
y_{n,1} & y_{n,2} & \cdots & y_{n,p}
}
\right)= 
\left( 
\matrix{ x_{1,1}-y_{1,1} & x_{1,2}- y_{1,2} & \ldots & x_{1,p}-y_{1,p} \\
x_{2,1}-y_{2,1} & x_{2,2}-y_{2,2} & \ldots & x_{2,p} -y_{2,p}\\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1}-y_{n,1} & x_{n,2}-y_{n,2} & \cdots & x_{n,p}-y_{n,p}
}
\right)
\end{equation*}

For any real number $\alpha \in \mathbb{R}$
\begin{equation*}
\alpha \pmb{X}= \alpha\left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right)=
\left( 
\matrix{\alpha x_{1,1} & \alpha x_{1,2} & \ldots & \alpha x_{1,p} \\
\alpha x_{2,1} & \alpha x_{2,2} & \ldots & \alpha x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
\alpha x_{n,1} & \alpha x_{n,2} & \cdots & \alpha x_{n,p}
}
\right)
\end{equation*}

## Transpose of a Matrix

The transpose of a matrix is obtained by swapping rows and columns. 
\begin{equation*}
\pmb{X}= \left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right) 
\Rightarrow
\;\pmb{X}^t=
 \left( 
\matrix{ x_{1,1} & x_{2,1} & \ldots & x_{n,1} \\
x_{1,2} & x_{2,2} & \ldots & x_{n,2} \\
\vdots & \vdots & \ddots & \vdots \\
x_{1,p} & x_{2,p} & \cdots & x_{n,p}
}
\right)
\end{equation*}

## Matrix multiplication

This operation is a bit different than the other operations. 

Let $\pmb{X}$ be an $n\times p$ matrix represented as an arrange of row vectors, and $\pmb{Y}$ be a $p \times k$ matrix represented as an arrange of column vectors

\begin{equation*}
\pmb{X}= 
\left( 
\matrix{ x_{1,1} & x_{1,2} & \ldots & x_{1,p} \\
x_{2,1} & x_{2,2} & \ldots & x_{2,p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n,1} & x_{n,2} & \cdots & x_{n,p}
}
\right)=
\left( 
\matrix{ \pmb{x}_1  \\
\pmb{x}_2 \\
\vdots \\
\pmb{x}_n
}
\right) \; \textrm{and}\;
\pmb{Y} = 
\left( 
\matrix{ y_{1,1} & y_{1,2} & \ldots & y_{1,k} \\
y_{2,1} & y_{2,2} & \ldots & y_{2,k} \\
\vdots & \vdots & \ddots & \vdots \\
y_{p,1} & y_{n,2} & \cdots & y_{n,k}
}
\right)=
\left(
\matrix{\pmb{y}_1 & \pmb{y}_2 & \ldots & \pmb{y}_k \\}
\right)
\end{equation*}

The multiplication of $\pmb{X}$ and $\pmb{Y}$ 

\begin{equation*}
\pmb{X}\cdot\pmb{Y}= \left( 
\matrix{ \pmb{x}_1\cdot\pmb{y}_1  & \pmb{x}_1\cdot \pmb{y}_2 & \ldots & \pmb{x}_1 \cdot \pmb{y}_k \\
\pmb{x}_2\cdot\pmb{y}_1  & \pmb{x}_2\cdot \pmb{y}_2 & \ldots & \pmb{x}_2 \cdot \pmb{y}_k \\
\vdots & \vdots & \ddots & \vdots \\
\pmb{x}_n\cdot\pmb{y}_1  & \pmb{x}_n\cdot \pmb{y}_2 & \ldots & \pmb{x}_n \cdot \pmb{y}_k \\
}
\right) 
\end{equation*}


> Check the size of the matrix under multiplication! Multiplying a matrix of size $n\times k$ by a matrix of size $k \times p$ gives you a matrix of size $n \times p$ (middle number $k$ must coincide but cancells out)

## Example

Consider the following matrices

\begin{equation*}
\pmb{A}=\left(  \matrix{2 & -5 \\ 1 & 2} \right) \; \textrm{and } \; \pmb{B}= \left( \matrix{3 & 2 \\ -1 & 4} \right) 
\end{equation*}

\begin{equation*}
\pmb{A}\cdot \pmb{B}= \left( \matrix{ 
2*3 + (-5)*(-1) & 2*2+(-5)*4 \\
1*3 + 2*(-1) & 1*2+2*4 }
\right)= \left( \matrix{11 & -16 \\ 1 & 10 } \right)
\end{equation*}


## Systems of Equations in Matrix Form

Suppose you want to solve the following system of equations

\begin{align}
2x -5y &= 3\\
x + 2y &= 2
\end{align}

At this point we write these equations as

\begin{equation}
\left(
\matrix{2 & -5\\ 1 & 2}
\right) \cdot \left(
\matrix{x \\ y} 
\right)
= \left(
\matrix{3 \\ 2}
\right)
\end{equation}

If we call $A=\left(
\matrix{2 & -5\\ 1 & 2}
\right)  $, $\pmb{x}= \left( \matrix{x \\y} \right) $ and $\pmb{b}=\left( \matrix{3\\2}\right)$, we can rewrite our system as

\begin{equation*}
\pmb{A}\cdot \pmb{x}=\pmb{b}
\end{equation*}

Following our basic algebra knowledge, we would like to solve this equation as

\begin{equation*}
\pmb{x}= \pmb{A}^{-1} \cdot \pmb{b}
\end{equation*}

But, how do we find $\pmb{A}^{-1}$?



```python
import numpy as np
from numpy.linalg import inv
a = np.array([[2., -5.], [1., 2.]])
ainv = inv(a)
print(ainv)
x=np.dot(ainv,b=np.array([3,2]))
```

    [[ 0.22222222  0.55555556]
     [-0.11111111  0.22222222]]


Thus,
\begin{equation*}
\pmb{x}= \left(
\matrix{
0.222 & 0.556 \\
-0.111 & 0.222 } \right)
\cdot \left( 
\matrix{ 3 \\ 2} \right)= 
\left(\matrix{1.778\\ 0.111} \right)
\end{equation*}

And we can verify that $\pmb{A}\cdot \pmb{x}= \pmb{b}$


```python
print(np.dot(a,x))
```

    [3. 2.]


> Note. Not all the systems of equations have a solution and some have infinite number of solutions.

For instance, 
\begin{align*}
x_1-x_2 +x_3 -x_4 &=1\\
x_1-x_2-x_3+x_4 &=0\\
x_1-x_2-2x_3+2x_4&= -\frac{1}{2}
\end{align*}
or in matrix form
\begin{equation*}
\left(
\begin{matrix}
1 & -1 & 1 & -1 \\
1 & -1 & -1 & 1 \\
1 & -1 & -2 & 2 
\end{matrix} \right)
\cdot \pmb{x}= \left( 
\begin{matrix}
1 \\
0\\
-\frac{1}{2}
\end{matrix}
\right)
\end{equation*}

In this case any expression that satisfies $x_2=x_1 -1/2$ and $x_3=x_4+1/2$ for arbitrary values of $x_1$ and $x_4$ will satisfy the system.
So, what is the problem?

First, there are more $x$'s than equations. But not only that, we have to make sure that the equations that we add make rows *linearly dependent*. This means that they cannot be additions(substractions) or constant multiplication of the previous rows. 

There is a simple way to find out wheter the system has a solution and if so this one would be unique. We apply the **determinant** function. If it is different from zero, we are Ok.

Let's check quickly the what is the definition of the **determinant** of a matrix $A$ of type $n\times n$.

Case $n=2$

\begin{equation*}
\mathrm{det}\left[ 
\begin{matrix}
a_{11} & a_{12} \\
a_{21} & a_{22} 
\end{matrix}
\right]= (a_{11}* a_{22}) - (a_{21}* a_{12})
\end{equation*}

Case n=3

\begin{equation*}
\mathrm{det}
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix}
= a_{11} \cdot \mathrm{det} 
\begin{pmatrix}
a_{22} & a_{23} \\
a_{32} & a_{33}
\end{pmatrix} 
- a_{12}\cdot \mathrm{det}
\begin{pmatrix}
a_{21} & a_{13} \\
a_{31} & a_{33} 
\end{pmatrix} 
+a_{13} \cdot \mathrm{det}
\begin{pmatrix}
a_{21} & a_{22} \\
a_{31} & a_{32} 
\end{pmatrix}
\end{equation*}

Matrices of type $n\times n$ that have determinant different from zero are called **non-singular**. These matrices will have an **inverse matrix** that satisfies

\begin{equation*}
A \cdot A^{-1} = A^{-1} \cdot A = I_n,
\end{equation*}
where $I_n$ is the identity matrix (a matrix of type $n\times n$ that has 1's in the diagonal and zeros elsewhere)


### Example

Let $A$ be the $3\times3$ matrix

\begin{equation}
A=
\begin{pmatrix}
4 & 3 & 2 \\
3& 5 & 2 \\
2 & 2 &1 \\
\end{pmatrix}
\end{equation}

What is the inverse matrix $A^{-1}$?



```python
import numpy as np
A=np.array([[4.,3.,2.],[3.,5.,2.],[2.,2.,1.]])
from numpy.linalg import inv

inv(A)
```




    array([[-1.00000000e+00, -1.00000000e+00,  4.00000000e+00],
           [-1.00000000e+00, -3.22973971e-16,  2.00000000e+00],
           [ 4.00000000e+00,  2.00000000e+00, -1.10000000e+01]])



## Matrices as transformations

Among the different functions say from $f \colon \mathbb{R}^2\to \mathbb{R}^2$, the so-called **linear transformation** play a very important role in mathematics. Such transformations can be represented by a matrix (defined by the transformation itself). Let's suppose we have a vector $\pmb{x}=(x_1,x_2)^t$ (note that we write $\pmb{x}$ as a column vector) and a matrix $\pmb{A}$ (of type $2\times2$ in this case), so we can define a linear transformation 
\begin{equation}
T_A(\pmb{x}) = \pmb{A} \cdot \pmb{x}
\end{equation}
What does the transformation $T_A$ do to any vector $\pmb{x}$?

Here are some possibilitites

+ It keeps the same vector (trivial transformation)

\begin{equation}
\pmb{I}_2 \cdot \pmb{x}= \pmb{x}
\end{equation}

+ Expands the vector in a given direction
$\pmb{x}=\pmatrix{x_1\\x_2}$
\begin{equation}
\begin{pmatrix}
2 & 0\\
0 & 1
\end{pmatrix} \cdot \pmb{x} = (2x_1,x_2)^t= \pmatrix{2x_1\\x_2}
\end{equation}

+ Rotates the vector $180^\circ$

\begin{equation}
\begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix} \cdot \pmb{x} =\pmatrix{-x_1\\ -x_2}
\end{equation}

+ Rotates the vector with a specific angle $\theta$

\begin{equation}
\begin{pmatrix}
\cos(\theta) & \sin (\theta)\\
-\sin (\theta) & \cos(\theta)
\end{pmatrix} \cdot \pmb{x} =\pmatrix{x_1 \cos(\theta) +x_2 \sin(\theta)\\ -x_1\sin(\theta)+ x_2 \cos(\theta)
}
\end{equation}

+ It can project the vector to each coordinate axis

\begin{equation}
\begin{pmatrix}
0 &0 \\
0 & 1 \\
\end{pmatrix} \cdot \pmb{x}= \pmatrix{0 \\ x_2}
\end{equation}

## Rigid transformations

From basic algebra we know that the equation $y=mx +b$ represents a line in the plane with slope $m$ and $y$-intercept $b$. However, a similar expression such as
\begin{equation}
\pmb{A} \cdot \pmb{x} + \pmb{b}
\end{equation}
does not represent a linear transformation! This transformation is a translation of every vector by the vector $\pmb{b}$

For instance, the rigid-transformation $T$ defined as
\begin{equation}
T(\pmb{x})= \pmatrix{
3 & 0 \\
2 & 1 } \cdot \pmb{x}+ \pmatrix{1\\1}
\end{equation}

For $e_1=(1,0)$ and $e_2=(0,1)$



## Composition of transformations

In mathematics, a composition of functions refers to the operation of putting functions in tandem. That is, applying a function to a point (vector) and taking the output to put it as input of another function and so on. 

Let $T_A \colon \mathbb{R}^m\to \mathbb{R}^k$ and $T_B\colon \mathbb{R}^n \to \mathbb{R}^m$ two linear transformations, then the composition $T_A$ with $T_B$ is the (linear) transformation $T_{A B}\colon \mathbb{R}^n \to \mathbb{R}^k$ defined as

\begin{equation}
T_{A B} ( \pmb{x})= T_A\circ T_B(\pmb{x}))= T_A(T_B(\pmb{x}))= \pmb{A} \cdot \pmb{B} \cdot \pmb{x}
\end{equation}



# Geometric properties

The **dot** product on arrays (or vectors) have a nice geometric interpretation

\begin{equation*}
\pmb{x} \cdot \pmb{y} = \| \pmb{x}\| \| \pmb{y} \| \cos( \theta)
\end{equation*}
where $\theta$ is the angle between the two vectors. This property is very handy when we want to find **perpendicular vectors**, in which case $\theta =90^\circ$ and the dot product will be zero!)


There is another operation between vectors in higher dimensions, the so-called **cross-product**. Whereas the previous product results in a number, the cross-product represents another vector.

\begin{equation*}
\pmb{x} \times \pmb{y}= \textrm{det } 
\pmatrix{ \pmb{i} & \pmb{j} & \pmb{k} \\
x_1 & x_2 & x_3\\
y_1 & y_2 & y_3 }
= \pmb{i}(x_2y_3 - y_2 x_3)+ \pmb{j}(x_3y_1-x_1 y_3)+ \pmb{k}(x_1 y_2 -x_2y_1)
\end{equation*}
where $\pmb{i}= (1,0,0)$, $\pmb{j}=(0,1,0)$ and $\pmb{k}=(0,0,1)$.


```python
import numpy as np

x = [1, 2, 0]
y = [4, 5, 6]
np.cross(x, y)
```




    array([12, -6, -3])



# Derivatives and Gradients


## Case $n=1$
We will begin with elementary calculus. Let $f\colon \mathbb{R} \to \mathbb{R}$ be a smooth (differentiable) function at the point $x_0$. 

What does the derivative of $f$ at $x_0$ represents? In theory, it represents the slope of the tangent line of $f(x)$ at $x_0$ (for points *close* to $x_0$). 

\begin{equation}
f'(x_0) \approx \frac{f(x)-f(x_0)}{x-x_0} 
\end{equation}



We can isolate $f(x)$ from the previous expressin and conclude that the derivate provide a linear approximation of a function a the given point for points *close* to $x_0$. More specifically 

\begin{equation}
f(x) \approx f(x_0) + f'(x_0) (x-x_0)
\end{equation}
for points close to $x_0$. 



## Case $n\ge2$

Let us first recall the concept of **level surfaces** of a function. If $f\colon \mathbb{R}^2 \to \mathbb{R}$, we can represent the graph of $f$ in a 3-d plot as a surface. If the function reaches a level $c$ (i.e., there is $\pmb{x}_0$ such that $f(\pmb{x}_0)=c$), then the set of all points in the plane that have the same value $c$ are called the level surface at level $c$.



Another example is the temperature map



Let's suppose now that $f\colon \mathbb{R}^n \to \mathbb{R}$ a smooth (differentiable) function at the point (vector) $\pmb{x}_0=(x_1^0,x_2^0,\ldots,x_n^0)$. The **gradient** of the function $f$ (in cartesian coordinates) is defined as

\begin{equation}
\textrm{grad }f(\pmb{x}_0)= \nabla f(\pmb{x}_0)= \left( \frac{\partial f (\pmb{x_0})}{\partial x_1},\frac{\partial f (\pmb{x_0})}{\partial x_2},\ldots,\frac{\partial f (\pmb{x_0})}{\partial x_n}  \right)
\end{equation}

Recall that the partial derivatives represent derivatives of the function $f$ with respect to a given variable while considering the rest of them constant. 

How can we interpret the gradient?

+ It is a vector whose direction is always perpendicular to the direction of the level surface passing through the point.

+ The gradient vector always points to the direction in which the function $f$ is increasing.


### Example.

Consider $f(x_1,x_2)= 20 \cos(36*(x_1^2+x_2^2))+30$. The surface levels are depicted in the following animation.



Let's suppose we have a value $c=40$. The level-surface $L_c$ is defined as

\begin{equation}
L_c= \{ (x_1,x_2): f(x_1,x_2)=40\}= \{(x_1,x_2): x_1^2+x_2^2= \frac\pi{108} \}
\end{equation}
Thus, $L_c$ represents a circle of radius $\sqrt{\pi/108}$ centered at the origin. The gradient would be
\begin{equation}
\nabla f(x_1,x_2)= \left( 
-1440 \sin(36*(x_1^2+x_2^2))x_1 , -1440 \sin(36*(x_1^2+x_2^2))x_2
\right)
\end{equation}
For a point $(x_1^0,x_2^0) \in L_c$, 
\begin{equation}
\nabla f(x_1^0,x_2^0)= -720\sqrt{3} (x_1^0,x_2^0)
\end{equation}
Thus, the gradient points towards the origin for every point in the level surface $L_c$.



# Random Numbers

Can a deterministic machine produce random numbers? 
In principle, any program in a deterministic machine will produce an output that is entirely predictable, thus not random. 

Our computers produce *pseudo*-random numbers. At the minimum, we expect that a random number generator produces different sequences which are statistically uncorrelated to each other. 

When we invoke a random number generator, we have access to a large sequence of numbers. The term **seed** refers to the initialization point of such sequence. Consecutive calls to the generator will give us the desired sequence or "random" numbers. 

The basic module *random* generates uniform random numbers, but it is possible to use *numpy*.




```python
import random
random.seed(2021)
print("Uniformly Distributed Random numbers between (0,1) ")
print("%.4f"%random.uniform(0,1))
print("%.4f"%random.uniform(0,1))
```

    Uniformly Distributed Random numbers between (0,1) 
    0.8363
    0.8583



```python
import numpy as np
np.random.seed(2021)
print("Uniformly Distributed Random numbers between (0,1) ")
print("%.4f"%np.random.uniform(0,1))
print("%.4f"%np.random.uniform(0,1))
```

    Uniformly Distributed Random numbers between (0,1) 
    0.6060
    0.7334


Let's verify emprically, how accurate are our random number generators


```python
import math
my_mean=0; my_stdev=1.0; n=5000
u=np.random.normal(my_mean,my_stdev,n)
m=sum(u)/n; s =math.sqrt(sum((u-my_mean)**2)/(n-1))
print("Mean = %.5f and Emprical mean= %.5f"%(my_mean,m))
print("Standard Deviation = %.5f and Empirical Stdev = %.5f"%(my_stdev,s))

```

    Mean = 0.00000 and Emprical mean= -0.00063
    Standard Deviation = 1.00000 and Empirical Stdev = 0.99494


# Numerical Python

As we saw in our previous discussion, one of the most often used package for mathematical computations in Python is called *Numerical Python* abbreviates **NumPy**

In **Numpy** arrays with one index are called vectors. 


```python
import numpy as np
a=np.zeros(10)
print(a)
type(a)
```

    [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]





    numpy.ndarray



In the previous example $\verb+a+$ is not a list per se, it has been converted into a *numpy* array.

If we want to find in an interval, say $[1,3]$, 10 uniformly distributed values.  


```python
b=np.linspace(1,3,10)
print(b)
```

    [1.         1.22222222 1.44444444 1.66666667 1.88888889 2.11111111
     2.33333333 2.55555556 2.77777778 3.        ]


f0aabd00331df37d29858f92e0eca96126e7a0b7
ipynb
Jupyter Notebook
Lectures/Lecture_LAlgebra/Lecture_Linear_Algebra.ipynb
horaciogacevedo/Bmig6201
41946bcfcf8782867365bd31d8bff8ed26ddf4fd
Apache-2.0
2021-01-22T13:49:09.000Z
2022-02-24T02:41:00.000Z
Lectures/Lecture_LAlgebra/Lecture_Linear_Algebra.ipynb
horaciogacevedo/Bmig6201
41946bcfcf8782867365bd31d8bff8ed26ddf4fd
Apache-2.0
Lectures/Lecture_LAlgebra/Lecture_Linear_Algebra.ipynb
horaciogacevedo/Bmig6201
41946bcfcf8782867365bd31d8bff8ed26ddf4fd
Apache-2.0
2021-01-30T03:47:51.000Z
2022-02-24T02:41:08.000Z
Qwen/Qwen-72B
1. YES
2. YES