Ejemplo n.º 1
0
 def _ttr(self, k_data, size, prob):
     """Krawtchouk rule"""
     from chaospy.quadrature import discretized_stieltjes
     abscissas = numpy.arange(0, numpy.floor(size)+1)
     weights = self._pdf(abscissas, size, prob)
     (alpha, beta), _, _ = discretized_stieltjes(k_data, [abscissas], weights)
     return alpha[0, -1], beta[0, -1]
Ejemplo n.º 2
0
 def _ttr(self, k_data, lower, upper):
     """Three terms recurrence coefficients."""
     from chaospy.quadrature import discretized_stieltjes
     abscissas = numpy.arange(numpy.ceil(lower), numpy.floor(upper)+1)
     weights = numpy.repeat(1./len(abscissas), len(abscissas))
     (alpha, beta), _, _ = discretized_stieltjes(k_data, [abscissas], weights)
     return alpha[0, -1], beta[0, -1]