def all_rates(C, n, wx, wy, wz): px, py, pz = np.diag(C) rates = {} for z in range(wz+1): for y in range(2-z): for x in range(4-y-z): errstring = "x" * x + "y" * y + "z" * z rates[errstring] = bn(n, x+y+z) \ * (px ** x) * (py ** y) * (pz ** z) \ * ((1 - px - py - pz) ** (n - x - y - z)) rates["fail"] = 1 - np.sum(rates.values()) return rates
def basis(self,v): return bn(self.n,v)*self.t**v*(1-self.t)**(self.n-v)
def basis(self, t, v): n = 3 # spline order return bn(n, v) * t**v * (1 - t)**(n - v)
def basis(self, v): return bn(self.n, v) * self.t**v * (1 - self.t)**(self.n - v)
from scipy.special import binom as bn from math import factorial as f import numpy as np sum = 0 for k in range(4, 11): sum += bn(10, k) * f(4 + k) * f(15 - (4 + k) - 1) / f(15) print(sum) print((1 - 5 * sum) / 10)
def mixed_conditional(j, n=100, m=5): return (2 * m - 1) / (n + 2 * m - 1) * bn(n, j) * bn( 2 * m - 2, m - 1) / bn(n + 2 * m - 2, j + m - 1)