scipy 与sipy双重集成

gmxoilav  于 2022-11-10  发布在  其他
关注(0)|答案(1)|浏览(142)

我想问一下如何用python计算这个积分
enter image description here

from scipy import integrate
    Hight_above_ground = 2.5 
    surface_ground = 81 
    surface_collector = 65 
    f = (np.cos(tilt)*np.cos(tilt)) / (PI * s**2 )
   (1/surface_ground) * integrate.dblquad(f, 0, surface_ground, 0, surface_collector)

注意:A1和A2是2个曲面区域A1是曲面接地,A2是曲面收集器
这是给定的误差

Traceback (most recent call last):
  File "Bifacial_systems.py", line 34, in <module>
    (1/surface_ground)*integrate.dblquad(f, 0, surface_ground, 0, surface_collector)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 602, in dblquad
    opts={"epsabs": epsabs, "epsrel": epsrel})
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 826, in nquad
    return _NQuad(func, ranges, opts, full_output).integrate(*args)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 881, in integrate
  **opt)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 352, in quad
    points)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 463, in _quad
    return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 881, in integrate
  **opt)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 352, in quad
    points)
  File "C:\Users\S1-DEV-Manel\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\integrate\quadpack.py", line 463, in _quad
    return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
ValueError: invalid callable given
5hcedyr0

5hcedyr01#

你必须重写你的被积函数,使dA1dA2的表达式用theta1theta2d theta1d theta2来表示。假设dA1 dA2 = d theta1 d theta2的解为

from scipy.integrate import dblquad

def integrand(theta1, theta2, S):
    return np.cos(theta1)*np.cos(theta2)/S**2
S = 1

dblquad(integrand, 0, np.pi/2, 0, lambda x: np.pi/2-x, args=(S,))

如果最终得到的是高阶积分,可以使用nquad

相关问题