# Asymptotic Developments¶

[1]:

from math import log, pi
import poisson_approval as pa


Asymptotic developments are mostly used internally by Poisson Approval in order to compute pivot events and best responses. However, they can also be used directly.

Define an asymptotic developement (manually):

[2]:

asymptotic = pa.Asymptotic(mu=-1 / 9, nu=-1 / 2, xi=-1 / 2 * log(8 * pi / 9))
asymptotic

[2]:

exp(- 0.111111 n - 0.5 log n - 0.513473 + o(1))


Access its coefficients:

[3]:

asymptotic.mu

[3]:

-0.1111111111111111

[4]:

asymptotic.nu

[4]:

-0.5

[5]:

asymptotic.xi

[5]:

-0.5134734250965083


Multiply or add two asymptotic developments:

[6]:

asymptotic2 = pa.Asymptotic(mu=-1 / 2, nu=-1, xi=-1)
asymptotic2

[6]:

exp(- 0.5 n - log n - 1 + o(1))

[7]:

asymptotic * asymptotic2

[7]:

exp(- 0.611111 n - 1.5 log n - 1.51347 + o(1))

[8]:

asymptotic + asymptotic2

[8]:

exp(- 0.111111 n - 0.5 log n - 0.513473 + o(1))


We now consider two random variables $$X_1 \sim \text{Poisson}(\tau_1 n)$$ and $$X_2 \sim \text{Poisson}(\tau_2 n)$$.

[9]:

tau_1, tau_2 = 1 / 9, 8 / 9
print('P(X_1 = 0) = ', pa.Asymptotic.poisson_value(tau_1, 0))
print('P(X_1 = X_2)  =', pa.Asymptotic.poisson_eq(tau_1, tau_2))
print('P(X_1 = X_2 + 1)  =', pa.Asymptotic.poisson_one_more(tau_1, tau_2))
print('P(X_1 >= X_2) =', pa.Asymptotic.poisson_ge(tau_1, tau_2))
print('P(X_1 > X_2)  =', pa.Asymptotic.poisson_gt(tau_1, tau_2))
print('P(X_1 > X_2 + 1)  =', pa.Asymptotic.poisson_gt_one_more(tau_1, tau_2))

P(X_1 = 0) =  exp(- 0.111111 n + o(1))
P(X_1 = X_2)  = exp(- 0.371461 n - 0.5 log n - 0.68676 + o(1))
P(X_1 = X_2 + 1)  = exp(- 0.371461 n - 0.5 log n - 1.72648 + o(1))
P(X_1 >= X_2) = exp(- 0.371461 n - 0.5 log n - 0.250496 + o(1))
P(X_1 > X_2)  = exp(- 0.371461 n - 0.5 log n - 1.29022 + o(1))
P(X_1 > X_2 + 1)  = exp(- 0.371461 n - 0.5 log n - 2.32994 + o(1))


Like profiles and tau-vectors, asymptotic developments accept the parameter symbolic=True:

[10]:

from fractions import Fraction
tau_1 = Fraction(1, 9)
tau_2 = Fraction(8, 9)
print('P(X_1 = 0) = ', pa.Asymptotic.poisson_value(tau_1, 0, symbolic=True))
print('P(X_1 = X_2)  =', pa.Asymptotic.poisson_eq(tau_1, tau_2, symbolic=True))
print('P(X_1 = X_2 + 1)  =', pa.Asymptotic.poisson_one_more(tau_1, tau_2, symbolic=True))
print('P(X_1 >= X_2) =', pa.Asymptotic.poisson_ge(tau_1, tau_2, symbolic=True))
print('P(X_1 > X_2)  =', pa.Asymptotic.poisson_gt(tau_1, tau_2, symbolic=True))
print('P(X_1 > X_2 + 1)  =', pa.Asymptotic.poisson_gt_one_more(tau_1, tau_2, symbolic=True))

P(X_1 = 0) =  exp(- n/9 + o(1))
P(X_1 = X_2)  = exp(n*(-1 + 4*sqrt(2)/9) - log(n)/2 - 7*log(2)/4 - log(pi)/2 + log(3) + o(1))
P(X_1 = X_2 + 1)  = exp(n*(-1 + 4*sqrt(2)/9) - log(n)/2 - 13*log(2)/4 - log(pi)/2 + log(3) + o(1))
P(X_1 >= X_2) = exp(n*(-1 + 4*sqrt(2)/9) - log(n)/2 + log(3*2**(1/4)/(4*sqrt(pi)*(1 - sqrt(2)/4))) + o(1))
P(X_1 > X_2)  = exp(n*(-1 + 4*sqrt(2)/9) - log(n)/2 + log(3*2**(3/4)/(16*sqrt(pi)*(1 - sqrt(2)/4))) + o(1))
P(X_1 > X_2 + 1)  = exp(n*(-1 + 4*sqrt(2)/9) - log(n)/2 + log(3*2**(1/4)/(32*sqrt(pi)*(1 - sqrt(2)/4))) + o(1))