这里写目录标题
手动反爬虫:原博地址
知识梳理不易,请尊重劳动成果,文章仅发布在CSDN网站上,在其他网站看到该博文均属于未经作者授权的恶意爬取信息
如若转载,请标明出处,谢谢!
1 范德蒙德行列式
D = ∣ 1 1 . . . 1 1 x 1 x 2 . . . x n − 1 x n ( x 1 ) 2 ( x 2 ) 2 . . . ( x n − 1 ) 2 ( x n ) 2 . . . . . . . . . . . . . . . ( x 1 ) n − 2 ( x 2 ) n − 2 . . . ( x n − 1 ) n − 2 ( x n ) n − 2 ( x 1 ) n − 1 ( x 2 ) n − 1 . . . ( x n − 1 ) n − 1 ( x n ) n − 1 ∣ = ∏ 1 ⩽ j < i ⩽ n ( x i − x j ) D = \begin{vmatrix}1&1 &...& 1& 1\\x_{1}&x_{2} &... & x_{n-1}&x_{n} \\(x_{1})^{2}&(x_{2})^{2} &... & (x_{n-1})^{2}&(x_{n})^{2}\\... & ...&... &...&... \\ (x_{1})^{n-2}&(x_{2})^{n-2} &... & (x_{n-1})^{n-2}&(x_{n})^{n-2}\\(x_{1})^{n-1}&(x_{2})^{n-1} &... & (x_{n-1})^{n-1}&(x_{n})^{n-1}\end{vmatrix} = \prod_{1\leqslant j <i \leqslant n }(x_{i} - x_{j}) D=∣∣∣∣∣∣∣∣∣∣∣∣1x1(x1)2...(x1)n−2(x1)n−11x2(x2)2...(x2)n−2(x2)n−1..................1xn−1(xn−1)2...(xn−1)n−2(xn−1)n−11xn(xn)2...(xn)n−2(xn)n−1∣∣∣∣∣∣∣∣∣∣∣∣=1⩽j<i⩽n∏(xi−xj)
简单证明
①当n=2时,显然成立
②当n>2时,采用由下往上相邻两行的上一行乘以 − x 1 -x_{1} −x1加到下一行,将第一列全部化为0
③这时候就变成了加边法后的结果了,直接可以去掉“加的边”,此时行列式的阶数就由原来的n阶变成n-1阶了
④然后发现每一列都存在着公因式,因此可以进行提取因式
⑤最后就发现提取的公因式正是j=1时候的表达式相乘,而后面的是在j>1时候的表达式,因此就得证
D = ∣ 1 1 . . . 1 1 x 1 x 2 . . . x n − 1 x n ( x 1 ) 2 ( x 2 ) 2 . . . ( x n − 1 ) 2 ( x n ) 2 . . . . . . . . . . . . . . . ( x 1 ) n − 2 ( x 2 ) n − 2 . . . ( x n − 1 ) n − 2 ( x n ) n − 2 ( x 1 ) n − 1 ( x 2 ) n − 1 . . . ( x n − 1 ) n − 1 ( x n ) n − 1 ∣ D = \begin{vmatrix}1&1 &...& 1& 1\\x_{1}&x_{2} &... & x_{n-1}&x_{n} \\(x_{1})^{2}&(x_{2})^{2} &... & (x_{n-1})^{2}&(x_{n})^{2}\\... & ...&... &...&... \\ (x_{1})^{n-2}&(x_{2})^{n-2} &... & (x_{n-1})^{n-2}&(x_{n})^{n-2}\\(x_{1})^{n-1}&(x_{2})^{n-1} &... & (x_{n-1})^{n-1}&(x_{n})^{n-1}\end{vmatrix} D=∣∣∣∣∣∣∣∣∣∣∣∣1x1(x1)2...(x1)n−2(x1)n−11x2(x2)2...(x2)n−2(x2)n−1..................1xn−1(xn−1)2...(xn−1)n−2(xn−1)n−11xn(xn)2...(xn)n−2(xn)n−1∣∣∣∣∣∣∣∣∣∣∣∣
= ∣ 1 1 . . . 1 1 0 x 2 − x 1 . . . x n − 1 − x 1 x n − x 1 0 ( x 2 ) 2 − x 1 x 2 . . . ( x n − 1 ) 2 − x 1 x n − 1 ( x n ) 2 − x 1 x n . . . . . . . . . . . . . . . 0 ( x 2 ) n − 2 − x 1 ( x 2 ) n − 3 . . . ( x n − 1 ) n − 2 − x 1 ( x n − 1 ) n − 3 ( x n ) n − 2 − x 1 ( x n ) n − 3 0 ( x 2 ) n − 1 − x 1 ( x 2 ) n − 2 . . . ( x n − 1 ) n − 1 − x 1 ( x n − 1 ) n − 2 ( x n ) n − 1 − x 1 ( x n ) n − 2 ∣ = \text{ } \text{ } \text{ }\begin{vmatrix}1&1 &...& 1& 1\\0&x_{2} -x_{1}&... & x_{n-1}-x_{1}&x_{n}-x_{1} \\0&(x_{2})^{2} -x_{1}x_{2}&... & (x_{n-1})^{2} -x_{1}x_{n-1}&(x_{n})^{2}-x_{1}x_{n}\\... & ...&... &...&... \\ 0&(x_{2})^{n-2}-x_{1}(x_{2})^{n-3} &... & (x_{n-1})^{n-2}-x_{1}(x_{n-1})^{n-3}&(x_{n})^{n-2}-x_{1}(x_{n})^{n-3}\\0&(x_{2})^{n-1} -x_{1}(x_{2})^{n-2}&... & (x_{n-1})^{n-1}-x_{1}(x_{n-1})^{n-2}&(x_{n})^{n-1}-x_{1}(x_{n})^{n-2}\end{vmatrix} = ∣∣∣∣∣∣∣∣∣∣∣∣100...001x2−x1(x2)2−x1x2...(x2)n−2−x1(x2)n−3(x2)n−1−x1(x2)n−2..................1xn−1−x1(xn−1)2−x1xn−1...(xn−1)n−2−x1(xn−1)n−3(xn−1)n−1−x1(xn−1)n−21xn−x1(xn)2−x1xn...(xn)n−2−x1(xn)n−3(xn)n−1−x1(xn)n−2∣∣∣∣∣∣∣∣∣∣∣∣
= ∣ x 2 − x 1 . . . x n − 1 − x 1 x n − x 1 ( x 2 ) 2 − x 1 x 2 . . . ( x n − 1 ) 2 − x 1 x n − 1 ( x n ) 2 − x 1 x n . . . . . . . . . . . . ( x 2 ) n − 2 − x 1 ( x 2 ) n − 3 . . . ( x n − 1 ) n − 2 − x 1 ( x n − 1 ) n − 3 ( x n ) n − 2 − x 1 ( x n ) n − 3 ( x 2 ) n − 1 − x 1 ( x 2 ) n − 2 . . . ( x n − 1 ) n − 1 − x 1 ( x n − 1 ) n − 2 ( x n ) n − 1 − x 1 ( x n ) n − 2 ∣ n − 1 = \text{ } \text{ } \text{ }\begin{vmatrix}\\x_{2} -x_{1}&... & x_{n-1}-x_{1}&x_{n}-x_{1} \\(x_{2})^{2} -x_{1}x_{2}&... & (x_{n-1})^{2} -x_{1}x_{n-1}&(x_{n})^{2}-x_{1}x_{n}\\ ...&... &...&... \\ (x_{2})^{n-2}-x_{1}(x_{2})^{n-3} &... & (x_{n-1})^{n-2}-x_{1}(x_{n-1})^{n-3}&(x_{n})^{n-2}-x_{1}(x_{n})^{n-3}\\(x_{2})^{n-1} -x_{1}(x_{2})^{n-2}&... & (x_{n-1})^{n-1}-x_{1}(x_{n-1})^{n-2}&(x_{n})^{n-1}-x_{1}(x_{n})^{n-2}\end{vmatrix}_{n-1} = ∣∣∣∣∣∣∣∣∣∣x2−x1(x2)2−x1x2...(x2)n−2−x1(x2)n−3(x2)n−1−x1(x2)n−2...............xn−1−x1(xn−1)2−x1xn−1...(xn−1)n−2−x1(xn−1)n−3(xn−1)n−1−x1(xn−1)n−2xn−x1(xn)2−x1xn...(xn)n−2−x1(xn)n−3(xn)n−1−x1(xn)n−2∣∣∣∣∣∣∣∣∣∣n−1
= ( x 2 − x 1 ) ( x 2 − x 1 ) . . . ( x n − x 1 ) ∣ 1 . . . 1 1 x 2 . . . x n − 1 x n ( x 2 ) 2 . . . ( x n − 1 ) 2 ( x n ) 2 . . . . . . . . . . . . ( x 2 ) n − 2 . . . ( x n − 1 ) n − 2 ( x n ) n − 2 ( x 2 ) n − 1 . . . ( x n − 1 ) n − 1 ( x n ) n − 1 ∣ n − 1 = \text{ } \text{ } \text{ }(x_{2} -x_{1})(x_{2} -x_{1})...(x_{n} -x_{1})\begin{vmatrix}1 &...& 1& 1\\x_{2} &... & x_{n-1}&x_{n} \\(x_{2})^{2} &... & (x_{n-1})^{2}&(x_{n})^{2}\\...&... &...&... \\ (x_{2})^{n-2} &... & (x_{n-1})^{n-2}&(x_{n})^{n-2}\\(x_{2})^{n-1} &... & (x_{n-1})^{n-1}&(x_{n})^{n-1}\end{vmatrix}_{n-1} = (x2−x1)(x2−x1)...(xn−x1)∣∣∣∣∣∣∣∣∣∣∣∣1x2(x2)2...(x2)n−2(x2)n−1..................1xn−1(xn−1)2...(xn−1)n−2(xn−1)n−11xn(xn)2...(xn)n−2(xn)n−1∣∣∣∣∣∣∣∣∣∣∣∣n−1
= ( x 2 − x 1 ) ( x 2 − x 1 ) . . . ( x n − x 1 ) ∏ 2 ⩽ j < i ⩽ n ( x i − x j ) = ∏ 1 ⩽ j < i ⩽ n ( x i − x j ) = \text{ } \text{ } \text{ }(x_{2} -x_{1})(x_{2} -x_{1})...(x_{n} -x_{1}) \prod_{2\leqslant j <i \leqslant n }(x_{i} - x_{j}) \text{ } \text{ } \text{ }= \text{ } \text{ } \text{ } \prod_{1\leqslant j <i \leqslant n }(x_{i} - x_{j}) = (x2−x1)(x2−x1)...(xn−x1)2⩽j<i⩽n∏(xi−xj) = 1⩽j<i⩽n∏(xi−xj)
5阶行列范德蒙德展开
①当j=1时,i = 2,3,4,5
②当j=2时,i = 3,4,5
③当j=3时,i = 4,5
④当j=4时,i = 5
⑤最后展开一共十项
∣
1
1
1
1
1
x
1
x
2
x
3
x
4
x
5
(
x
1
)
2
(
x
2
)
2
(
x
3
)
2
(
x
4
)
2
(
x
5
)
2
(
x
1
)
3
(
x
2
)
3
(
x
3
)
3
(
x
4
)
3
(
x
5
)
3
(
x
1
)
4
(
x
2
)
4
(
x
2
)
4
(
x
4
)
4
(
x
5
)
4
∣
\begin{vmatrix}1&1 &1& 1& 1\\x_{1}&x_{2} &x_{3}& x_{4}&x_{5} \\(x_{1})^{2}&(x_{2})^{2} &(x_{3})^{2}& (x_{4})^{2}&(x_{5})^{2}\\ (x_{1})^{3}&(x_{2})^{3} &(x_{3})^{3} & (x_{4})^{3}&(x_{5})^{3}\\(x_{1})^{4}&(x_{2})^{4} &(x_{2})^{4} & (x_{4})^{4}&(x_{5})^{4}\end{vmatrix}
∣∣∣∣∣∣∣∣∣∣1x1(x1)2(x1)3(x1)41x2(x2)2(x2)3(x2)41x3(x3)2(x3)3(x2)41x4(x4)2(x4)3(x4)41x5(x5)2(x5)3(x5)4∣∣∣∣∣∣∣∣∣∣
=
(
x
2
−
x
1
)
(
x
3
−
x
1
)
(
x
4
−
x
1
)
(
x
5
−
x
1
)
(
x
3
−
x
2
)
(
x
4
−
x
2
)
(
x
5
−
x
2
)
(
x
4
−
x
3
)
(
x
5
−
x
3
)
(
x
5
−
x
4
)
= \text{ } \text{ } \text{ } (x_{2}-x_{1})(x_{3}-x_{1})(x_{4}-x_{1})(x_{5}-x_{1})(x_{3}-x_{2})(x_{4}-x_{2})(x_{5}-x_{2})(x_{4}-x_{3})(x_{5}-x_{3})(x_{5}-x_{4})
= (x2−x1)(x3−x1)(x4−x1)(x5−x1)(x3−x2)(x4−x2)(x5−x2)(x4−x3)(x5−x3)(x5−x4)
小示例
∣
1
1
1
1
1
5
−
1
3
2
4
25
1
9
4
16
125
−
1
27
8
64
625
1
81
16
256
∣
\begin{vmatrix}1&1 &1& 1& 1\\5&-1 &3& 2&4 \\25&1 &9& 4&16\\125&-1&27&8&64\\ 625&1&81 &16&256\end{vmatrix}
∣∣∣∣∣∣∣∣∣∣15251256251−11−111392781124816141664256∣∣∣∣∣∣∣∣∣∣
=
(
−
1
−
5
)
(
3
−
5
)
(
2
−
5
)
(
4
−
5
)
(
3
+
1
)
(
2
+
1
)
(
4
+
1
)
(
2
−
3
)
(
4
−
3
)
(
4
−
2
)
=
−
4320
=(-1-5)(3-5)(2-5)(4-5)(3+1)(2+1)(4+1)(2-3)(4-3)(4-2)=-4320
=(−1−5)(3−5)(2−5)(4−5)(3+1)(2+1)(4+1)(2−3)(4−3)(4−2)=−4320
python代码实现
import numpy as np
from numpy.linalg import *
mydet=np.array([[1,1,1,1,1],[5,-1,3,2,4],[25,1,9,4,16],[125,-1,27,8,64],[625,1,81,16,256]])
print(det(mydet))
→ 输出的结果为:(验证无误)
-4320.000000000022
2 克莱姆法则
注意克莱姆法则使用的前提条件:方程的个数等于未知数的个数
系数行列式:就是把方程组里面未知数的系数拿出来组成的行列式,比如下面方程组的系数行列式如下
{ x 1 + x 2 + x 3 = 7 x 1 − x 2 + 5 x 3 = 6 − x 1 + x 2 + 6 x 3 = 9 ⇒ D = ∣ 1 1 1 1 − 1 5 − 1 1 6 ∣ \begin{cases} x_{1}+x_{2} + x_{3} =7 \\ x_{1}-x_{2}+5x_{3}=6\\ -x_{1} +x_{2} +6x_{3} =9 \end{cases} \text{ } \text{ } \text{ } \text{ } \text{ } \text{ } \Rightarrow \text{ } \text{ } \text{ } \text{ } \text{ } \text{ } D = \begin{vmatrix}1&1 &1\\1&-1 &5\\-1&1 &6\end{vmatrix} ⎩⎪⎨⎪⎧x1+x2+x3=7x1−x2+5x3=6−x1+x2+6x3=9 ⇒ D=∣∣∣∣∣∣11−11−11156∣∣∣∣∣∣
如果系数行列式 D ! = 0 D != 0 D!=0,,那么未知数的解就为 x j = D j D x_{j} =\frac{D_{j}}{D} xj=DDj,其中 D j D_{j} Dj是将未知数所在的列元素换成方程组等号右侧的值,然后其他列的元素就是原系数行列式元素不变,注意观察每列的变化
D 1 = ∣ 7 1 1 6 − 1 5 9 1 6 ∣ D 2 = ∣ 1 7 1 1 6 5 − 1 9 6 ∣ D 3 = ∣ 1 1 7 1 − 1 6 − 1 1 9 ∣ D_{1} = \begin{vmatrix}7&1 &1\\6&-1 &5\\9&1 &6\end{vmatrix} \text{ } \text{ } \text{ } \text{ } \text{ } \text{ }D_{2} = \begin{vmatrix}1&7 &1\\1&6 &5\\-1&9&6\end{vmatrix} \text{ } \text{ } \text{ } \text{ } \text{ } \text{ }D_{3} = \begin{vmatrix}1&1 &7\\1&-1 &6\\-1&1&9\end{vmatrix} \text{ } \text{ } \text{ } \text{ } \text{ } \text{ } D1=∣∣∣∣∣∣7691−11156∣∣∣∣∣∣ D2=∣∣∣∣∣∣11−1769156∣∣∣∣∣∣ D3=∣∣∣∣∣∣11−11−11769∣∣∣∣∣∣
故可以算出未知数的解:(很明显发现D在分母上,所以要求系数行列式不为0)
x
1
=
D
1
D
=
2.41
x
2
=
D
2
D
=
3.23
x
3
=
D
3
D
=
1.36
x_{1} = \frac{D_{1}}{D}=2.41 \text{ } \text{ } \text{ } \text{ } \text{ } \text{ }x_{2} = \frac{D_{2}}{D}= 3.23\text{ } \text{ } \text{ } \text{ } \text{ } \text{ }x_{3} = \frac{D_{3}}{D}=1.36
x1=DD1=2.41 x2=DD2=3.23 x3=DD3=1.36
综上,克莱姆法则的使用中:①方程的个数与未知数个数相等;②系数行列式的值不为0;③计算量是非常大的,可借助编程实现
import numpy as np
d = np.reshape([1,1,1,1,-1,5,-1,1,6],(3,3))
d1 = np.reshape([7,1,1,6,-1,5,9,1,6],(3,3))
d2 = np.reshape([1,7,1,1,6,5,-1,9,6],(3,3))
d3 = np.reshape([1,1,7,1,-1,6,-1,1,9],(3,3))
x1 = np.linalg.det(d1)/np.linalg.det(d)
x2 = np.linalg.det(d2)/np.linalg.det(d)
x3 = np.linalg.det(d3)/np.linalg.det(d)
print(x1,x2,x3)
#2.409090909090908 3.2272727272727266 1.3636363636363635
定理1: 如果多元方程组的右侧全为0(也称齐次方程组),至少有零解,因为直接将方程组最后的结果替换到相应的列。 D i D_{i} Di行列式的值均为0,也就是分子为0
定理2:对于齐次方程组,且系数行列式不为0,那么方程组只有零解
定理3:齐次方程组(方程个数等于未知数个数)有非零解 ⟺ D = 0 \iff D = 0 ⟺D=0