Example #1
0
 def test_hermroots(self):
     assert_almost_equal(herm.hermroots([1]), [])
     assert_almost_equal(herm.hermroots([1, 1]), [-.5])
     for i in range(2, 5):
         tgt = np.linspace(-1, 1, i)
         res = herm.hermroots(herm.hermfromroots(tgt))
         assert_almost_equal(trim(res), trim(tgt))
Example #2
0
 def test_hermroots(self) :
     assert_almost_equal(herm.hermroots([1]), [])
     assert_almost_equal(herm.hermroots([1, 1]), [-.5])
     for i in range(2,5) :
         tgt = np.linspace(-1, 1, i)
         res = herm.hermroots(herm.hermfromroots(tgt))
         assert_almost_equal(trim(res), trim(tgt))
Example #3
0
def root_of_n_hermite(n):
    shape = []
    if n == 0:
        shape = [1]
    else:
        for i in range(n):
            shape.append(0)
        shape.append(1)
    if n!=0:
        return hermroots(shape)
    else:
        return "no roots"
Example #4
0
 def roots(self, coef):
     if self.dim > 1:
         raise NotImplementedError
     r = hermroots(coef)
     return r * self._std[0] * np.sqrt(2) + self._mean[0]