Message Boards Message Boards

Question about numerical integration

Posted 8 years ago

Hi, I have a function f(x) as following:

f[x_] := (-2 Sqrt[x] (\[Pi]^2 + x) + Exp[\[Pi]^2/x] \[Pi]^(3/2) (2 \[Pi]^2 + 3 x) Erfc[\[Pi]/Sqrt[x]]) (-Sqrt[100 - x] + Exp[\[Pi]^2/(-x + 100)] \[Pi]^(3/2) Erfc[\[Pi]/Sqrt[100 - x]])/(x^(7/2) Sqrt[-x + 100])

enter image description here

When I plot f(x) vs x from 0 to 10, I have the following figure

Plot[f[x], {x, 0, 10}]

enter image description here

and when f(x) is plotted against x from 0 to 0.01, it produces the following graph

Plot[f[x], {x, 0, 0.01}]

enter image description here

I would like to find the integral of f(x) with respect to x from 0 to 100, but Mathematica cannot calculate the integral.

Therefore, I try to do numerical integration. However, I received the following error message.

NIntegrate[f[x], {x, 0, 100}]

enter image description here

I am wondering how to solve this problem. Any help is much appreciated.

Attachments:
POSTED BY: Kat Z

I think the problem of your function is the E^(\[Pi]^2/x) part of the formula. Along with the other functions, some functions go to infinity around 0, some go to zero around 0. This `battle' makes it complicated. You can also try using more digits, and start integrating from not exactly 0 but slightly away from zero:

Table[{10.0^-d,NIntegrate[f[x],{x,10^-d,100},WorkingPrecision->40]},{d,0,8}]//Grid

it looks like it does converge... (at least numerically)

enter image description here

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract