Qurak

N integrate integration strategies extrapolating oscillatory strategy

Tutorial 9 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
NIntegrate[Sin[200 x ^ 2 + 5](1/(x + 1) ^ 2), {x, 0, ∞}, Method -> "ExtrapolatingOscillatory"]
Output
NIntegrate[Sin[5 + 200*x^2]/(1 + x)^2, {x, 0, Infinity}, Method -> ExtrapolatingOscillatory]
Step 2
Clear[ω, k, f];
ω = 20;
k[x_] := Sin[ω x];
f[x_] := (1/(x + 1) ^ 2);

No output - this step sets something up for the next one.

Step 3
Plot[k[x]f[x], {x, 0, 10}, PlotPoints -> 1000, PlotRange -> All]
Output
-Graphics-
Step 4
psum[i_ ? NumberQ] := NIntegrate[k[x]f[x], {x, i(1/ω) π, (i + 1)(1/ω) π}]

No output - this step sets something up for the next one.

Step 5
res = NSum[psum[i], {i, 0, ∞}, Method -> "AlternatingSigns", "VerifyConvergence" -> False]
Output
0.04928412772506762
Step 6
exact = Integrate[k[x]f[x], {x, 0, ∞}]//N
Output
0.05692157040109628
Step 7
(Abs[exact - res]/Abs[exact])
Output
0.13417484131607102
Step 8
resEO = NIntegrate[Sin[ω x]f[x], {x, 0, ∞}, Method -> "ExtrapolatingOscillatory"]
Output
NIntegrate[Sin[20*x]/(1 + x)^2, {x, 0, Infinity}, Method -> ExtrapolatingOscillatory]
Step 9
(Abs[exact - resEO]/Abs[exact])
Output
17.568032521828325*Abs[0.05692157040109628 - NIntegrate[Sin[20*x]/(1 + x)^2, {x, 0, Infinity}, Method -> ExtrapolatingOscillatory]]

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client