Post Reply 
Easy question
09-06-2021, 10:31 PM
Post: #9
RE: Easy question
(09-06-2021 12:41 PM)ijabbott Wrote:  
The Xcas documentation doesn’t seem to describe the precedence of operators in the Giac/Xcas language, but all the boolean operators are described in the same section, so I guess ‘and’, ‘or’, and ‘xor’ are evaluated at the same precedence in left-to-right order.

Seems like a reasonable guess! When I just mentioned the “T ∨ F ∧ F“ to my daughter, she suggested another possibility: perhaps OR is higher precedence than AND in the CAS.

So, as an experiment, I tried flipping the expression around and tried “False AND False OR True” in CAS view. “True” is the result. Not a bad illustration of some of the benefits of precedence rules — that, with associative and commutative operations like AND and OR, one may rearrange arguments to the higher precedence operation or to the lower precedence operation (without changing the final result).

Since I mentioned trying the evaluation in Python, I thought I’d also try it using Python syntax in the CAS. There, “True or False and False” evaluates to “False”.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Easy question - boggiano - 09-01-2021, 10:10 AM
RE: Easy question - roadrunner - 09-01-2021, 11:54 AM
RE: Easy question - rawi - 09-01-2021, 04:02 PM
RE: Easy question - toml_12953 - 09-01-2021, 04:11 PM
RE: Easy question - jte - 09-06-2021, 12:36 AM
RE: Easy question - Albert Chan - 09-06-2021, 01:17 AM
RE: Easy question - ijabbott - 09-06-2021, 12:41 PM
RE: Easy question - jte - 09-06-2021 10:31 PM
RE: Easy question - Albert Chan - 09-07-2021, 01:09 AM
RE: Easy question - jte - 09-09-2021, 05:55 PM
RE: Easy question - jte - 09-06-2021, 05:39 PM
RE: Easy question - boggiano - 09-09-2021, 10:44 AM
RE: Easy question - Joe Horn - 09-09-2021, 05:40 PM
RE: Easy question - boggiano - 09-09-2021, 06:05 PM
RE: Easy question - toml_12953 - 09-09-2021, 10:10 PM
RE: Easy question - boggiano - 09-09-2021, 10:32 PM
RE: Easy question - ijabbott - 09-09-2021, 11:59 PM
RE: Easy question - Albert Chan - 09-10-2021, 05:23 PM
RE: Easy question - ijabbott - 09-10-2021, 06:09 PM
RE: Easy question - boggiano - 09-11-2021, 12:16 AM
RE: Easy question - toml_12953 - 09-11-2021, 11:14 AM



User(s) browsing this thread: 1 Guest(s)