feat: poisson CD (>
and <
)
This commit is contained in:
parent
02b9894112
commit
e5ed1a444c
1 changed files with 15 additions and 5 deletions
|
@ -1,11 +1,21 @@
|
|||
import math
|
||||
|
||||
a = list(map(float, input().split(' ')))
|
||||
rate = a[0]
|
||||
a, b = input().split(' ')
|
||||
|
||||
rate = float(a)
|
||||
i = b[0]
|
||||
b = int(b[1:])
|
||||
|
||||
sums = 0
|
||||
|
||||
for i in range(1,len(a)):
|
||||
sums += round(math.e**(-1*rate) * (rate**a[i]/math.factorial(int(a[i]))), 4)
|
||||
if i == ">":
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue