def test_commutative():
 assert (ask(Q.commutative(x)) is True)
 assert (ask(Q.commutative(x), (~ Q.commutative(x))) is False)
 assert (ask(Q.commutative(x), Q.complex(x)) is True)
 assert (ask(Q.commutative(x), Q.imaginary(x)) is True)
 assert (ask(Q.commutative(x), Q.real(x)) is True)
 assert (ask(Q.commutative(x), Q.positive(x)) is True)
 assert (ask(Q.commutative(x), (~ Q.commutative(y))) is True)
 assert (ask(Q.commutative((2 * x))) is True)
 assert (ask(Q.commutative((2 * x)), (~ Q.commutative(x))) is False)
 assert (ask(Q.commutative((x + 1))) is True)
 assert (ask(Q.commutative((x + 1)), (~ Q.commutative(x))) is False)
 assert (ask(Q.commutative((x ** 2))) is True)
 assert (ask(Q.commutative((x ** 2)), (~ Q.commutative(x))) is False)
 assert (ask(Q.commutative(log(x))) is True)

def test_commutative ( ) : assert ( ask ( Q . commutative ( x ) ) is True ) assert ( ask ( Q . commutative ( x ) , ( ~ Q . commutative ( x ) ) ) is False ) assert ( ask ( Q . commutative ( x ) , Q . complex ( x ) ) is True ) assert ( ask ( Q . commutative ( x ) , Q . imaginary ( x ) ) is True ) assert ( ask ( Q . commutative ( x ) , Q . real ( x ) ) is True ) assert ( ask ( Q . commutative ( x ) , Q . positive ( x ) ) is True ) assert ( ask ( Q . commutative ( x ) , ( ~ Q . commutative ( y ) ) ) is True ) assert ( ask ( Q . commutative ( ( 2 * x ) ) ) is True ) assert ( ask ( Q . commutative ( ( 2 * x ) ) , ( ~ Q . commutative ( x ) ) ) is False ) assert ( ask ( Q . commutative ( ( x + 1 ) ) ) is True ) assert ( ask ( Q . commutative ( ( x + 1 ) ) , ( ~ Q . commutative ( x ) ) ) is False ) assert ( ask ( Q . commutative ( ( x ** 2 ) ) ) is True ) assert ( ask ( Q . commutative ( ( x ** 2 ) ) , ( ~ Q . commutative ( x ) ) ) is False ) assert ( ask ( Q . commutative ( log ( x ) ) ) is True )
test for commutativity of and and or .