feat: poisson CD (> and <)

This commit is contained in:
Muhammad Nauman Raza 2025-01-27 14:19:12 +00:00
parent 02b9894112
commit e5ed1a444c
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -1,11 +1,21 @@
import math import math
a = list(map(float, input().split(' '))) a, b = input().split(' ')
rate = a[0]
rate = float(a)
i = b[0]
b = int(b[1:])
sums = 0 sums = 0
for i in range(1,len(a)): if i == ">":
sums += round(math.e**(-1*rate) * (rate**a[i]/math.factorial(int(a[i]))), 4) for j in range(b+1):
sums += math.e**(-1*rate) * (rate**j/math.factorial(j))
print(round(1-sums, 4))
elif i == "<":
for j in range(b):
sums += math.e**(-1*rate) * (rate**j/math.factorial(j))
print(round(sums, 4))
elif i == "=":
print(round(math.e**(-1*rate) * (rate**b/math.factorial(b)), 4))
print(sums)