In [9]:
import numpy as np
import scipy.integrate as intg

In [29]:
### 2 ###
a = 1
pi = np.pi
sqrt_pi = np.sqrt(pi)
const = 1 / (a * sqrt_pi)
const2 = -2 * a ** 2
def erf_int(x):
    return const * np.exp((x ** 2)/const2)


res = intg.quad(erf_int, -a, a)
prob = 1 - res[0]
err = res[1]
print("Probabilidade: %.2f(%f)" % (prob, err))


Probabilidade: 0.03(0.000000)

In [ ]: