对数
对数中一个有用的底数是 $e$,其定义为
$e = lim_{n o infty}(1+frac{1}{n})^n = 1 + frac{1}{1!} + frac{1}{2!} + ... = 2.718281828$
通常把 $log_ex$ 写成 $lnx$,成为 $x$ 的自然对数,自然对数也定义为
$$ln x = int _1^xfrac{1}{t}dt$$
换底公式:
$log_ax = log_ab * log_bx$ 或 $log_ax = frac{log_bx}{log_ba}$.
一个重要的等式:
$x^{log_ay} = y^{log_ax}, x,y>0$.
可以通过两边取对数来证明。
底函数和顶函数
用 $left lfloor x ight floor$ 来表示小于等于 $x$ 的最大整数,用 $left lceil x ight ceil$ 表示大于等于 $x$ 的最小整数,例如
$left lfloor sqrt 2 ight floor = 1, left lceil sqrt2 ight ceil = 2, left lfloor -2.5 ight floor = -3, left lceil -2.5 ight ceil = -2$.
一些重要的等式:
当 $x$ 为整数时,$left lfloor x ight floor + left lceil x ight ceil = x$.
当 $x$ 为实数时,$left lfloor -x ight floor = -left lfloor x ight floor$;
当 $x$ 为实数时,$left lceil -x ight ceil = - left lceil x ight ceil$.
一个很有用的定理:
定理:$f(x)$ 是单调递增函数,使得若 $f(x)$ 是整数,则 $x$ 是整数。那么
$$left lfloor f(left lfloor x ight floor) ight floor = left lfloor f(x) ight floor 或 left lceil f(left lceil x ight ceil) ight ceil = left lceil f(x) ight ceil$$.
例如:$left lceil sqrt{left lceil x ight ceil} ight ceil = left lceil sqrt x ight ceil$,$left lfloor log {left lfloor x ight floor} ight floor = left lfloor log x ight floor$.
从这个定理出发得出,当 $n$ 是整数时, $left lfloor left lfloor x ight floor /n ight floor = left lfloor x/n ight floor$ 且 $left lceil left lceil x ight ceil/n ight ceil = left lceil x/n ight ceil$.
例如,如果令 $x=n/2$,那么
$$left lfloor left lfloor left lfloor n/2 ight floor/2 ight floor/2 ight floor = left lfloorleft lfloor n/4 ight floor /2 ight floor = left lfloor n/8 ight floor$$.
阶乘
$n!$ 有一个近似公式是 String公式:
$$n! approx sqrt{2pi n}(frac{n}{e})^n$$
例如用 String 公式,可以得到 $30! approx 2.64e32$.
相对误差大约是0.27%,但是绝对误差还是很大的。
二项式系数
由二项式定理,
$$(1+x)^n = sum_{i=1}^ninom{n}{i}x^i$$
如果令 $x=1$,就有
$$inom{n}{0} + inom{n}{1} + ... + inom{n}{n} = 2^n$$
从组合的角度讲,这个恒等式表明在一个大小为 $n$ 的集合中,所有子集的个数为 $2^n$,这和我们的预期一样。
如果令 $x=-1$,有
$$inom{n}{0} - inom{n}{1} + inom{n}{2}-...pm inom{n}{n} = 0$$
这表明奇数项的组合数数之和等于偶数项的组合数之和,即 $sum_{j even}inom{n}{j} = sum_{j odd}^ninom{n}{j}$.
如果分别令 $n=1,2,3...$,可以得到下面的展开式:$(1+x) = 1+x, (1+x)^2 = 1+2x+x^2, (1+x)^3 = 1+3x+3x^2+x^3$,等等。取系数,就得到了杨辉三角,
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1
可以看到,$b$足够大时,二项式系数是数 $(1+b)^n$ 用 $b$ 进制表示时各位上的数字。例如,10为基数,有 $11^0=1, 11^2 = 121, 11^3 = 1331, 11^4 = 14641$.