示例#1
0
 def testRoots(self):
     print 'Roots testing'
     rts = np.roots([1, 0, -1])
     self.checkitems([-1, 1], rts.real)
     self.checkitems([0, 0], rts.imag)
     rts = np.roots([1, 2, 1])
     self.checkitems([-1, -1], rts.real)
     self.checkitems([0, 0], rts.imag)
     rts = np.roots([1, 0, 1])
     self.checkitems([0, 0], rts.real)
     self.checkitems([1, -1], rts.imag)
     rts = np.roots([3.2, 2, 1])
     self.checkitems([-0.3125, -0.3125], rts.real)
     self.checkitems([0.46351240544347894, -0.46351240544347894], rts.imag)
 def testRoots(self):
     print 'Roots testing'
     rts = np.roots([1, 0, -1])
     self.checkitems([-1, 1], rts.real)
     self.checkitems([0, 0], rts.imag)
     rts = np.roots([1, 2, 1])
     self.checkitems([-1, -1], rts.real)
     self.checkitems([0, 0], rts.imag)
     rts = np.roots([1, 0, 1])
     self.checkitems([0, 0], rts.real)
     self.checkitems([1, -1], rts.imag)
     rts = np.roots([3.2, 2, 1])
     self.checkitems([-0.3125, -0.3125], rts.real)
     self.checkitems([0.46351240544347894, -0.46351240544347894], rts.imag)