Đi đến nội dung chính\(\require{cancel}\require{mathtools}\require{color}\require{boldsymbol}\newcommand{\N}{\mathbb{N}}
\newcommand{\pN}{\mathbb{N}^{*}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\pZ}{\mathbb{Z}^{+}}
\newcommand{\mZ}{\mathbb{Z}^{-}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\nQ}{\bar{\mathbb{Q}}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\bs}[1]{\boldsymbol{#1}}
\newcommand{\mat}[1]{\begin{matrix}#1\end{matrix}}
\newcommand{\bmat}[1]{\begin{bmatrix}#1\end{bmatrix}}
\newcommand{\pmat}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\amat}[1]{\left\langle\begin{matrix}#1\end{matrix}\right\rangle}
\newcommand{\hvec}[1]{\bs{[}\begin{matrix}#1\end{matrix}\bs{]}}
\newcommand{\smat}[1]{\begin{smallmatrix}#1\end{smallmatrix}}
\newcommand{\sbmat}[1]{\begin{bsmallmatrix}#1\end{bsmallmatrix}}
\newcommand{\spmat}[1]{\begin{psmallmatrix}#1\end{psmallmatrix}}
\newcommand{\samat}[1]{\left\langle\begin{smallmatrix}#1\end{smallmatrix}\right\rangle}
\newcommand{\shvec}[1]{\bs{[}\begin{smallmatrix}#1\end{smallmatrix}\bs{]}}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Mục 1.4 Nhân Vector Và Số
Mục Tiêu
Tiểu Mục 1.4.1 Nhân vector và số
Thực hiện và cho kết quả tương tự phép nhân số và số.
Ví dụ:
\begin{align}
3 \cdot \bmat{-5 \\ 2.5} = \bmat{3 \cdot (-5) \\ 3 \cdot 2.5} = \bmat{-15 \\ 7.5}\tag{1.4.1}\\
\notag\\
(-2) \hvec{3 & 4} = \hvec{-2 \cdot 3 & -2 \cdot 4} = \hvec{-6 & -8}\tag{1.4.2}\\
\notag\\
5 \bmat{1 \\ 0} + (-3) \bmat{0 \\ 1} = \bmat{5 \\ -3}\tag{1.4.3}
\end{align}
\begin{align}
\notag\\
4 \bmat{5 \\ 6} - 2 \bmat{1 \\ 2} \amp = 4 \bmat{5 \\ 6} + (-2) \bmat{1 \\ 2}\tag{1.4.4}\\
\notag\\
\amp = \bmat{20 \\ 24} + \bmat{-2 \\ -4} = \bmat{18 \\ 20}\notag
\end{align}
Tiểu Mục 1.4.2 Nhân vector và số trong lập trình
Để nhân trong lập trình, ta dùng *
.
Để chia trong lập trình, ta dùng /
.
Output 1.4.3.
[[2]
[4]
[6]]
[[0.5]
[1. ]
[1.5]]
Ví dụ chia vector cho \(0 \rightarrow\) Lỗi:
Output 1.4.4.
ZeroDivisionError
Cell In [1], line 7
...
ZeroDivisionError: rational division by zero