积分的大小与其误差相同

问题描述

我正在使用积分,但结果表明它的大小与其误差相同。

我的代码

import numpy as np
from scipy.misc import derivative
from scipy import integrate


alpha=1/137
m_muon=105.65
m_pi=139.57
m_rho=770
gamma_rho=111


def K(t):
    beta_mu=(1-(4*m_muon**2/t))**(1/2)
    x=(1-beta_mu)/(1+beta_mu)
    return (alpha/np.pi)*(1/2*x**2*(2-x**2)+ (1+x)**2*(1+x**2)*(np.log(1+x)-x+1/2*x**2)/x**2 +(1+x)/(1-x)*x**2*np.log(x))

def F_pi(s,m_rho,gamma_rho):

    def gamma(s,gamma_rho):
        return gamma_rho*s/m_rho**2*(beta_pi(s)/beta_pi(m_rho**2))**3
    def beta_pi(s):
        return (1-4*m_pi**2/s)**(1/2)
    def d(m):
        return 3/np.pi*m_pi**2/k(m**2)**2 * np.log((m+2*k(m**2))/(2*m_pi)) + m/(2*np.pi*k(m**2)) - m_pi**2*m/(np.pi*k(m**2)**3)        
    def f(s,gamma_rho):
        return gamma_rho*m_rho**2/k(m_rho**2)**3 * (k(s)**2*(h(s)-h(m_rho**2)) + (m_rho**2-s)*k(m_rho**2)**2*h_rho_prime)
    def k(s):
        return 1/2*s**(1/2)*beta_pi(s)
    def h(s):
        return 2/np.pi*k(s)/s**(1/2)*np.log((s**(1/2)+2*k(s))/(2*m_pi))  

    h_rho_prime=derivative(h,m_rho**2,dx=1e-6)
    Omnes=m_rho**2*( 1 +d(m_rho)*gamma_rho/m_rho)/(m_rho**2-s+f(s,gamma_rho)-1j*m_rho*gamma(s,gamma_rho))
    return Omnes


 
def integrand(t):
    return alpha/(12*np.pi)/t*(1-(4*m_pi**2)/t)**(3/2)*abs(F_pi(t,gamma_rho))**2*K(t)

print(integrate.quad(integrand,4*m_pi**2,np.inf,epsabs=10e-17))

我的结果是:

(4.1075618414496956e-08,6.510466358089066e-08)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\integrate\quadpack.py:364: IntegrationWarning: The algorithm does not converge.  Roundoff error is detected
  in the extrapolation table.  It is assumed that the requested tolerance
  cannot be achieved,and that the returned result (if full_output = 1) is 
  the best which can be obtained.
  warnings.warn(msg,IntegrationWarning)

如果我在Integrated.quad中删除'epsabs = 10e-17',结果将是:

(1.355525687156401e-13,2.664712080927775e-13)

它们仍然具有相同的大小,并且存在很大的偏差。

任何帮助将不胜感激!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)