Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004
log = SymbolicLogic() # In this example, we will learn how one can the draw the truth table of p and (conjunction) q. s = log.statement("p&q") # You may want to see help pages of the command SymbolicLogic (for more examples). t = log.truthtable(s) log.print_table(t)
p | q | value | ------------------------ False | False | False | False | True | False | True | False | False | True | True | True |
log = SymbolicLogic() # In this example, we will learn how one can the draw the truth table of p or (disjunction) q. s = log.statement("p|q") t = log.truthtable(s) log.print_table(t)
p | q | value | ------------------------ False | False | False | False | True | True | True | False | True | True | True | True |
log = SymbolicLogic() # In this example, we will learn how one can the draw the truth table of p implies q. s = log.statement("p->q") t = log.truthtable(s) log.print_table(t)
p | q | value | ------------------------ False | False | True | False | True | True | True | False | False | True | True | True |
log = SymbolicLogic() # In this example, we will learn how one can the draw the truth table of p if and only if q. s = log.statement("p<->q") t = log.truthtable(s) log.print_table(t)
p | q | value | ------------------------ False | False | True | False | True | False | True | False | False | True | True | True |
log = SymbolicLogic() # In this example, we will learn how one can the draw the truth table of (not p) implies q. s = log.statement("(!p->q)") t = log.truthtable(s) log.print_table(t)
p | q | value | ------------------------ False | False | False | False | True | True | True | False | True | True | True | True |
log = SymbolicLogic()# In this example, the truth table of the expression (p and q) or not(r or p). s = log.statement("p&q|!(r|p)") t = log.truthtable(s) log.print_table(t)
p | q | r | value | -------------------------------- False | False | False | True | False | False | True | False | False | True | False | True | False | True | True | False | True | False | False | False | True | False | True | False | True | True | False | True | True | True | True | True |