Why does integrate.quad(lambda x: x*exp(-x**2/2)/sqrt(2*pi), 0.0, 100000) give 0?

前端 未结 1 453
刺人心
刺人心 2020-12-22 06:03

This function is positive from 0 to inf, why give larger than 1000 will yield to 0, not reasonable.

import scipy.integrate as integrate
from math import *

         


        
相关标签:
1条回答
  • 2020-12-22 06:32

    For x larger than approx. 39, exp(-x**2/2) gives 0.0. When the upper limit of integration is 100000, the fraction of the interval of integration where the function is nonzero is so small that the quad algorithm never sees it. As far as quad is concerned, the function is identically 0.

    0 讨论(0)
提交回复
热议问题