Untitled
unknown
python
9 months ago
305 B
20
Indexable
R.<x> = QQ[]
def defInt(F, a, b):
FInt = F.integral()
return FInt.subs(x=b) - FInt.subs(x=a)
eVal = 2.0 #=P(0)+P(1)
F = x
for j in range(2, 150):
F = x*F.subs(x=1/2) - defInt(F, 0, x) + 2*defInt(F, 0, x/2) + 2*defInt(F, (1-x)/2, 1/2)
eVal += float(2*F(1/2))
print (eVal)Editor is loading...
Leave a Comment