Esempio n. 1
0
 def test_simplify(self):
     interval = Interval(-2, 1)
     ff = Bndfun.initfun_fixedlen(self.f, interval, 1000)
     gg = ff.simplify()
     self.assertEqual(gg.size, standard_chop(ff.onefun.coeffs))
     self.assertEqual(infnorm(ff.coeffs[:gg.size] - gg.coeffs), 0)
     self.assertEqual(ff.interval, gg.interval)
Esempio n. 2
0
 def test_simplify(self):
     interval = Interval(-2,1)
     ff = Bndfun.initfun_fixedlen(self.f, interval, 1000)
     gg = ff.simplify()
     self.assertEqual(gg.size, standard_chop(ff.onefun.coeffs))
     self.assertEqual(infnorm(ff.coeffs[:gg.size]-gg.coeffs), 0)
     self.assertEqual(ff.interval, gg.interval)
Esempio n. 3
0
 def test_simplify(self):
     gg = self.ff.simplify()
     # check that simplify is calling standard_chop underneath
     self.assertEqual(gg.size, standard_chop(self.ff.coeffs))
     self.assertEqual(infnorm(self.ff.coeffs[:gg.size] - gg.coeffs), 0)
     # check we are returned a copy of self's coeffcients by changing
     # one entry of gg
     fcfs = self.ff.coeffs
     gcfs = gg.coeffs
     self.assertEqual((fcfs[:gg.size] - gcfs).sum(), 0)
     gg.coeffs[0] = 1
     self.assertNotEqual((fcfs[:gg.size] - gcfs).sum(), 0)
Esempio n. 4
0
 def test_simplify(self):
     gg = self.ff.simplify()
     # check that simplify is calling standard_chop underneath
     self.assertEqual(gg.size, standard_chop(self.ff.coeffs))
     self.assertEqual(infnorm(self.ff.coeffs[:gg.size]-gg.coeffs), 0)
     # check we are returned a copy of self's coeffcients by changing
     # one entry of gg
     fcfs = self.ff.coeffs
     gcfs = gg.coeffs
     self.assertEqual((fcfs[:gg.size]-gcfs).sum(),0)
     gg.coeffs[0] = 1
     self.assertNotEqual((fcfs[:gg.size]-gcfs).sum(),0)
Esempio n. 5
0
 def simplify(self):
     '''Call standard_chop on the coefficients of self, returning a
     Chebtech comprised of a copy of the truncated coefficients.'''
     # coefficients
     oldlen = len(self.coeffs)
     longself = self.prolong(max(17, oldlen))
     cfs = longself.coeffs
     # scale (decrease) tolerance by hscale
     tol = prefs.eps * max(self.interval.hscale, 1)
     # chop
     npts = standard_chop(cfs, tol=tol)
     npts = min(oldlen, npts)
     # construct
     return self.__class__(cfs[:npts].copy(), interval=self.interval)
Esempio n. 6
0
 def simplify(self):
     '''Call standard_chop on the coefficients of self, returning a
     Chebtech comprised of a copy of the truncated coefficients.'''
     cfs = self.coeffs
     npts = standard_chop(cfs)
     return self.__class__(cfs[:npts].copy())
Esempio n. 7
0
 def simplify(self):
     '''Call standard_chop on the coefficients of self, returning a
     Chebtech comprised of a copy of the truncated coefficients.'''
     cfs = self.coeffs
     npts = standard_chop(cfs)
     return self.__class__(cfs[:npts].copy())