欧拉公式是数学中最重要的公式之一, 它涉及到了复数, 无理数, 三角函数, 简单优美
e i θ = c o s ( θ ) + i s i n ( θ ) e^{i\theta} = cos(\theta) + isin(\theta) eiθ=cos(θ)+isin(θ)
欧拉公式代表的含义并不是欧拉最先发现的, 1714年英国物理学家和数学家罗杰·柯茨在一个公式中建立了对数, 三角函数和虚数之间的关系, 在1740年前后, 欧拉通过另一种形式得到了等价的公式.
i θ = l n ( c o s ( θ ) + i s i n ( θ ) ) i\theta = ln\left(cos(\theta) + isin(\theta)\right) iθ=ln(cos(θ)+isin(θ))
如果把 θ \theta θ 的值特殊化为 θ = π \theta = \pi θ=π,就得到了欧拉恒等式
e π i = − 1 e^{\pi i} = -1 eπi=−1
自然常数e
自然常数e是一个特殊的常数, 它的特性是 $ \left ( e^{x} \right )’ = e^{x} $, 即指数函数的导数还是自身
e的定义如下
$e = \lim_{x \to 0} (1 + x)^{\frac{1}{x}} $
或
e = lim x → ∞ ( 1 + 1 x ) x e = \lim_{x \to \infty} (1 + \frac{1}{x})^{x} e=limx→∞(1+x1)x
这个极限收敛, 值约为2.71828
对 e x e^x ex 的导数不变性的证明:
因为当e趋于无穷小时, $e = \lim_{x \to 0} (1 + x)^{\frac{1}{x}} $ (这里实际上包含一个物理意义, 在 lim x → 0 \lim_{x \to 0} limx→0 时 e x e^x ex 和 y = x y=x y=x 的曲线是无限接近的)
对其变形可得
e x = l i m x → 0 1 + x e^x = lim_{x \to 0}1 + x ex=limx→01+x,
x = l i m x → 0 e x − 1 x = lim_{x \to 0}e^x - 1 x=limx→0ex−1,
1 = l i m x → 0 e x − 1 x 1 = lim_{x \to 0} \frac{e^{x} - 1}{x} 1=limx→0xex−1,
于是根据导数的定义,对于 e x e^x ex, 我们给自变量x一个微小增量dx,可以得到
y ′ = e ( x + d x ) − e x d x y' = \frac{e^{(x+dx)}-e^{x}}{dx} y′=dxe(x+dx)−ex
= e x ∗ e d x − e x d x = \frac{e^x * e^{dx} - e^x}{dx} =dxex∗edx−ex
= e x ∗ e d x − 1 d x = e^x * \frac{e^{dx} - 1}{dx} =ex∗dxedx−1, 将上面的等式代入
= e x ∗ 1 = e x = y = e^x * 1 = e^x = y =ex∗1=ex=y
自然常数e的指数函数
f ( x ) = e x f(x) = e^x f(x)=ex 的泰勒级数展开
e x p ( x ) = 1 + x 1 1 ! + x 2 2 ! + x 3 3 ! + . . . = ∑ i = 0 n x n n ! exp(x) = 1 + \frac{x^1}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + ... = \sum_{i=0}^{n} \frac{x^n}{n!} exp(x)=1+1!x1+2!x2+3!x3+...=∑i=0nn!xn
当 x = i θ x = i\theta x=iθ 时, e x p ( i θ ) exp(i\theta) exp(iθ) 就成为了复平面上的一个圆
e i ( 0 + 2 n π ) = 1 e^{i(0 + 2n\pi)} = 1 ei(0+2nπ)=1
e i ( π 2 + 2 n π ) = i e^{i(\frac{\pi}{2} + 2n\pi)} = i ei(2π+2nπ)=i
e i ( π + 2 n π ) = − 1 e^{i(\pi + 2n\pi)} = -1 ei(π+2nπ)=−1
e i ( 3 π 2 + 2 n π ) = − i e^{i(\frac{3\pi}{2} + 2n\pi)} = -i ei(23π+2nπ)=−i
数值验证
用一小段c代码验证 e i ( π + 2 n π ) = − 1 e^{i(\pi + 2n\pi)} = -1 ei(π+2nπ)=−1
#define PI 3. #define STEP 18 int main(void) {
int32_t i = 0; int64_t factorial = 1; double real = 1, imaginary = 0, pp = 1, curr; for (i = 0; i < STEP; i++) {
pp = pp * PI; factorial = factorial * (i + 1); curr = pp / factorial; if (i % 4 == 0) imaginary += curr; else if (i % 4 == 1) real -= curr; else if (i % 4 == 2) imaginary -= curr; else real += curr; printf("%3d - %20.6f / %25lu = %f, %10f %10f\r\n", i, pp, factorial, curr, real, imaginary); } }
讯享网
当step为18时, 其输出为
讯享网 0 - 3. / 1 = 3., 1.000000 3. 1 - 9. / 2 = 4., -3. 3. 2 - 31.006275 / 6 = 5., -3. -2.026120 3 - 97. / 24 = 4.058712, 0. -2.026120 4 - 306.019659 / 120 = 2., 0. 0. 5 - 961. / 720 = 1., -1. 0. 6 - 3020. / 5040 = 0., -1. -0.075221 7 - 9488. / 40320 = 0., -0. -0.075221 8 - 29809.094757 / = 0.082146, -0. 0.006925 9 - 93648.031501 / = 0.025807, -1.001829 0.006925 10 - . / = 0.007370, -1.001829 -0.000445 11 - . / = 0.001930, -0. -0.000445 12 - . / = 0.000466, -0. 0.000021 13 - .003250 / = 0.000105, -1.000004 0.000021 14 - . / 00 = 0.000022, -1.000004 -0.000001 15 - . / 000 = 0.000004, -1.000000 -0.000001 16 - . / 6000 = 0.000001, -1.000000 0.000000 17 - . / 28000 = 0.000000, -1.000000 0.000000
应用
欧拉公式中, c o s ( θ ) cos(\theta) cos(θ)是实部, s i n ( θ ) sin(\theta) sin(θ)是虚部, 分别可以表示为
c o s ( x ) = 1 − x 2 2 ! + x 4 4 ! + . . . = ∑ i = 0 n ( − 1 ) n x 2 n 2 n ! cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} + ... = \sum_{i=0}^{n} (-1)^n\frac{x^{2n}}{2n!} cos(x)=1−2!x2+4!x4+...=∑i=0n(−1)n2n!x2n
s i n ( x ) = x 1 1 ! − x 3 3 ! + x 5 5 ! − . . . = ∑ i = 0 n ( − 1 ) n x 2 n + 1 ( 2 n + 1 ) ! sin(x) = \frac{x^1}{1!} - \frac{x^3}{3!} + \frac{x^5}{5!} - ... = \sum_{i=0}^{n} (-1)^n\frac{x^{2n + 1}}{(2n+1)!} sin(x)=1!x1−3!x3+5!x5−...=∑i=0n(−1)n(2n+1)!x2n+1
这样就建立了三角函数和普通指数运算的桥梁, 在计算机上, 计算三角函数 sin, cos 以及其派生出的其他数值, 都可以通过泰勒级数进行计算, 根据需要可以通过循环次数控制精度.
参考
- https://en.wikipedia.org/wiki/Euler%27s_formula
- e^(iπ) in 3.14 minutes, using dynamics | DE5

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/117474.html