Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinZonda committed Nov 15, 2024
1 parent 33ebc7c commit f2ed481
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Introduction/MathRecap.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ $$
\begin{align}
\prod_{i=1}^k x_i &= x_1 \cdot x_2 \cdot \ldots \cdot x_k\\
\log \prod_{i=1}^k x_i &= \log x_1 + \log x_2 + \ldots + \log x_k\\
\log \prod_{i=1}^k x_i &= \sum_{i=1}^k \log x_i
&= \sum_{i=1}^k \log x_i
\end{align}
$$

乘法运算对于计算机是很慢的,而加法运算是很快的。因此我们可以使用对数来简化计算
乘法运算对于计算机是很慢的,而加法运算是很快的。因此我们可以使用对数来简化和加速计算

于此同时更重要的是在计算多次概率 $p(x) \leq 1$ 的乘积时,其结果可能是一个非常非常小的数(考虑 $0.9^{100}=0.00002656139$,而计算机在存储小数时,可能会有精度丢失(也就是会不准确),而越小的数,精度可能丢失的越快。我们称这种问题为下溢出(underflow)。考虑对数可以将小数相乘转化为相加,从而避免了下溢出的问题 $\ln 0.9^{100}=100 \ln 0.9 = -10.5360515658$。

Expand Down

0 comments on commit f2ed481

Please sign in to comment.