1 | initial version |
To use mpmath, you have to fix the parameters z, w :
from mpmath import *
mp.dps=100; mp.prett=True
z=1.0
w=2.0
f = lambda y:((e^(-(1+w-z)*y)-e^(-z*y))/((1-e^(-y))*(1-e^(-w*y))) -1/y*(2*z/w-1/w-1) )/y
ii=mp.quad(f,[0.0,mp.inf])
print(ii)
0.6868438210465139334339462432252338314613985881041879632836891912354724713670427615704250909648475892
To investigate more parameters you can use loops:
from mpmath import *
mp.dps=100; mp.prett=True
for w in [1,1.5,2]:
for z in [2.,1.5,1.]:
f = lambda y:((e^(-(1+w-z)*y)-e^(-z*y))/((1-e^(-y))*(1-e^(-w*y))) -1/y*(2*z/w-1/w-1) )/y
ii=mp.quad(f,[0.0,mp.inf])
print("%0.2f"%w,'\t',"%0.2f"%z,'\t',N(ii))
1.00 2.00 238.130061186454
1.00 1.50 -0.403748148636294
1.00 1.00 0.000000000000000
1.50 2.00 -1.32360608384651
1.50 1.50 -5.27628283903327e88
1.50 1.00 1.31907070975832e88
2.00 2.00 -0.686843821046514
2.00 1.50 0.000000000000000
2.00 1.00 0.686843821046514