예제 #1
0
 def testFermatLucas(self):
     assert series.fermat_lucas(0) == TWO
     assert series.fermat_lucas(1) == 3*x
     assert series.fermat_lucas(2) == 9*x**2 - 4
     assert series.fermat_lucas(3) == 27*x**3 - 18*x
     assert series.fermat_lucas(4) == 81*x**4 - 72*x**2 + 8
     assert series.fermat_lucas(5) == 243*x**5 - 270*x**3 + 60*x
예제 #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)