| Author |
Comment/Response |
Felipe Benguria
|
11/15/12 1:04pm
Hi,
I am trying to integrate a function using nintegrate. I need to integrate this function for different parameters, which change its shape. Ideally, I would just very wide limits of integration , since for some parameters, the function can have a wide domain. However, NIntegrate sometimes fails to give the right answer when the limits of integration are too wide. An example of the problem is below.
I define and plot a function:
f[x_] := 7*Exp[-5*x^2]
Plot[f[x], {x, -10, 10}, AxesOrigin -> {0, 0}, PlotRange -> {0, 10}]
I try to integrate the functions for different limits, and in the last case, when they are too wide, the value goes to zero.
NIntegrate[f[x], {x, -5, 5}, AccuracyGoal -> 8]
NIntegrate[f[x], {x, -10, 10}, AccuracyGoal -> 8]
NIntegrate[f[x], {x, -20, 20}, AccuracyGoal -> 8]
NIntegrate[f[x], {x, -100, 100}, AccuracyGoal -> 8]
NIntegrate[f[x], {x, -1000, 1000}, AccuracyGoal -> 8]
The issue is that I need to have wide limits of integration because for some parameters the function f[x] will actually have positive values for a large domain of x.
Thanks a lot for your help
URL: , |
|