ENGR 101 Lecture Notes - Lecture 3: Logical Connective, Exclusive Or, Logical Matrix
Document Summary
It checks the current value of x and sees if it less than 5. The result is called a truth value, it is either false (0) or true (1) Logical operator can combine two truth values according to the rules of formal logic o. If both are true, the whole is true. Don"t write 1 < x < 5 o o. Write 1 < x & x < 5. The result of a relational or logical operator is a logical array o o. 1s and 0s in a logical array are completely different type of data than regular numbers. When we put a [regular array] between the () in an indexing expression, we select those indices. == are for logical operators, while = aren"t. If you want to hardcore a logical matrix, you need to wrap it up in the logical function o. Any = any nonzero number in a matrix, vector, scalar .