我试图求解以下具有未知数theta1、theta2、theta3的积分方程组:
其中Phi和Phi分别是使用scipy的fsolve和积分得到的标准正态分布的cdf和pdf。这是我的代码:
import numpy as np
import math
import scipy.integrate as integrate
from scipy import integrate
from scipy.stats import norm
from scipy.optimize import fsolve
def function(xi, thetai, thetaj, thetak):
return (1 - norm.cdf(xi - thetaj)) * (1 - norm.cdf(xi - thetak)) * norm.pdf(xi - thetai)
def pi_i(thetai, thetaj, thetak):
return integrate.quad(function, -np.inf, np.inf)[0]
def equations(p):
t1, t2, t3 = p
return (pi_i(t1,t2,t3) - 0.5, pi_i(t2,t1,t3) - 0.3, pi_i(t3,t1,t2) - 0.2)
t1, t2, t3 = fsolve(equations, (1, 1, 1))
print(equations((t1, t2, t3)))
但是,当我运行代码时,会弹出以下错误:
TypeError: function() missing 3 required positional arguments: 'thetai', 'thetaj', and 'thetak'