Home:ALL Converter>The type of returned objects of simplify_logic

The type of returned objects of simplify_logic

Ask Time:2022-09-09T13:35:02         Author:ryoryon66

Json Formatter

According to the document, simplify_logic returns Or or And Object. Am I using it incorrectly?(Are there any restrictions on arguments?)



import sympy
from sympy import S
from sympy.logic.boolalg import Equivalent,simplify_logic
from sympy.abc import a,b,c

test = simplify_logic(Equivalent(a >> (~a | a) , S.true))

tor = type(a | b)
tand= type(a &b)

print(test)

print()

print(tor)
print(tand)

print()

print(isinstance(test,tor)) # expected: True
isinstance(test,tand) # expected: True

print()

print(type(simplify_logic(a)))

The following is the output of the code.

True

Or
And

False
False

<class 'sympy.core.symbol.Symbol'>

Author:ryoryon66,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73657702/the-type-of-returned-objects-of-simplify-logic
yy