Exemple #1
0
 def testPell(self):
     assert series.pell(0) == NULL
     assert series.pell(1) == ONE
     assert series.pell(2) == 2*x
     assert series.pell(3) == 4*x**2 + 1
     assert series.pell(4) == 8*x**3 + 4*x
     assert series.pell(5) == 16*x**4 + 12*x**2 + 1
Exemple #2
0
 def testLucasSequence(self):
     l = series.LucasSeq(x, ONE)
     l1 = series.LucasSeq(x, ONE, 'w')
     l2 = series.LucasSeq(2*x, ONE)
     l3 = series.LucasSeq(2*x, ONE, 'w')
     l4 = series.LucasSeq(ONE, 2*x)
     l5 = series.LucasSeq(ONE, 2*x, 'w')
     l6 = series.LucasSeq(3*x, -TWO)
     l7 = series.LucasSeq(3*x, -TWO, 'w')
     for n in xrange(10):
         if n > 0:
             l(n) == series.fibonacci(n)
         assert l1(n) == series.lucas(n)
         assert l2(n) == series.pell(n)
         assert l3(n) == series.pell_lucas(n)
         assert l4(n) == series.jacobsthal(n)
         assert l5(n) == series.jacob_lucas(n)
         assert l6(n) == series.fermat(n)
         assert l7(n) == series.fermat_lucas(n)