0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

多次元の求積

Last updated at Posted at 2025-05-31

初めに

MC/QMCquad rulesの続き.何度味わっても飽きない.

Gauss-Legendreは多次元で折り畳んで重なるが,速度は如何ほどか?

Methods

Quadrature

次を計算したい.

\begin{align}
    I \left[ f (\boldsymbol{x}), D \right]
    := \int_{\boldsymbol{x} \in D}
        f (\boldsymbol{x})
    \; d\boldsymbol{x}
    &\approx \sum_{\boldsymbol{x}_i \in D}
        w_i
        f (\boldsymbol{x}_i)
\end{align}

Monte-Carlo

次をMonte-Carlo求積と呼ぶ.

\begin{align}
    I_{\text{MC}}
    &= \frac{|D|}{N} \sum_{i=1}^{N}
        f (\boldsymbol{x}_i)
    \\
    \mathbb{E} \left[ I_{\text{MC}} \right]
    &= \frac{|D|}{N} \sum_{i=1}^{N}
        \mathbb{E}_{\boldsymbol{x}_i \sim \mathcal{U} (D)} \left[
            f (\boldsymbol{x}_i)
        \right]
    \\
    &= \int_{\boldsymbol{x} \in \Omega}
        f (\boldsymbol{x})
    \; d\boldsymbol{x}
    = I
\end{align}

これは等重み求積であり,明らかにpartition of unityを満たす.$\boldsymbol{x}_i$には,所謂Monte Carloから選ばれるものと,quasi-Monte Carloから選ばれるものを採用する.

Gauss-Legendre

次をGauss-Legendre求積と呼ぶ.

\begin{align}
    I_{\text{GL}}
    &= \sum_{i=1}^{N}
        w_i
        f (\boldsymbol{x}_i)
    \\
    w_i
    &= \int_{-1}^{1} l_i (\boldsymbol{x}) \; d\boldsymbol{x}
    \\
    l_i (\boldsymbol{x})
    &= \prod_{j = 1; j \neq i}^{n} \frac{\boldsymbol{x} - \boldsymbol{x}_j}{\boldsymbol{x}_i - \boldsymbol{x}_j}
    \\
    P_n (\boldsymbol{x}_i)
    &= 0
\end{align}

これは重み付き求積であり,やはりpartition of unityを満たす.なお,$l_i$はLagrange多項式の基底,$P_n$はLegendre多項式である.

Results

2D

Test problem 1-2D

以下を考える.

\begin{align}
    \int_{[0, \pi/2]^2}
        \sin (x_1) 
        \sin (x_2) 
    \; d\boldsymbol{x}
    &= 1
\end{align}
$f$ $\epsilon$
fig_trig_2d.png err_trig_2d.png

Maclaurin展開により,

$\text{poly of order}$ $2$ $4$ $6$ $8$
- fig_trig_2d_approx_p2.png fig_trig_2d_approx_p4.png fig_trig_2d_approx_p6.png fig_trig_2d_approx_p8.png

などによって近似していることが分かる.

Test problem 2-2D

以下を考える.

\begin{align}
    \int_{[0, 1]^2}
        x_1 \log (x_1) \
        x_2 \log (x_2) 
    \; d\boldsymbol{x}
    &= \frac{1}{16}
\end{align}
$f$ $\epsilon$
fig_log_2d.png err_log_2d.png

やはりMaclaurin展開により,

$\text{poly of order}$ $\text{4}$ $\text{5}$ $\text{6}$ $\text{7}$
- fig_log_2d_approx_p4.png fig_log_2d_approx_p5.png fig_log_2d_approx_p6.png fig_log_2d_approx_p7.png

を以て近似している.

3D

Test problem 1-3D

\begin{align}
    \int_{[0, \pi/2]^3}
        \sin (x_1) 
        \sin (x_2) 
        \sin (x_3) 
    \; d\boldsymbol{x}
    &= 1
\end{align}
$f$ $\epsilon$
fig_trig_3d.png err_trig_3d.png

Test problem 2-3D

\begin{align}
    \int_{[0, 1]^3}
        x_1 \log (x_1) \
        x_2 \log (x_2) \
        x_3 \log (x_3) 
    \; d\boldsymbol{x}
    &= \frac{1}{64}
\end{align}
$f$ $\epsilon$
fig_log_3d.png err_log_3d.png

次元が大きくなると速度が落ちる.直感に一致する結果である.しかし,Gauss-LegendreはMCやQMCなど眼中に無いほどに速い.

終わりに

正直に言うと,Gauss-LegendreはGridと同様に重なってゆくから,余り期待していなかった.勿論,強力であることは認めていたし,必要以上に失望していたわけではないのだが...予想を遥かに上回るほどに凄まじい結果であった,ということである.

多次元程度ではGauss-Legendreの独壇場のようである.高次元ではMonte Carloにスポットライトが当たるだろうか.

$\text{ID}$ $\text{Quadrature nodes}$
$\text{Test problem 1}$ image.png
$\text{Test problem 2}$ image.png
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?