Untitled
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)
Leave a Comment