0

以下の積分を完全に数値的にできるようにしたいです。

方程式

ここでnイプシロンabおよびベータは、簡単にするためにすべて に設定できる定数1です。

積分はx手動または Mathematica を使用して解析的に行うことができ、次にyNIntegrate を使用して数値的に積分を行うことができますが、これら 2 つの方法では異なる答えが得られます。

分析的に:

In[160]:= ex := 2 (1 - Cos[x])

In[149]:= ey := 2 (1 - Cos[y])

In[161]:= kx := 1/(1 + Exp[ex])

In[151]:= ky := 1/(1 + Exp[ey])

In[162]:= Fn1 := 1/(2 \[Pi]) ((Cos[(x + y)/2])^2)/(ex - ey)

In[163]:= Integrate[Fn1, {x, -Pi, Pi}]

Out[163]= -(1/(4 \[Pi]))
 If[Re[y] >= \[Pi] || \[Pi] + Re[y] <= 0 || 
   y \[NotElement] Reals, \[Pi] Cos[y] - Log[-Cos[y/2]] Sin[y] + 
   Log[Cos[y/2]] Sin[y], 
  Integrate[Cos[(x + y)/2]^2/(Cos[x] - Cos[y]), {x, -\[Pi], \[Pi]}, 
   Assumptions -> ! (Re[y] >= \[Pi] || \[Pi] + Re[y] <= 0 || 
       y \[NotElement] Reals)]]

In[164]:= Fn2 := -1/(
  4 \[Pi]) ((\[Pi] Cos[y] - Log[-Cos[y/2]] Sin[y] + 
     Log[Cos[y/2]] Sin[y]) (1 - ky) ky )/(2 \[Pi])

In[165]:= NIntegrate[Fn2, {y, -Pi, Pi}]

Out[165]= -0.0160323 - 2.23302*10^-15 I

数値法 1:

In[107]:= Fn4 := 
 1/(4 \[Pi]^2) ((Cos[(x + y)/2])^2) (1 - ky) ky/(ex - ey)

In[109]:= NIntegrate[Fn4, {x, -Pi, Pi}, {y, -Pi, Pi}]

During evaluation of In[109]:= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>

During evaluation of In[109]:= NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 18 recursive bisections in x near {x,y} = {0.0000202323,2.16219}. NIntegrate obtained 132827.66472461013` and 19442.543606302774` for the integral and error estimates. >>

Out[109]= 132828.

数値 2:

In[113]:= delta = .001;
pw[x_, y_] := Piecewise[{{1, Abs[Abs[x] - Abs[y]] > delta}}, 0]

In[116]:= Fn5 := (Fn4)*pw[Cos[x], Cos[y]]

In[131]:= NIntegrate[Fn5, {x, -Pi, Pi}, {y, -Pi, Pi}]

During evaluation of In[131]:= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>

During evaluation of In[131]:= NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained 0.013006903336304906` and 0.0006852739534086272` for the integral and error estimates. >>

Out[131]= 0.0130069

したがって、どちらの数値法も を与えません-0.0160323。私はその理由を理解しています - 最初の方法は分母によって引き起こされる無限大に問題があり、2 番目の方法は問題を引き起こしている積分の部分を効果的に削除します。しかし、分析的に単純化できない別の積分 ( xyおよびよりも難しいもの) を統合できるようにしたいと考えています。z上記の積分は、答えがどうあるべきかを知っているので、新しいメソッドをテストする方法を与えてくれます。

4

1 に答える 1

3

私が不可欠な間違いを書き留めていない限り、これは仕事をするはずです:

n[x_] := 1/(1 + Exp[eps[x]])
eps[x_] := 2(1 - Cos[x])
.25/(2*Pi)^2*NIntegrate[
    Cos[(x + y)/
     2]^2 ((1 - n[y]) n[y] - (1 - n[x]) n[x])/(Cos[y] - Cos[x]),
    {x, -Pi, Pi},
    {y, -Pi, Pi},
    Exclusions -> {Cos[x] == Cos[y]}
  ]

与える0.0130098

OK、説明する最も簡単な方法は次のようになると思います。

ここに画像の説明を入力

最初の eq の 1 行目から 2 行目まで、名前を y から x に変更しました (積分領域は対称なので問題ありません)。次に、I の 2 つの (同等の) 式を追加して 2I を取得し、それを数値的に積分します。ポイントは、分子と分母が同じ点でゼロになるということです。したがって、実際にはExclusionsオプションは必要ありません。上記の方法のスケッチでは、1/(4*Pi^2)簡潔にするために (または視点によっては怠惰のために) を削除したことに注意してください。

于 2011-08-18T00:04:29.473 に答える