Difference between revisions of "TI-BASIC:Operators"
(Initial automated import) |
(Automated internal link correction) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Just like other programming languages, TI-Basic has the standard set of core operators built-in (math, relational, and logical), although they each have their own syntax and rules. | Just like other programming languages, TI-Basic has the standard set of core operators built-in (math, relational, and logical), although they each have their own syntax and rules. | ||
− | + | __TOC__ | |
= Math Operators <span id=" math"></span> = | = Math Operators <span id=" math"></span> = | ||
Line 62: | Line 62: | ||
| 1 || Functions that precede their argument (such as [[TI-BASIC:Square_Root|√(]] or [[TI-BASIC:Sin|Sin(]]), except for negation | | 1 || Functions that precede their argument (such as [[TI-BASIC:Square_Root|√(]] or [[TI-BASIC:Sin|Sin(]]), except for negation | ||
|- | |- | ||
− | | 2 || Functions that follow their argument (such as | + | | 2 || Functions that follow their argument (such as <sup>[[TI-BASIC:2|2]]</sup> or [[TI-BASIC:Factorial|!]]) |
|- | |- | ||
| 3 || [[TI-BASIC:Power|^]] and [[TI-BASIC:Xroot|×√]] | | 3 || [[TI-BASIC:Power|^]] and [[TI-BASIC:Xroot|×√]] | ||
Line 80: | Line 80: | ||
| 9 || The logic operators [[TI-BASIC:Or|Or]] and [[TI-BASIC:Xor|Xor]] | | 9 || The logic operators [[TI-BASIC:Or|Or]] and [[TI-BASIC:Xor|Xor]] | ||
|- | |- | ||
− | | 10 || Conversions such as [[TI-BASIC: | + | | 10 || Conversions such as [[TI-BASIC:Frac|►Frac]] |
|} | |} | ||
− | TI refers to the routine that determines order of operations as the Equation Operating System (EOS | + | TI refers to the routine that determines order of operations as the Equation Operating System (EOS<sup>TM</sup>). Unfortunately, this cool name hasn't become common usage. |
== Test your knowledge == | == Test your knowledge == |
Latest revision as of 00:39, 25 February 2016
Just like other programming languages, TI-Basic has the standard set of core operators built-in (math, relational, and logical), although they each have their own syntax and rules.
Contents
Math Operators
There are five math operators: +, -, *, /, and ^. Anybody who has ever done even basic math should know and recognize at least the first four operators, but for those who don't, their meaning is pretty straightforward:
- + : Adds two numbers together
- - : Subtracts one number from another
- '* : Multiplies two numbers together
- / : Divides one number by another
- ^ : Raises a number to a power
There are two similar negative symbols on the TI-83 calculators -- the subtraction symbol (the - key) and the negation symbol (the (-) key). These aren't interchangeable. However, it's almost always clear from an expression which one is being used, so the - symbol will be used to represent both throughout most of this guide.
Relational Operators
There are six relational operators: =, ≠, >, ≥, <, and ≤. Just like with the math operators, these operators are used in almost every math class, and thus most people should know them.
- = : X=Y is true if X is equal to Y
- ≠ : X≠Y is true if X is not equal to Y
- > : X>Y is true if X is greater than Y
- ≥ : X≥Y is true if X is greater than or equal to Y
- < : X<Y is true if X is less than Y
- ≤ : X≤Y is true if X is less than or equal to Y
Because the calculator does not have a separate time for logical values (true and false), they are represented by the numbers 1 and 0. This becomes important when dealing with Piecewise_Expressions.
Logical Operators
There are four logical operators: And, Or, Not(, and Xor. Their interpretations are mostly intuitive when thinking about the meaning of the English word:
- and : X and Y is true if both X and Y are true
- or : X or Y is true if at least one of X and Y is true
- xor : X xor Y is true if only one of X and Y is true
- not( : not(X) is true if X is false
Again, as with the relational operators, 1 is used to for 'true', and 0 is used for 'false'. It so happens that the logical operators treat all nonzero values as though they were 1 (true), so the expression '2 and 3' will be true just as '1 and 1'.
Here is a truth table of the various values:
A | B | A and B | A or B | A xor B | not(A) |
---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 1 |
0 | 1 | 0 | 1 | 1 | 1 |
1 | 0 | 0 | 1 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | 0 |
Order of Operations
The TI-83 series of calculators has nine priority levels for evaluating expressions. All the functions on a priority level will be calculated from left to right before moving on to the next priority level. Of course, calculations within parentheses are done first. Here is a table of the priority levels:
Priority Level | Functions |
---|---|
1 | Functions that precede their argument (such as √( or Sin(), except for negation |
2 | Functions that follow their argument (such as 2 or !) |
3 | ^ and ×√ |
3.5 | Negation |
4 | NPr and NCr |
5 | Multiplication, division, and implied multiplication |
6 | Addition and subtraction |
7 | The relational operators =, ≠, <, >, ≤, ≥ |
8 | The logic operator And |
9 | The logic operators Or and Xor |
10 | Conversions such as ►Frac |
TI refers to the routine that determines order of operations as the Equation Operating System (EOSTM). Unfortunately, this cool name hasn't become common usage.
Test your knowledge
Here are some sample problems on logical operators, in order of complexity. For the more difficult ones, it may be best to break them up into smaller parts and work in steps.
# | Question |
---|---|
1 | 0 and 1 or 1 |
2 | 0 and (1 or 1) |
3 | 4 and -4 xor (.6 and 0) |
4 | not(1) xor (1 and 1 xor 1) |
5 | 1 and 0 xor (6*4 and 0) or not(0 and 6) |
= Collapsible_Show="Answers"_Hide="Answers"_Folded="yes"
# | Answer |
---|---|
1 | 1 |
2 | 0 |
3 | 1 |
4 | 0 |
5 | 1 |