tensors, scalars, vectors, and matrices

tensors, scalars, vectors, and matrices

https://github.com/bovem/publications/tree/master/Linear%20Algebra

A tensor is an array of data (numbers, functions, etc.) that is spread out in any number (0 or greater) of dimensions. The number of dimensions is called tensor rank.

A rank 0 tensor is a tensor with no dimension (0).

alt

A is a tensor that is a 0-dimensional tensor and a rank-1 tensor that is unwrapped in only one dimension.

alt

1D tensor example rank 2 tensor

alt

2D tensor rank 3 tensor

alt

3D tensors are like matrices placed one after the other

As shown, a rank-3 tensor has a cube (or cuboid-like structure).

If the rank of the tensor exceeds 3, it is difficult to visualize.

The explanation given by the video is intuitive and profound

Dan Fleisch gives an amazing explanation of tensors

scalar

A scalar is a rank 0 tensor. In physics, various quantities are expressed as scalars, for example: distance (500 km), temperature (10ºC), speed (34 km/h), etc.

vector

A rank-1 tensor is called a vector. Physical quantities such as velocity (10 m/s), displacement (54 m to the east), electromagnetic field (1 V/m).

The difference between scalar and vector:

Quantities (such as temperature) that do not require additional information (such as direction) are represented as scalars. However, a quantity that needs to specify a direction is represented by a vector (such as an electric field) along with its magnitude.

alt

E is a vector or rank 1 tensor

Vectors are indicated with bold letters such as "E" or an arrow above the letter.

To plot a vector, we use its elements as the values ​​of the coordinates (x, y and z axes respectively). Here, the first element (0.5) is taken as the x value, the second element (0.5) is taken as the y value, and if we have three elements, the third is the z value.

alt

Vector E is drawn on the graph as a blue dot

After plotting the vector as a point, we place an arrow towards it from the origin (0, 0).

A vector is just a matrix with one row (called a column vector) or one column (called a row vector).

matrix

A matrix is ​​a rank 2 tensor. We've seen matrices before.

Tensors with rank greater than 2 are simply called "tensors" (tensors with rank greater than 2 have no specific name).

The concept of tensors generalizes matrices, vectors, and scalars under one roof (they are all tensors, but of different ranks).

Matrix as product of vectors:

When two vectors are multiplied, they form a matrix.

alt

Vector X (order 3×1) will be multiplied by vector Y (order 1×3)

The result is a matrix Z (of order 3×3)

向量 X 和 Y 组合起来有 6 个元素,但它们的乘积本身就有 9 个元素。因此,一些矩阵可以分解为两个向量的乘积。

假设线性方程组如下:

3x-5y = 6 →(1)

x+y = 4 →(2)

3x+y = 0 →(3)

该系统在行图中的表示为:

alt

行图片可以绘制在图上:

alt

从图中我们可以看出,该系统没有一个唯一的解决方案.

为了从行图片中找到线性方程组的解,我们查看图形,看看所有线是否有任何一个交点,该点称为方程组解。

如果没有共同点,那么方程组就没有解(如上例所示)。

列图片

列图是为每个变量单独形成的系数矩阵。之后,变量与其系数矩阵(标量乘法)相乘并相加。

然后,它等同于常数矩阵。

取线性方程组(1)、(2)和(3),列图如下:

alt

“x”和“y”是标量与其相应的系数矩阵相乘

图表上的列图片

为了在图上显示列图片,我们将单个系数矩阵视为向量,并将这些向量绘制在图上。

alt

蓝色向量是X的系数矩阵,红色向量是Y的系数矩阵,绿色向量是常数矩阵

为了从列图片中找到方程组的解,我们将系数矩阵与不同的变量值(x 和 y)相乘并将它们相加(向量加法类似于矩阵加法)。

如果结果等于常数矩阵,则x和y的值称为线性方程组解。

对于此示例,正如我们在行图片中看到的那样,没有解决方案。因此,对于列图片中没有 x 和 y 的值,总和向量将等于常量矩阵(或向量)。

在寻找任何线性方程组的解时,我们可能会遇到以下三种情况之一 一个独特的解决方案 考虑一个线性方程组:

4x+y = 9→(4)

2x-y = 3→(5)

5x-3y = 7→(6)

将这些方程绘制为图表上的行图片和列图片:

alt

(4)(5)和(6)的行图片

alt

(4)(5)和(6)的列图片

为了验证解决方案 x= 2 和 y=1,我们从列图片中替换它们的值并计算。

alt

因此,结果等于常量矩阵。因此,x=2 和 y=1 是方程组(4)(5)和(6)的一个唯一解。

无限多的解决方案 考虑一个线性方程组:

x+2y = 4→(7)

2x+4y = 8→(8)

将这些方程绘制为图表上的行图片和列图片:

alt

两条线相互重叠

Here, we have solutions, but their number is infinite, because the two lines intersect at almost every point.

alt

It seems that the red vector and the green vector are scalar products of the blue vector

Therefore, x and y may have an infinite number of values, so that column_picture returns a constant matrix.

no solution

Consider a system of linear equations:

x+y = 4→(9)

x+y = 8→(10)

x-y = 0→(11)

Plot these equations as row and column pictures on a graph:

alt

All three lines do not intersect

alt

We can see that there is no solution for "x" and "y"

Multiply by row and column image

alt

In addition to the matrix multiplication method discussed earlier, we can also perform multiplication in two other ways

Above: row image multiplication

Middle: When the individual columns of one matrix are multiplied by the rows of another matrix (scalar multiplication), the resulting matrices add.

Bottom: Suppose we have to multiply these two matrices

Column 4 of the first matrix (1) is multiplied by row 1 of the second matrix, column 5 of the first matrix (2) is multiplied by row 2 of the second matrix, and so on

The result is exactly what we would expect from a normal multiplication!

Additional resources:

Joseph C. Kolecki, an introduction to tensors for physics and engineering students, will share in the lecture

alt

This article is published by mdnice multi-platform

Guess you like

Origin blog.csdn.net/qq_40523298/article/details/130401370