Ejemplo n.º 1
0
 def test_chebtrim(self) :
     coef = [2, -1, 1, 0]
     # Test exceptions
     assert_raises(ValueError, ch.chebtrim, coef, -1)
     # Test results
     assert_equal(ch.chebtrim(coef), coef[:-1])
     assert_equal(ch.chebtrim(coef, 1), coef[:-3])
     assert_equal(ch.chebtrim(coef, 2), [0])
Ejemplo n.º 2
0
 def test_chebtrim(self):
     coef = [2, -1, 1, 0]
     # Test exceptions
     assert_raises(ValueError, ch.chebtrim, coef, -1)
     # Test results
     assert_equal(ch.chebtrim(coef), coef[:-1])
     assert_equal(ch.chebtrim(coef, 1), coef[:-3])
     assert_equal(ch.chebtrim(coef, 2), [0])
Ejemplo n.º 3
0
def trim(x) :
    return cheb.chebtrim(x, tol=1e-6)
Ejemplo n.º 4
0
def trim(x):
    return cheb.chebtrim(x, tol=1e-6)
Ejemplo n.º 5
0
    def _trim_arr(self,arr,rtol=None):
        """ trim an array by rtol """
        if rtol is None:
            rtol = self.rtol

        return cheb.chebtrim(arr,max(abs(arr))*rtol)