#NEWLINE# def test_bernoulli( ) : #NEWLINE# #INDENT# assert ( bernoulli ( 0 ) == 1 ) #NEWLINE# assert ( bernoulli ( 1 ) == Rational ( ( - 1 ) , 2 ) ) #NEWLINE# assert ( bernoulli ( 2 ) == Rational ( 1 , 6 ) ) #NEWLINE# assert ( bernoulli ( 3 ) == 0 ) #NEWLINE# assert ( bernoulli ( 4 ) == Rational ( ( - 1 ) , 30 ) ) #NEWLINE# assert ( bernoulli ( 5 ) == 0 ) #NEWLINE# assert ( bernoulli ( 6 ) == Rational ( 1 , 42 ) ) #NEWLINE# assert ( bernoulli ( 7 ) == 0 ) #NEWLINE# assert ( bernoulli ( 8 ) == Rational ( ( - 1 ) , 30 ) ) #NEWLINE# assert ( bernoulli ( 10 ) == Rational ( 5 , 66 ) ) #NEWLINE# assert ( bernoulli ( 1000001 ) == 0 ) #NEWLINE# assert ( bernoulli ( 0 , x ) == 1 ) #NEWLINE# assert ( bernoulli ( 1 , x ) == ( x - Rational ( 1 , 2 ) ) ) #NEWLINE# assert ( bernoulli ( 2 , x ) == ( ( ( x ** 2 ) - x ) + Rational ( 1 , 6 ) ) ) #NEWLINE# assert ( bernoulli ( 3 , x ) == ( ( ( x ** 3 ) - ( ( 3 * ( x ** 2 ) ) / 2 ) ) + ( x / 2 ) ) ) #NEWLINE# b = bernoulli ( 1000 ) #NEWLINE# assert ( ( b . p % ( 10 ** 10 ) ) == 7950421099 ) #NEWLINE# assert ( b . q == 342999030 ) #NEWLINE# b = bernoulli ( ( 10 ** 6 ) , evaluate = False ) . evalf ( ) #NEWLINE# assert ( str ( n ) == '-2.23799235765713e+4767529' ) #NEWLINE# l = Symbol ( 'l' , integer = True ) #NEWLINE# m = Symbol ( 'm' , integer = True , nonnegative = True ) #NEWLINE# n = Symbol ( 'n' , integer = True , positive = True ) #NEWLINE# assert isinstance ( bernoulli ( ( ( 2 * l ) + 1 ) ) , bernoulli ) #NEWLINE# assert isinstance ( bernoulli ( ( ( 2 * m ) + 1 ) ) , bernoulli ) #NEWLINE# assert ( bernoulli ( ( ( 2 * n ) + 1 ) ) == 0 )