System Variable IC: Difference between revisions
From NARS2000
Jump to navigationJump to search
No edit summary |
m (t/c) |
||
| (20 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
<h1><aplxx>⎕IC</aplxx> - Indeterminate Control</h1> | |||
{{BoxStart|<apll>Z←⎕IC</apll> | |||
< | | returns the current value of the Indeterminate Control vector.}} | ||
< | {{BoxEnd|<apll>Z</apll> is an integer vector whose elements each control a separate aspect of how indeterminates are handled by the system.}} | ||
<br /> | <br /> | ||
{| border="1" cellpadding="5" cellspacing="0" rules="none" summary="" | |||
|| <apll>⎕IC←R</apll> || sets all of the values of the Indeterminate Control Vector to <apll>R</apll>. | |||
|- | |||
| valign="top" |<apll>⎕IC←⍬</apll> || sets all of the values of the Indeterminate Control vector to their system default state. | |||
|- | |||
|| <apll>⎕IC[L]←R</apll> || sets the value(s) of the Indeterminate Control vector indexed by <apll>L</apll> to <apll>R</apll>. | |||
|- | |||
|} | |||
<br /> | <br /> | ||
<p>This experimental feature attempts to collect together in one place control of various indeterminate calculations such as <apll>0÷0</apll> and friends. The values of this multi-element vector each control a different calculation. In particular,</p> | <p>This experimental feature attempts to collect together in one place control of various infinite and indeterminate calculations such as <apll>÷0</appl>, <apll>0÷0</apll>, and friends. The values of this multi-element vector each control a different calculation. In particular,</p> | ||
<table border="0" cellpadding="5" cellspacing="0 rules="rows" summary=""> | <table border="0" cellpadding="5" cellspacing="0 rules="rows" summary=""> | ||
<tr> | <tr> | ||
<th valign="top"><apll>⎕IC</apll> Index<br />(origin-0)</th> | <th valign="top"><apll>⎕IC</apll> Index<br />(origin-0)</th> | ||
<th valign="top">Indeterminate<br />Calculation</th> | <th valign="top">Indeterminate<br />or Infinite Calculation</th> | ||
<th valign="top">Default<br />Result</th> | <th valign="top">Default<br />Result</th> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td align="center">0</td> | <td align="center">0</td> | ||
<td align="center"><apll>÷0</apll></td> | <td align="center"><apll>÷0</apll> or <apll>L÷0</apll> for <apll>L≠0</apll></td> | ||
<td align="center"><apll>∞</apll></td> | <td align="center"><apll>∞</apll></td> | ||
</tr> | </tr> | ||
| Line 69: | Line 35: | ||
<tr> | <tr> | ||
<td align="center">2</td> | <td align="center">2</td> | ||
<td align="center"><apll>! | <td align="center"><apll>!R</apll> for integer <apll>R<0</apll></td> | ||
<td align="center"><apll>DOMAIN ERROR</apll></td> | <td align="center"><apll>DOMAIN ERROR</apll></td> | ||
</tr> | </tr> | ||
| Line 75: | Line 41: | ||
<tr> | <tr> | ||
<td align="center">3</td> | <td align="center">3</td> | ||
<td align="center"><apll>0×∞</apll> | <td align="center"><apll>0×∞</apll> or <apll>∞×0</apll></td> | ||
<td align="center"><apll>DOMAIN ERROR</apll></td> | <td align="center"><apll>DOMAIN ERROR</apll></td> | ||
</tr> | </tr> | ||
| Line 81: | Line 47: | ||
<tr> | <tr> | ||
<td align="center">4</td> | <td align="center">4</td> | ||
<td align="center"><apll>0ׯ∞</apll> | <td align="center"><apll>0ׯ∞</apll> or <apll>¯∞×0</apll></td> | ||
<td align="center"><apll>DOMAIN ERROR</apll></td> | <td align="center"><apll>DOMAIN ERROR</apll></td> | ||
</tr> | </tr> | ||
| Line 105: | Line 71: | ||
<tr> | <tr> | ||
<td align="center">8</td> | <td align="center">8</td> | ||
<td align="center"><apll>∞-∞</apll> (same sign)</td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">9</td> | |||
<td align="center"><apll>L|∞</apll> for <apll>L>0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">10</td> | |||
<td align="center"><apll>L|¯∞</apll> for <apll>L>0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">11</td> | |||
<td align="center"><apll>L|∞</apll> for <apll>L<0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">12</td> | |||
<td align="center"><apll>L|¯∞</apll> for <apll>L<0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">13</td> | |||
<td align="center"><apll>¯∞|R</apll> for <apll>R>0</apll></td> | |||
<td align="center"><apll>¯∞</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">14</td> | |||
<td align="center"><apll>∞|R</apll> for <apll>R<0</apll></td> | |||
<td align="center"><apll>∞</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">15</td> | |||
<td align="center"><apll>0*0</apll></td> | <td align="center"><apll>0*0</apll></td> | ||
<td align="center"><apll>1</apll></td> | <td align="center"><apll>1</apll></td> | ||
| Line 110: | Line 118: | ||
<tr> | <tr> | ||
<td align="center"> | <td align="center">16</td> | ||
<td align="center"><apll>L*∞</apll> for <apll>L≤¯1</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">17</td> | |||
<td align="center"><apll>0*∞</apll></td> | |||
<td align="center"><apll>0</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">18</td> | |||
<td align="center"><apll>0*¯∞</apll></td> | |||
<td align="center"><apll>∞</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">19</td> | |||
<td align="center"><apll>±∞*0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">20</td> | |||
<td align="center"><apll>L*R</apll> for <apll>L<0</apll> and non-integer <apll>R</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">21</td> | |||
<td align="center"><apll>0⍟0</apll></td> | <td align="center"><apll>0⍟0</apll></td> | ||
<td align="center"><apll> | <td align="center"><apll>1</apll></td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td align="center"> | <td align="center">22</td> | ||
<td align="center"><apll>0⍟1</apll></td> | <td align="center"><apll>0⍟1</apll></td> | ||
<td align="center"><apll>DOMAIN ERROR</apll></td> | <td align="center"><apll>DOMAIN ERROR</apll></td> | ||
| Line 122: | Line 160: | ||
<tr> | <tr> | ||
<td align="center"> | <td align="center">23</td> | ||
<td align="center"><apll>1⍟0</apll></td> | <td align="center"><apll>1⍟0</apll></td> | ||
<td align="center"><apll>DOMAIN ERROR</apll></td> | <td align="center"><apll>DOMAIN ERROR</apll></td> | ||
| Line 128: | Line 166: | ||
<tr> | <tr> | ||
<td align="center"> | <td align="center">24</td> | ||
<td align="center"><apll>1⍟1</apll></td> | <td align="center"><apll>1⍟1</apll></td> | ||
<td align="center"><apll>1</apll></td> | <td align="center"><apll>1</apll></td> | ||
</tr> | |||
<tr> | |||
<td align="center">25</td> | |||
<td align="center"><apll>0∨±∞</apll> or <apll>±∞∨0</apll></td> | |||
<td align="center"><apll>LEFT</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">26</td> | |||
<td align="center"><apll>0∧±∞</apll> or <apll>±∞∧0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">27</td> | |||
<td align="center"><apll>0⍟R</apll> for <apll>R≠0 1</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">28</td> | |||
<td align="center"><apll>L*¯∞</apll> for <apll>¯1 ≤ L < 0</apll></td> | |||
<td align="center"><apll>DOMAIN ERROR</apll></td> | |||
</tr> | </tr> | ||
| Line 141: | Line 203: | ||
<th valign="top"><apll>⎕IC</apll> Value</th> | <th valign="top"><apll>⎕IC</apll> Value</th> | ||
<th valign="top">Result</th> | <th valign="top">Result</th> | ||
</tr> | |||
<tr> | |||
<td align="center">¯1</td> | |||
<td align="center"><apll>¯1</apll></td> | |||
</tr> | </tr> | ||
| Line 168: | Line 235: | ||
</tr> | </tr> | ||
<tr> | |||
<td align="center">5</td> | |||
<td align="center"><apll>NaN (∅)</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">6</td> | |||
<td align="center"><apll>LEFT</apll></td> | |||
</tr> | |||
<tr> | |||
<td align="center">7</td> | |||
<td align="center"><apll>RIGHT</apll></td> | |||
</tr> | |||
</table> | </table> | ||
<p>For example,</p> | <p>For example,</p> | ||
<apll> | <apll><pre> | ||
⎕IO←0 | |||
⎕IC | |||
3 4 2 2 2 1 2 2 1 2 2 2 | 3 4 3 2 2 1 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2 | ||
0÷0 | |||
1 | 1 | ||
⎕IC[5]←2 | |||
⎕IC | |||
DOMAIN ERROR | 3 4 3 2 2 2 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2 | ||
0÷0 | |||
DOMAIN ERROR | |||
0÷0 | |||
∧ | |||
3 4 2 2 2 1 2 2 1 2 2 2 | ⎕IC←⍬ | ||
</apll> | ⎕IC | ||
3 4 3 2 2 1 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2 | |||
</pre></apll> | |||
To set all indeterminate results to <apll>DOMAIN ERROR</apll>, use <apll>⎕IC[]←2</apll>. | |||
==Incomplete List of Indeterminates== | |||
<p>There may be other indeterminates not covered by this feature. Please let us know if you think there are other cases that should be included.</p> | |||
{{System Variables}} | |||
{{Article footer|0|NO}} | |||
[[Category:System variables|IC]] | |||
Latest revision as of 15:03, 13 October 2019
⎕IC - Indeterminate Control
|
||||
| Z is an integer vector whose elements each control a separate aspect of how indeterminates are handled by the system. |
| ⎕IC←R | sets all of the values of the Indeterminate Control Vector to R. |
| ⎕IC←⍬ | sets all of the values of the Indeterminate Control vector to their system default state. |
| ⎕IC[L]←R | sets the value(s) of the Indeterminate Control vector indexed by L to R. |
This experimental feature attempts to collect together in one place control of various infinite and indeterminate calculations such as ÷0,
| ⎕IC Index (origin-0) |
Indeterminate or Infinite Calculation |
Default Result |
|---|---|---|
| 0 | ÷0 or L÷0 for L≠0 | ∞ |
| 1 | ⍟0 | ¯∞ |
| 2 | !R for integer R<0 | DOMAIN ERROR |
| 3 | 0×∞ or ∞×0 | DOMAIN ERROR |
| 4 | 0ׯ∞ or ¯∞×0 | DOMAIN ERROR |
| 5 | 0÷0 | 1 |
| 6 | ∞÷∞ (same sign) | DOMAIN ERROR |
| 7 | ∞÷∞ (different sign) | DOMAIN ERROR |
| 8 | ∞-∞ (same sign) | DOMAIN ERROR |
| 9 | L|∞ for L>0 | DOMAIN ERROR |
| 10 | L|¯∞ for L>0 | DOMAIN ERROR |
| 11 | L|∞ for L<0 | DOMAIN ERROR |
| 12 | L|¯∞ for L<0 | DOMAIN ERROR |
| 13 | ¯∞|R for R>0 | ¯∞ |
| 14 | ∞|R for R<0 | ∞ |
| 15 | 0*0 | 1 |
| 16 | L*∞ for L≤¯1 | DOMAIN ERROR |
| 17 | 0*∞ | 0 |
| 18 | 0*¯∞ | ∞ |
| 19 | ±∞*0 | DOMAIN ERROR |
| 20 | L*R for L<0 and non-integer R | DOMAIN ERROR |
| 21 | 0⍟0 | 1 |
| 22 | 0⍟1 | DOMAIN ERROR |
| 23 | 1⍟0 | DOMAIN ERROR |
| 24 | 1⍟1 | 1 |
| 25 | 0∨±∞ or ±∞∨0 | LEFT |
| 26 | 0∧±∞ or ±∞∧0 | DOMAIN ERROR |
| 27 | 0⍟R for R≠0 1 | DOMAIN ERROR |
| 28 | L*¯∞ for ¯1 ≤ L < 0 | DOMAIN ERROR |
The values in each element of ⎕IC control the result of the calculation as follows:
| ⎕IC Value | Result |
|---|---|
| ¯1 | ¯1 |
| 0 | 0 |
| 1 | 1 |
| 2 | DOMAIN ERROR |
| 3 | ∞ |
| 4 | ¯∞ |
| 5 | NaN (∅) |
| 6 | LEFT |
| 7 | RIGHT |
For example,
⎕IO←0
⎕IC
3 4 3 2 2 1 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2
0÷0
1
⎕IC[5]←2
⎕IC
3 4 3 2 2 2 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2
0÷0
DOMAIN ERROR
0÷0
∧
⎕IC←⍬
⎕IC
3 4 3 2 2 1 2 2 2 2 2 2 2 4 3 1 2 0 3 2 2 1 2 2 1 5 2 2 2
To set all indeterminate results to DOMAIN ERROR, use ⎕IC[]←2.
Incomplete List of Indeterminates
There may be other indeterminates not covered by this feature. Please let us know if you think there are other cases that should be included.
| System Variables (A value may be assigned to these except for ⎕DM) | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| ⎕ALX | ⎕CT | ⎕DM | ⎕DT | ⎕ELX | ⎕FC | ⎕FEATURE | ⎕FPC | ⎕IC | ⎕IO |
| ⎕LR | ⎕LX | ⎕PP | ⎕PR | ⎕PW | ⎕RL | ⎕SA | ⎕WSID | ||
| Niladic System Functions (a value cannot be assigned to these) | |||||||||
| ⎕A | ⎕AV | ⎕EM | ⎕ET | ⎕LC | ⎕NNAMES | ⎕NNUMS | ⎕SI | ⎕SYSID | ⎕SYSVER |
| ⎕T | ⎕TC | ⎕TCBEL | ⎕TCBS | ⎕TCESC | ⎕TCFF | ⎕TCHT | ⎕TCLF | ⎕TCNL | ⎕TCNUL |
| ⎕TS | ⎕WA | ||||||||
| Monadic or dyadic system functions (a value cannot be assigned to these) | |||||||||
| ⎕AT | ⎕CR | ⎕DC | ⎕DFT | ⎕DL | ⎕DR | ⎕EA | ⎕EC | ⎕ERROR | ⎕ES |
| ⎕EX | ⎕FMT | ⎕FX | ⎕MF | ⎕NAPPEND | ⎕NC | ⎕NCREATE | ⎕NERASE | ⎕NINFO | ⎕NL |
| ⎕NLOCK | ⎕NREAD | ⎕NRENAME | ⎕NREPLACE | ⎕NRESIZE | ⎕NSIZE | ⎕NTIE | ⎕NUNTIE | ⎕STOP | ⎕TF |
| ⎕TRACE | ⎕UCS | ⎕VR | |||||||
| Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive | |||||||||
| See Also | ||
| System Commands | System Variables and Functions | Operators |
| Keyboard | ||||||||||||||
| Alt+Shift | ⍪ | ≡ | ≢ | ⍒ | ⍋ | ⌽ | ⍉ | ⊖ | ⍟ | ⍱ | ⍲ | ⍠ | ⌹ | |
| Alt | ⋄ | ¨ | ¯ | < | ≤ | ∅ | ≥ | > | ≠ | ∨ | ∧ | × | ÷ | |
| Shift | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | _ | + | |
| Key | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | |
| Alt+Shift | ⍷ | √ | ⍨ | ⍸ | ⍥ | ⍣ | ⍞ | ⍬ | ⊣ | |||||
| Alt | ? | ⍵ | ∊ | ⍴ | § | ↑ | ↓ | ⍳ | ○ | π | ← | → | ⊢ | |
| Shift | Q | W | E | R | T | Y | U | I | O | P | { | } | | | |
| Key | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | |
| Alt+Shift | ∫ | ∂ | ⌻ | ⍢ | ⍙ | ⍤ | ⍫ | ⌷ | ||||||
| Alt | ⍺ | ⌈ | ⌊ | ∞ | ∇ | ∆ | ∘ | ‼ | ⎕ | ⍎ | ⍕ | |||
| Shift | A | S | D | F | G | H | J | K | L | : | " | |||
| Key | a | s | d | f | g | h | j | k | l | ; | ' | |||
| Alt+Shift | ⊆ | ⊇ | χ | ⍡ | ⍭ | ⊙ | ||||||||
| Alt | ⊂ | ⊃ | ∩ | ∪ | ⊥ | ⊤ | ⍦ | ⍝ | ⍀ | ⌿ | ||||
| Shift | Z | X | C | V | B | N | M | < | > | ? | ||||
| Key | z | x | c | v | b | n | m | , | . | / | ||||
| NARS 2000 Lang Tool Bar |
← | → | + | - | × | ÷ | * | ⍟ | ⌹ | ○ | ! | ? | √ | | | ⌈ | ⌊ | ⊥ | ⊤ | ⊣ | ⊢ | |||
| ≡ | ≢ | < | ≤ | = | ≥ | > | ≠ | ∨ | ∧ | ⍱ | ⍲ | ↑ | ↓ | ⊂ | ⊃ | ⌷ | ⍋ | ⍒ | |||||
| ⍳ | ∊ | ⍸ | ⍷ | ∪ | ∩ | ⊆ | ⊇ | ~ | § | π | .. | , | ⍪ | ⍴ | ⌽ | ⊖ | ⍉ | ||||||
| / | \ | ⌿ | ⍀ | ⊙ | ¨ | ⍨ | ⍤ | ⍣ | ⍡ | ⍥ | ⍦ | . | ∘ | ⍠ | ‼ | ⌻ | ∂ | ∫ | ⍞ | ⎕ | ⍎ | ⍕ | |
| ⋄ | ⍝ | ∇ | ∆ | ⍙ | _ | ⍺ | ⍵ | ¯ | ⍬ | ∞ | ∅ | ||||||||||||
| Second Row | i j k | i j k l | g | p | r | v | x | ||||||||||||||||