本科生《统计计算》教材,采用R语言和Julia语言,包括误差(8)
计算程序为:
※※※※※
上面的两种计算一元函数定积分的方法可以很容易地推广到多元函数定积分, 或称高维定积分。 设\(d\)元函数\(h(x_1, x_2, \dots, x_d)\)定义于超矩形 \[\begin{aligned} C = \{(x_1, x_2, \ldots, x_d): a_i \leq x_i \leq b_i, i=1,2,\ldots,d \}\end{aligned}\] 且 \[\begin{aligned} 0 \leq h(x_1, \ldots, x_d) \leq M, \ \forall x \in C.\end{aligned}\] 令 \[\begin{aligned} D =& \{(x_1, x_2, \ldots, x_d, y): (x_1, x_2, \ldots, x_d) \in C,\ 0 \leq y \leq h(x_1, x_2, \ldots, x_d) \}, \\ G =& \{(x_1, x_2, \ldots, x_d, y): (x_1, x_2, \ldots, x_d) \in C,\ 0 \leq y \leq M \}\end{aligned}\] 为计算\(d\)维定积分\[\begin{align} I = \int_{a_d}^{b_d} \cdots \int_{a_2}^{b_2} \int_{a_1}^{b_1}h(x_1, x_2, \ldots,x_d) \, dx_1 d x_2 \cdots dx_d, \tag{11.17}\end{align}\]产生服从\(d+1\)维空间中的超矩形\(G\)内的均匀分布的独立抽样 \(\boldsymbol Z_1, \boldsymbol Z_2, \ldots, \boldsymbol Z_N\), 令 \[\begin{aligned} \xi_i = \begin{cases}1, & \boldsymbol Z_i \in D \\0, & \boldsymbol Z_i \in G-D\end{cases}, \quad i=1,2,\ldots,N\end{aligned}\] 则\(\xi_i\) iid b(1,\(p\)), \[\begin{aligned} p = P(\boldsymbol Z_i \in D) = \frac{V(D)}{V(G)}= \frac{I}{M V(C)}= \frac{I}{M \prod_{j=1}^d (b_j-a_j)}\end{aligned}\] 其中\(V(\cdot)\)表示区域体积。
令\(\hat p\)为\(N\)个随机点中落入\(D\)的百分比,则 \[\begin{aligned} \hat p =& \frac{\sum \xi_i}{N} \to p, \ \text{a.s.} (N \to \infty), \end{aligned}\] 用\[\begin{align} \hat I_1 = \hat p V(G) = \hat p \cdot M \, V(C)= \hat p \cdot M \prod_{j=1}^d (b_j-a_j) \tag{11.18}\end{align}\]
估计积分\(I\), 则\(\hat I_1\)是\(I\)的无偏估计和强相合估计。 称用式计算高维定积分\(I\)的方法为随机投点法。
赶上时代机遇