Logically "ands" a picture variable and the graph screen at *[row, column]*

AndPic *picVar*,*[row, column]*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

The `AndPic` command logically takes the picture variable specified, and takes the current graph, and it finds the points at which both the graph and the picture have pixels, and it displays them only. If specified, *[row,column]* tells where the top left corner of the picture is to be placed. If not specified, the default is (0,0), which is the top left corner of the screen.

# Error Conditions

**260 - Domain error** happens when the *[row,column]* argument is outside the screen range..

**960 - Undefined variable** happens when the picture variable specified does not exist..

# Related Commands

# See Also

Returns the name of the current folder.

getFold()

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

This command returns the name of the current folder as a string. This will usually return "main", as main is the default folder for your calculator. It is used to check which folder you calculator is in while you are inside a program.

```
:getFold()
: "main"
```

# Related Commands

This command turns on all or a group of functions.

FnOn *[optional function numbers]*

**Menu Location**

- Press F4 from the Homescreen to enter the OTHER menu.
- Press 7 to select the FnOn command.

This command works on all calculators.

The FnOn command turns on one or a group of functions. The optional argument specifies which functions are to be turned on, and if there is no argument, then all the functions are turned on, not just the specified functions. This is used mostly to turn back on functions after they are turned off by the similar FnOff command, or it is used to turn back on functions after a program that has used the graphscreen.

```
:FnOff
:FnOn 4,7,9,20
```

The above code will turn off all functions, and then it will turn on only functions 4, 7, 9, and 20. This is useful if you want to graph only a few functions, but still have the rest of the functions stored in the calculator.

# Error Conditions

**260 - Domain error** happens when the optional function argument is not in the range 1-99.

# Related Commands

Truncates a number to a specified number of decimal places.

round(*value*[,*number of decimal places to round to*])

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press 3 to select round(.

This command works on all calculators.

1 byte

The round command takes whatever value you give it, and it rounds the value to a given number of decimal places. For instance round(9.7,0) will return 10, since rounding to 0 decimal places will return the closest whole number. Another example would be if you entered round(5.46338,3) which would return 5.463, since it rounded 5.46338 to 3 decimal places. The round function can round 0 to 12 decimal places, and if you enter a value outside that range, you will get a domain error. Strangely enough, if you enter an imaginary number into the round() command, nothing happens and the calculator returns the same function in a simplified form.

```
:round(99.35847475,5)
: 99.35847
:round(4.392i,2)
: round(4.392*i,2.)
:round(2.348972,2i)
: round(2.348972,2*i)
```

# Unexpected results

Your calculator may also round, say for instance if you do this:

`:round(2.4573485645,11)`

If your calculator is set to float or to fix at 10 or less, the calculator will round the number that comes out of the function. The function above should return 2.4573485645, since that is less than 11 digits, but if your calculator is set to "Float 6" it will return 2.457349 instead of what you expected.

# Error Conditions

**260 - Domain error** happens when the number of decimal points to round to is not in the range 0-12.

# Related Commands

Returns the current date set on the calculator and returns it in list format.

getDate()

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command requires a calculator with AMS version 2.07 or higher (it will also work on any TI-89 Titanium or Voyage 200 calculator)

3 bytes

The getDate() command checks the date that the calculator is set to, and then returns it in a list format. The list will always be in the format {year, month, day}. To change this list to another format, you can use the closely related getDtStr() option, which just returns the date in a string format, not as a list. The setDtFmt() command does not work on this command, but it will change the format that the calculator returns the getDtStr() command as.

For example, if the calculator's date was set to March 14th, 2011, the getDate() command would return the following:

```
:getDate()
: {2011 3 14}
```

# Related Commands

Mar |
16 — |
New technique added (text wrapper) A simple text wrapper has been added and can be viewed here. |

Wraps text on the screen whenever you want. (Preserves space functionality.)

*Str1*/*Ans* — String to wrap

*Text on screen*

R, C, I, Str1, Ans

TI-83/84+/SE

BlakPilar

# Code (Graph Screen)

```
:"YAY, I MADE A LINEºWRAPPER FOR (ALMOST)ºANY LENGTH OF TEXT!º =D→Str1
:ClrDraw
:DispGraph
:DelVar RDelVar CFor(I,1,length(Str1
:If C<91 and "º"≠sub(Str1,I,1
:Then
:If " "≠sub(Str1,I,1
:Text(R,C,sub(Str1,I,1
:C+4→C
:If I<length(Str1)-1:Ans-2(" "≠sub(Str1,I,1→C
:Else
:DelVar CR+6→R
:End
:C+4(C>89→C
:I-(C>89→I
:End
```

# Explanation (Graph Screen)

**NOTE:** The string declaration can easily be changed to "Ans→Str1" as long as you are **100% certain** that Ans will be a string.

The first two lines after the string are self-explanatory (I hope). We first need to store zero to R and C (this is done by using DelVar), which will be used as our row and column variables. We then start a loop which will only execute while in the string.

The first If statement that we encounter checks for our new line character, which in this case is used as the degree sign (2ND+APPS>1). If the current character is **not** our new line character, and it is **not** a space, we display it and add 4 to our column variable.

With our third If statement, we check to see if we are still in the string. If we are, and the next character is a space, we subtract two from the column variable. The number 2 can be changed to whatever you want the word spacing to be (TI-OS default is 1).

Finally, we reach our Else, which is what will happen if the current character **is** the new line character. All we do is reset the column, and add six to the row (again, the number 6 can be easily changed for line spacing). Simple as that!

Note, this will also wrap text in case you forget the new line character.

# Code (Home Screen)

```
:"WOOT, NOW IT'S A LINEºWRAPPER FOR THE HOMEºSCREEN! =]→Str1
:ClrHome
:1→R:1→C
:For(I,1,length(Str1
:If C≠17 and "º"≠sub(Str1,I,1
:Then
:Output(R,C,sub(Str1,I,1
:C+1→C
:Else
:I-(C=17→I
:1→C:R+1→R
:End
:If R=9:Stop
:End
```

# Explanation (Home Screen)

**NOTE:** As with the graph screen version, the string declaration can easily be changed to "Ans→Str1" as long as you are **100% certain** that Ans will be a string.

This isn't that different from the graph screen version. We just have to keep in mind that the home screen *only* has an 8x16 dimension and is monospaced (each character is the same width and height), so we need to adjust our variables accordingly. The row can have a max of 8, and the column can have a max of 16. Each's minimum is 1.

As we display text, we check to see if the current character is our new line character. If it isn't, then we go through our displaying. If it is, then we change our variables.

author: 'Zeda E.'

description: 'This is my version of Tic-Tac-Toe that includes options to go against the calculator… be ware, the calc can be pretty good. For a challenge, try playing as O.'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '1'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: '/archives:tic-tac-toe-with-ai/TTT.GIF'

download: TTT.zip

size: '819'

unit: '1'

author: 'Zeda Elnara'

description: 'Math Attack! is a "game" I made two years ago but I never released it. All it is meant to do is stretch your brain by quizzing you on basic math.'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '1'

image: '/archives:math-attack/MathAttack.gif'

download: MathAttack.zip

size: '1103'

unit: '1'

Scales window settings relative to pixel length and height

ZFrac*X*

[Zoom][Alpha][Apps]

OS 2.53MP+

2 bytes

ZFrac*X* refers to a collection of Zoom commands in for the OS 2.53MP and up. The calculator boasts six such commands, each replacing *X* with a fraction of some sort. The commands all essentially operate in the same manner, so they are all covered here on this page.

This command centers the origin of the graph and makes each pixel *X* units tall and wide where "*X*" refers to the suffix of the command. For example, ZFrac1/3 makes each pixel a length of and height of 1/3, which means that each square unit would be a 3x3 square of pixels. It also sets Xscale and Yscale to 1.

It is useful when the users wants each pixel to be a uniform length and height, though other commands such as ZSquare, ZDecimal, and ZInteger also create a friendly window, and being more compatible, they would be more useful in programming across calculators.

The following is a list of the available ZFrac*X* commands:

- ZFrac1/2
- ZFrac1/3
- ZFrac1/4
- ZFrac1/5
- ZFrac1/8
- ZFrac1/10

# Related Commands

Puts Quadrant 1 in the viewing window.

none

[Zoom][Alpha][Math]

OS 2.53MP and above

2 bytes

ZQuadrant1 was introduced in OS 2.53MP. As it's name might imply, it puts Quadrant I in the viewing window (the upper-left quadrant). Here are the window settings it affects:

- Xmin is set to 0 and Xmax is set to 9.4 making each pixel .1 units.
- Ymin is set to 0 and Ymax is set to 9.4 (each pixel is 47/310 units)
- Xscl and Yscl are set to 1
- ΔX is set to .1
- ΔY is set to 47/310
- Xres is set to 1

**This command does not seem to work in programs.**

# Related Commands

# Review

- Where can you find most drawing commands?
- What does a GDB store?
- What does a Pic store?
- Which command allows you to select a mark type?
- Are the coordinates the same for Point and Pixel Commands?
- What do you do you enable the fast circle flag?
- How do you erase a line?
- How do you get large text on the graphscreen?

# Exercises

- Create a program that inverts random blocks of the graph screen.
- Create a program that uses text sprites to make a drawing, then store that to a Pic.

<< Summary |
Table of Contents |
Sample Program: Pong >> |

author: 'Mohammad Adib'

description: "Beta 4. A DoodleJump Clone made with Axe Parser. Latest Talk:\nhttp://www.omnimaga.org/index.php?board=158.0"

arcade: '1'

graphics: '1'

platform: '1'

puzzle: '0'

rpg: '0'

strategy: '1'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '1'

image: '/archives:doodlejump/beta%204.gif'

download: DoodleJumpBeta4.8xk

size: '20560'

unit: '1'

Member

author: BlakPilar

description: 'Have you ever wanted to get some of those pretty nifty ASCII characters, such as the arrows, or subscript numbers? Well with this program, you can! I recommend just sending this to your archive and running it with a shell (such as MirageOS) so that it does not get deleted, as the program stores its awesome characters into Str7!'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '1'

misc: '0'

image: /home/no_image_2.png

download: CHARS.8xp

size: '169'

unit: '1'

author: 'Mohammad Adib'

description: 'A basketball shooting game. has 1 player vs. AI, 2 player, and practice modes. fun to play, includes AI, stats at the end, and a practice mode. It is related to foul shot by N*E*V*U*M_X although, the original idea came to me at PE class in school. '

arcade: '1'

graphics: '1'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '1'

sports: '1'

casino: '0'

board: '0'

utility: '0'

misc: '1'

image: '/archives:ownage-hoops/shot.gif'

download: OwnageHoops.zip

size: '9000'

unit: '1'

Nov |
05 — |
Added new page about recently developed routine. |

Retrieves a word from an indexed string of words with an index number.

*A* - The word's index number

*Str0* - The index of words

*Str1* - The word

A, Str0, Str1

TI-83/84/+/SE

ADeadBody

ADeadBody

```
:"000Word......001another..."→Str0
:sub(Str0,3+inString(Str0,sub("0123456789",iPart(A/100)+1,1)+sub("0123456789",10fPart(iPart(A/10)/10)+1,1)+sub("0123456789",10fPart(A/10)+1,1)),10)→Str1
```

The routine converts the number into a string then searches for that in the string of words and stores the characters that follow it. Input in some 3 digit number ex: 001 would correspond to word 001. 102 would correspond to word 102. The routine itself can store up to 1000 10 letter words. I developed this for the purpose of storing and retrieving Pokemon names in the game I am developing but I am sure that there are other uses.

**Acceptable inputs**: zero, positive integers up to 999**Error inducing inputs**: decimals, negative numbers, numbers over 1000

This example of the routine would display "helloworld",

```
:1→A
:"000worldhello001helloworld"→Str0
:sub(Str0,3+inString(Str0,sub("0123456789",iPart(A/100)+1,1)+sub("0123456789",10fPart(iPart(A/10)/10),1))+1,1)+sub("0123456789",10fPart(A/10)+1,1)),10)→Str1
:Disp Str1
```

If A were 0 instead of 1, then the output would be "worldhello".

In this modified version of the code it would output "helloworlditsme" a 15 letter code while still only displaying 10 letter words for any other input. You can see how by looking at the end of the 3rd line of programming it adds a value of 5 to the length of the outputted string under the condition of A being equal to 1

```
:1→A
:"000worldhello001helloworlditsme002helloworld"→Str0
:sub(Str0,3+inString(Str0,sub("0123456789",iPart(A/010)+1,1)+sub("0123456789",10fPart(iPart(A/10)/10),1))+1,1)+sub("0123456789",10fPart(A/10)+1,1)),10+5(A=1))→Str1
:Disp Str1
```

# Error Conditions

**ERR:INVALID DIM**is thrown when the input number is either over 999 or under 0

# Related Routines

author: 'Mark Radocy'

description: "Pick a direction, and the player will move in that direction until it hits another block, when it will stop.\n\nIt can then be moved again the same way. Continue until the block reaches the finish.\n\nJust don't go off the screen, or it's game over!\n- Contains 18 levels with autosaving\n- Works with mirage OS"

arcade: '1'

graphics: '0'

platform: '0'

puzzle: '1'

rpg: '0'

strategy: '1'

sports: '0'

casino: '0'

board: '1'

utility: '0'

misc: '1'

image: 'archives:anbox/TITLE.PNG'

download: anbox.zip

size: '9873'

unit: '1'

This command will open up a template that allows you to evaluate an expression in sigma notation.

This command is accessible by pressing ALPHA then WINDOW then 2.

This command is especially useful for statistics and algebra.

It is also available in the programming mode. You can access it either through the catalog or the same way specified above.

The syntax for this command is

`Σ(Expression,Variable,Starting number,Ending number)`

An example would be to determine the sum of 2*X for X going from 1 to 10.

It would look like this:

`Σ(2X,X,1,10`

The result would be

`110`

n/d_Un/d is the command for switching between an improper fraction and a mixed number.

It is accessible by pressing ALPHA then Y= then 3.

n/d is the template for entering a simple fraction.

n/d is accessible by pressing ALPHA then Y= then enter.

Mode command that sets Answers to AUTO.

AUTO Answer

Press:

- MODE
- DOWN until you see Answers
- ENTER on AUTO

Alternatively, access the catalog.

TI-84 2.53MP only

2 bytes

The `AUTO Answer` command is a mode command that changes the Answers mode to AUTO. The AUTO mode is in essence the same mode that lower OS models use. The calculator will evaluate a numerical expression and return a decimal or number in scientific notation, unless `►Frac` is used.

In the Mathprint mode, no noticeable difference is seen unless the answer is converted to a fraction.

# Related Commands

Mode command that puts the calculator into Classic mode.

CLASSIC

Press:

- MODE
- DOWN until you reach MathPrint or Classic
- ENTER on Classic

Alternatively, use the catalog.

TI-84 2.53MP only

2 bytes

`CLASSIC` will put the calculator into `Classic` mode as opposed to `MathPrint` mode. The `Classic` mode will make the calculator display everything as pre-`MathPrint` OS would, including input. For instance, rather than superscripting exponents as `MathPrint` mode would, `Classic` mode uses the simple caret syntax (`^`).

*MathPrint mode*:

2^{4}

16

*Classic mode*:

2^4

16

# Advanced Uses

When in `Classic` mode, text and numbers are displayed much faster on the home screen and the function menus load faster. This can be useful in games that use the home screen, or just with calculations in general.

# Related Commands

Mode command that sets Answers to DEC.

DEC Answer

Press:

- MODE
- DOWN until you see Answers
- ENTER on DEC

Alternatively, access the catalog.

TI-84 2.53MP only

2 bytes

The `DEC Answer` command is a mode command that changes the Answers mode to DEC. DEC mode is very similar to the AUTO mode in which the calculator will display all answers in decimal form unless the returned number is an integer. Fractions will only be displayed with use of the `►Frac` command.

# Related Commands

Converts a number between fraction form and decimal form.

*number*►F◄►D

Press:

- MATH
- RIGHT to NUM
- ALPHA B

Alternatively, access the catalog.

TI-84 2.53MP only

2 bytes

The ►F◄►D command is used to convert a number from fraction form to decimal form, or vice versa. Regardless of what form the given number is, this command is meant to automatically determine the form so that it returns the other. It is in essence a combination of the ►Frac and ►Dec commands.

```
7.5►F◄ ►D
15/2
Ans►F◄ ►D
7.5
```

# Related Commands

Un/d is a template that allows you to input a fraction with a whole number in front of it.

Un/d is accessible from most screens by pressing ALPHA and Y= then 2.

What this command does is that it adds the whole number to the fraction. It does not calculate a product but instead it calculates an addition.

Frac Answer changes the mode to display a fraction whenever possible. That is to say it will display 1/2 as a fraction but irrational numbers will not be displayed as fraction. Numbers such as Pi will still be displayed as decimals.

N is a variable, much like A or B or C, etc. Anything you can do with A you can do with N.

MATHPRINT is a command that simply changes the display mode on the home screen. This command is useful if you want to display a number as a fraction, otherwise it does nothing. Be aware that if you use this and then use an output( command to display a numerical variable , the output command may not display.

Finds the lowest numerical value from arguements

min(arg1,[arg2])

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

X

The min() Command can be executed in two different ways.

It can find the lowest of two numbers:

```
min(0,1)
//returns 0
```

It can find the lowest number in a list:

```
min({0,1,2})
//returns 0
```

# Advanced Uses

For advanced users, the min command can also have its two arguments replaced with lists, as long as the two lists have the same dimensions and only include numbers. min(list,list) returns a list, with min having been done on each pair of items, as is the custom for lists in functions.

```
min({123},{321})
//returns {1,2,1}
```

It also works in much the same way for matrices.

```
min([[1,2,3][1,2,3]],[[3,2,1][3,2,1]])
//returns [[1,2,1][1,2,1]]
```

# Optimization

If comparing two numbers, it is slightly faster to compare the two as two arguments than to have them in a list.

```
:min({1,2})
can be
:min(1,2)
```

The first example takes 13 seconds for 1000 repetitions, while the second takes only 9. When using the min command repetitively, this will add up.

# Related Commands

author: Sleight

description: "A highly graphical side-scrolling, game in which you play a UFO shooting up buildings. Unique in that it redraws the WHOLE SCREEN for every frame, thanks to statplots and pics.\n—\nInstructions:\n\nControls: up/down moves, 2nd/del fires beam, alpha/stat fires super beam, graph boosts to top of screen.\n\nScoring: taller buildings= less points, shorter buildings= more points, extra life every 250 points.\n\nEnergy: super beam takes 2 energy, boost takes 3 energy, extra energy every 50 points\n—\nTi-83+ not recommended for speed."

arcade: '1'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: 'archives:mission:raze/Screenshot.jpg'

download: MSSNRAZE.8xp

size: '2357'

unit: '1'

Avneesh wrote:comment Fantastic |

Allows you to find the log of a number using any base you want

logBASE(*value*,*base*)

Press:

- ALPHA, then F2 (which is located over the WINDOW button)
- 5 or arrow keys to move down to logBASE(

or

- MATH
- A or arrow keys to move down to logBASE(

TI-84+SE with TI-OS 2.53 MP

2 byte

The logBASE( command is an upgrade from the log( command allowing you to input any base you want rather than being restricted to base 10. The command searches for the exponent that base *b* must be raised to get the given value.

This command can be used on both the home screen and while programming. If you are using CLASSIC mode, the command looks like below:

```
logBASE(8,2)
3
```

But in MATHPRINT mode, looks like the below:

log_{2}(8)

3

# Formulas

The log in base *b* can also be found using the ln( or log( commands. This is shown below:

Where in the case of the calculator, base *c* is 10. In other words, the two entries below are equivalent:

```
ln(x)/ln(b
can be
logBASE(x,b
```

The logBASE( command in this case saves one byte, so it is a minor optimization. However, for compatibility across calculators it would be better to use the traditional method in programs as it is only a byte more yet can be used by calculators that do not have the 2.53 MP OS.

# Error Conditions

**ERR:DOMAIN**occurs if you try to input 0 as value.

# Related Commands

Same as modulus - divides a number, but returns the remainder.

remainder(*dividend*,*divisor*)

Press:

- MATH to enter the Math menu
- Use arrows to go to the NUM menu
- 0 to choose remainder(, or use arrows

TI-84+SE with TI-OS 2.53 MP

2 byte

The `remainder(` function divides the first number given by the second number, and returns the remainder similar to the modulus. This command is only available if you have the TI-84+ Silver Edition and the new 2.53 MP operating system on your calculator. This command can be used both on the Home screen and when programming.

See the code segment below for an example:

`remainder(30,7)`

This returns a value of 2 because 30 divided by 7 has a remainder of 2.

# Compatability

As said earlier this command only works on a TI-84+ Silver Edition with the 2.53 MP OS, so this will not work on earlier OSes. To avoid non-portability, use the following code.

```
BfPart(A/B
instead of
remainder(A,B
```

`fPart`is a command that works in more OSes and more models.

They also are the same size (5 bytes), as long as B is one byte

# Error Conditions

**ERR:DIVIDE BY 0**occurs if you try to input 0 as the divisor.**ERR:DOMAIN**occurs if the divisor or dividend is either negative or less than 0**ERR:SYNTAX**occurs if the divisor or dividend is a symbol, or character or non-real number**ERR:DATA TYPE**occurs if the divisor or dividend is not a number, (i.e. text)

# Related Commands

author: Zaetsi

description: 'After turning off Ned''s hose each night, escape his yard without stepping on any Lawn Gnomes. Each night you disrupt Ned''s activities, he''ll add more Lawn Gnomes for you to dodge. If you stay in on place for too long you''ll trip his alarm system, so you can''t stop moving.'

arcade: '1'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: '/archives:the-valley-of-the-gnomes/VALLEY%20OF%20THE%20GNOMES.JPG'

download: VALGNOME.8xp

size: '2133'

unit: '1'

author: Zaetsi

description: 'Take on your next door neighbor Ned in the water balloon war of the century. Change the angle and power of your throws to hit Ned and collect points. More Power = More Points. The one with more points after 11 volleys shall be hailed Master of the Universe.'

arcade: '1'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '1'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: '/archives:yard-wars/yard_wars.jpg'

download: YARDWARS.8xp

size: '4161'

unit: '1'

May |
27 — |
Due to the release of a new OS by TI (2.53MP), new commands have been added to the Command Index. |

author: patriotsfan

description: 'Use this program to strike it rich and become the next millionaire! Although, I can''t guarantee it will happen!'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '1'

image: '/archives:lottery/results.gif'

download: Lottery.zip

size: '342'

unit: '1'

Returns true for prime arguments and false for composite arguments.

isPrime(*expression*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

The isPrime() command returns a Boolean value based on whether or not the passed argument is prime or not. True is returned for prime numbers and false is returned for composite numbers. A number is prime if its divisors are only 1 and itself. For instance, the number 23 is considered prime because no two positive integers but 1 and 23 can multiply to get 23. For the calculator, 1 isn't considered prime.

```
isPrime(23)
true
isPrime(24)
false
```

# Algorithm

According to TI, the algorithm run by the calculators is as follows:

"The algorithms used by the TI-89 family, TI-92 family, and Voyage 200 calculators divides by successive primes through the largest one less than 216. It does not actually keep a table or use a sieve to create these divisors, but cyclically adds the sequence of increments 2, 2, 4, 2, 4, 2, 4, 6, 2, 6 to generate these primes plus a few extra harmless composites.

TI-92 Plus and TI-89 family start the same way, except that they stop this trial division after trial divisor 1021, then switch to a relatively fast Monte-Carlo test that determines whether the number is certainly composite or is almost certainly prime. The isPrime() function stops at this point returning either false or (almost certainly) true."

author: BlakPilar

description: 'This is a text-based version of Assassin''s creed. If you have any questions, comments, or find any bugs, let me know at blakpilar AT gmail DOT com'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '1'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: /home/no_image_2.png

download: AC2WM.zip

size: '27'

unit: '2'

# How Ti Basic Programs Are Executed

Ti Basic Programs are executed by calling built-in functions already written for you on the calculator. Ti Basic Programs are really not executed, they are interpreted by the calculator's operating system. That means that the calculator 'reads' the programs, and then executes the appropriate function. For each command that is read in the calculator, several native commands may be executed. This means that the calculator's Central Processing Unit will have to do more processing to execute the program. This is usually not a problem for small, simple programs; but if you are considering making a game, or other complex application, it is probably a good idea to use Assembly as your programing language.

# How Assembly Programs are Executed

Assembly programs are executed natively. That means that the Central Processing Unit is able to directly interpret your code, instead of having to rely on commands from the operating system. This also gives you more control over the calculator.

## Too much control?

Before sending ANY assembly program to your calculator, make sure it is from a verified source. This is because when you execute an Assembly Program, you give the program complete control of the calculator. An assembly program can directly edit both RAM, and ROM, enabling it to erase the Operating System, install a virus, log your keystrokes. This is an Assembly Program is a Native Application, meaning it is directly executed by the Central Processing Unit.

# Should I use Assembly?

If you are creating a rather simple program, or function , then you should probably stick with Ti-Basic. But, if you are creating a more complex program, like a game, then you might want to consider Assembly. Because Assembly runs faster, your game will have better performance.

# Where can I start?

The two main types of assembly programs are either written directly in Assembly, or in a Compiled language, like C. A compiled language is translated into Assembly, making it easier to learn. However, programming directly in assembly gives you more control.

## I am a beginner at assembly

If you are a complete beginner, and have never written in C, or C++, then you should start out with C. C is easier to write, and runs just about as fast.

Start with the list of tutorials below:

## I have Programmed in C, or C++ before

I am completely familiar with the concepts of programming, and have had experience in a least one medium-low level language. This does NOT include C#, VB.NET, or JAVA, as these are considered high level languages.

Start with the list of tutorials below:

<< Saving Data |
Overview |
Dialogs >> |

This will host all of the google analytics data.

Date uploaded | Link |
---|---|

Jan 21, 2011 — Apr 19, 2011 | Google Analytics PDF |

Oct 25, 2010 — Jan 21, 2011 | Google Analytics PDF |

Jul 29, 2010 — Oct 25, 2010 | Google Analytics PDF |

May 2, 2010 — Jul 29, 2010 | Google Analytics PDF |

Mar 31, 2010 — Apr 30, 2010 | Google Analytics PDF |

Jan — March 30, 2009 | Google Analytics PDF |

Nov — March 30, 2009 | Google Analytics PDF |

Nov — Jan 30, 2009 | Google Analytics PDF |

Nov — Dec 21, 2008 | Google Analytics PDF |

Oct — Nov 9, 2008 | Google Analytics PDF |

This command turns off all or a group of functions.

FnOff *[optional function numbers]*

**Menu Location**

- Press F4 from the Homescreen to enter the OTHER menu.
- Press 8 to select the FnOff command.

This command works on all calculators.

The FnOff Command turns Graph functions off. The FnOff Command command can be used to clear the graph of any functions that the user has created before running any programs that might require the graph screen. The FnOff command can also be used to turn just one or a few functions off by stating the function number after the command FnOff:

```
:FnOn
:FnOff 2,3,4
```

The above code will turn on all functions, and then it will turn off only functions 2, 3, and 4. You can use this if you only want one or two functions to display, but you want all the functions entered so that they can be quickly graphed.

# Error Conditions

**260 - Domain error** happens when the optional function argument is not in the range 1-99.

# Related Commands

Apr |
23 — |
James Kanjo redesigned the Become a Member page so that it is easier for people to become members of the TI-Basic Developer community |

Okay, so the program works on mac. Well, almost. I still have to finish a few things, but since I can send byes on the mac side, I should be able to start with the main java wrapper. I still don't know about windows, though.

# The Ans token

## What is Ans?

Ans is a special variable that holds the value returned by the last expression or command. To understand the concept of the Ans we'll go to the main calculator screen and type a number:

```
:8
8
:Ans
8
```

Whenever an object (a variable or a list or a string …) appears in the right side of the Main screen it is assigned to Ans. Take a look at the next example:

```
:8
8
:Ans
8
:10
10
:Ans
10
:"HELLO"
HELLO
:Ans
HELLO
:{1,2,3}
{1,2,3}
:Ans
{1,2,3}
And so on...
```

As you can see the Ans can be everything. Now look at the next example:

```
:4→A
4
:Ans
4
```

So when you set a variable its value becomes the Ans, and in a program it works the same way.

## Why should I use Ans?

Basically the Ans command works like some kind of calculator cache. It is the last value assigned and because of how it is built it is faster to use the Ans (just like a computer gets data from the cache faster than from the main memory). So if I use an Ans command (when possible) instead, the program will process that information faster and the user will be happier.

## Some uses of the Ans:

Lets see the next example:

```
:Repeat Ans=21
:getkey
:If Ans
:Disp "A KEY WAS PRESSED
:If not(Ans
:Disp "NO KEY PRESSED
:End
```

In this example, the calculator tells the user whether a key is pressed or not. Let's have a closer look: The Repeat D=21 will execute the instructions underneath it until the Ans is equal to 21. The getKey command (we'll expand on that later) will check the key you are pressing and return the number equivalent to the key (if you are not pressing any it returns 0). Because the getKey value is stored in Ans, we do not need to use any other variables. So if Ans is different from 0, we display "A KEY WAS PRESSED." If it isn't different, we display "NO KEY PRESSED." Easy, huh?

Please note that Disp, along with some other functions, won't affect the value of the Ans command.

## More on the Subject

An in depth look at the Ans variable can be found here.

<< Loops |
Table of Contents |
Chapter Summary >> |

# Conditionals

Conditionals in TI-Basic are slightly different than other programming language's conditionals. The first thing you need to understand is that an If condition tests a number. So:

```
:If 0
This won't show up
:If 1
This will show up
:If 2
This will show up
```

When the If condition tests the 0 number it returns false, so the code underneath it won't be displayed. Now if the If comes across a 1, it returns true and executes the code that follows. Now you might be asking yourself "And what about the If 2?" well in every single programming language the 0 number is equivalent to false and all numbers but 0 are equivalent to true. So when you use an If condition you are testing if a number is 0 or not 0, if it is false or not false (true) and execute (or not) the instructions that follow.

But what about this:

```
:1->A
:If A=0
This won't show up
:If A=1
This will show up
:If A=2
This won't show up
```

Well in this case you may think the If statement isn't testing a number but a condition. Well you are wrong. Look at the following piece of code:

```
:1=1
1
:1=4
0
```

If you type the 1=1 in the main calculator screen you get a 1,meaning that it is true. If you type 1=4 you get a 0, it is false. So, what we can conclude is very simple: conditions return a number whether they are true or false. When comparing two numbers (or variables) the calculator will see if it is true or false and send a number: 0 if it is false; 1 if it is true; So as you can see, the calculator works an If condition by calculating the Something = Something condition, returns a number and if it is 1, executes the following code, if it is 0, it doesn't.

Now it makes sense doesn't it? That's why we talked about If 0 and If 1 in the beginning.

So this:

```
:1->A
:If 1
Do something
```

Is the same as this:

```
:If 1
Do something
```

Of course the first one can be false if you change the variable's value, but in this case it is all the same thing.

## Cool examples that use conditions

1. The best example of the use of conditions is the collision code located here: Collision. It uses conditions to know if the place the character is supposed to go is "walkable" or not.

2. Another rather cool example is the area calculator. You know that an area can't be negative so the program can't return a negative area. Take a look at the next example:

```
:Prompt A,B
:A*B->C
:If A>0 and B>0
:Then
:Disp C
:Else
:Disp 0
```

Looks good doesn't it? Well but it isn't. It is true that it correctly displays only positive areas but there's a simpler way of doing it:

```
:Prompt A,B
:AB(A>0 and B>0)->C
:Disp C
```

In this case, with only 3 lines of code we do the same thing as above and we save memory. Of course this may seem stupid because it only saves a few bits, but in a bigger game production the bits turn into bytes and then KiloBytes and the game becomes very big and unusable.

Lets just go through the code: The Prompt asks the user to give some input. Then it calculates A*B and multiplies it by the result of the condition (A>0 and B>0). So if both are greater then 0, then the condition returns 1 and C becomes A*B. If they aren't the condition returns 0 and C becomes 0. So there are no negative values!!

3. What if you want to know if a certain pixel of the screen is on? Lets see:

```
:45->X
:55->Y
:If pxl-Test(Y,X)
Do something
```

Using the pxl-Test( command and an If statement we get the job done!! The pxl-Test( returns a number (1 or 0) whether the pixel indicated between brackets is on or off.

## Some tips:

Conditions are very handy to test variables and stuff, but have to be used wisely. A very common mistake when using If conditions is forgetting the Then after the If and writing more than one line. See the next example:

```
:0->A
:1->B
:If A≠B
:Disp A
:Disp B
:End
```

WRONG… Here the Then command is missing so the calculator would return an error like: ERR: SYNTAX, because there was an extra End. Here's the correct way:

```
:0->A
:1->B
:If A≠B:Then
:Disp A
:Disp B
:End
```

And there you have it…

<< Logic Operations |
Table of Contents |
Loops Optimization >> |

Loops have various uses (we'll see them later), but basically loops are blocks of code that execute themselves a defined number of times. As you know there are 3 types of loops: the For( loop, the While( loop, and the Repeat( loop. These are very handy since your program ends when it reaches the end of the code, so if you are developing a game or so you need the code to flow correctly and execute over and over (for example for checking if you pressed a key and making your character walk).

# 101 Uses for Loops

While loops may not have exactly 101 uses, they are some of the most spectacular pieces of code that enable iterations to be made so that a game can constantly update itself or so a math program can perform a specific algorithm. The uses below represent only a few of the ways loops can be utilized.

## Time Delay

A loop can be seen by many perspectives but if you think that each instruction takes time to be processed you can think (correctly) that each loop takes time to execute its code even if it is an empty loop. Watch the following example:

```
:For(A,1,10)
:End
```

As you can see, there's nothing inside that For( loop but it still takes time to be executed. So you can use a For( loop as a method of making your program sleep. Think of this as a timed Pause that delays certain parts of the program. Later you'll see an application of this use.

**Note:** The use of rand can also achieve a time delay, and is considerably smaller. The only difference is that rand will update Ans, while this loop method will not.

## Game Iterations

Take a look at this example:

```
:Repeat K=21
...
Game instructions...
...
:End
```

In this case, the program will wait until the user presses the 2nd key, represented by K, otherwise it will keep the game running. You can include key press checkers, character movement, etc. See the next example:

```
:Repeat Ans=45
:A+sum(ΔList(Ans={25,34→A
:B+sum(ΔList(K={24,26→B
:getKey→K
:End
```

This loop is used to iterate a particular game function, in this case updating the coordinates of an object (A,B). Under certain conditions, it is actually beneficial to use the getKey as the last line of the code so that in the loop condition, Ans can be used, which may help speed the loop up.

## Drawing

Because loops execute instructions over and over with different numbers, they can be used to draw. Just watch:

```
:For(A,5,50
:Pxl-on(25,A
:End
```

This will draw a horizontal line between pixel 5 and pixel 50 and because of the way loops work, it will look like it is actually being drawn by somebody. This is different from using the Line( command, which makes the line appear instantaneously. Rather, this block writes each pixel one at a time, starting with (25,5), then (25,6), and so on. The next code block uses two loops together:

```
:For(A,5,50
:For(B,5,50
:Pxl-on(A,B
:End
:End
```

This code will draw a square. This time, when one line is drawn, the next line begins to be drawn, until each row is complete.

## Write Text

Writing text is relatively simple on the calculator. However, the calculator does it without any animation. Try the following code:

```
:ClrDraw
:"HELLO WORLD
:For(A,1,length(Ans
:Text(5,4A+5,sub(Ans,A,1
:End
```

This will write out each letter one at a time, as if it were being typed. The For( loop runs though each character in the string (which is Ans), and for each one, it types the letter in the next slot. However, this code is too fast. What other tool do we have…

```
:ClrDraw
:"HELLO WORLD
:For(A,1,length(Ans
:For(B,1,30
:End
:Text(5,4A+5,sub(Ans,A,1
:End
```

We can use the time delay from before! Using a For( loop, we can delay the program every iteration and thus overall slow down the process. Since we require Ans not to be updated, the For( loop delay works perfectly.

**Challenge:** Can you make a code that does the same as the above, but smaller?

# Tips

Try to not nest loops in a game. "What is a nested loop?" you may be asking: a nested loop is a loop inside a loop, for example:

```
:WHILE A=2
:REAPEAT B=2
:FOR (C,1,10)
:END
:END
:END
```

Sometimes they are the only way of doing things, like checking all the screen for on pixels or whatever, but if you want to execute the same instruction 5 times in a game, do it like this:

```
:1->A
:WHILE A=2
Game instructions...
:IF A>6:THEN
Your instructions
:A+1->A
:END
:END
```

And not:

```
:WHILE A=2
Game instructions...
:FOR (A,1,5)
Your instructions
:END
:END
```

Why? Because if you did so, you wouldn't be executing any instructions (like character walking or so) besides what's in the For( loop and your game flow would be ruined…

Have fun with loops!!

<< Conditionals |
Table of Contents |
Optimization: The Graph Screen >> |

Name: No name givenAuthor: No author givenDownload: Download UnavailableCompatibility: Parent page not setFile Size: No size given |
No description given |

Name: {$name}Author: {$author}Download: [{$downloadUrl} {$downloadName}]Compatibility: {$compatibility}File Size: {$size} |
{$description} |

Name: No name givenAuthor: No author givenDownload: Download UnavailableCompatibility: Parent page not setFile Size: No size given |
No description given |

Name: {$name}Author: {$author}Download: [{$downloadUrl} {$downloadName}]Compatibility: {$compatibility}File Size: {$size} |
{$description} |

Included page "inc:tablet2-backend" does not exist (create it now)

Name: {$name}Author: {$author}Download: [{$downloadUrl} {$downloadName}]Compatibility: {$compatibility}File Size: {$size} |
{$description} |

Determines whether an input is a number or list.

*Ans* - the number or list to examine

*Ans* - 1 if the input is a number, 0 if it is a list

A [,∟A if input is a string]

TI-83/84/+/SE

Deep Thought

```
:For(A,465230.61649186,465230.61649186
:Ans->A
:A=Ans(1
```

You can replace 465230.61649186 with any obscure and nearly impossible number.

If Ans is a list, it is stored to ∟A. A remains whatever that number is, and A=Ans(1 (assuming that Ans as a list has at least one value) returns false. If Ans is a number, it is stored into A, thus A=Ans(1 (Ans times 1) returns true.

The For( command is used to avoid updating Ans. End should be added to the end if this routine is used inside a larger program.

Here are a few tips on what to do next:

1- Get an idea for a game or an application. Try this website if you do not feel inspired: http://www.ticalc.org/programming/ideas/;

2- Try making it by following some of the articles writen in this website;

3- Optimize the code and add some cool menus and stuff;

4- Send it into your computer (you will require a usb link cable [usually comes with the calculator…] and this software: TI Connect);

5- Try protecting the code of your game/app, use this software: TI Graph link 83 - plus, open your file, check the protected box and save it;

6- Now create a zip file with your game/app files, a read me (with some instructions) and a screenshot (use the TI connect to accomplish it, it has a app included [the icon of a camera - when you open the program - in the main menu]);

7- Send it to the web to get some feedback, this website is good: http://www.ticalc.org/cgi-bin/file_upload.pl?a=1, or try including a link to a page in this website, where you include your game/app download;

Well, now off you go to the TI-BASIC Programming world, happy programming!

P.S. If you get really addicted to calculator programming, try learning "Assembly" to the calculator (the programming language of your application), just google it…

<< Review |
Table of Contents |
Project Ideas >> |

Simple homescreen menu without using the menu( command.

```
ClrHome
Disp ">OPTION 1"," OPTION 2"," OPTION 3 // note the spaces before OPTION 2 and OPTION 3
1->A
Repeat Ans=105
If Ans
Output(A,1," // one space
min(3,max(1,A+sum(List(Ans={25,34->A // the List has an implied delta sign (triangle) before it.
Output(A,1,">
getKey
End
If A=1
Disp "OPTION 1 ACTION
If A=2
Disp "OPTION 2 ACTION
If A=3
"OPTION 3 ACTION
```

Simple graphscreen menu.

```
ClrDraw
Horizontal Ymin
Horizontal Ymax
Vertical Xmax
Vertical Xmin
Text(-1,3,35,"MENU
Text(20,25,">OPTION 1
Text(26,29,"OPTION 2
Text(32,29,"OPTION 3
20->A
Repeat Ans=105
If Ans
Text(A,25," // Four spaces
min(32,max(20,Ans+6sum(List(Ans={25,34->A // The "List" has an implied delta (little triangle) before it.
Text(A,25,">
getKey
End
If A=20
Disp "OPTION 1 ACTION
If A=26
Disp "OPTION 2 ACTION
If A=32
"OPTION 3 ACTION
```

You can adjust the Text( values to determine what spacing you would like.

Mar |
11 — |
The archives have been upgraded to make uploading process much easier. |

facingtomorrow

6x9 connect four game skeleton

just like the real thing

includes graphics, animation, save/load game, resets settings on exit and 2 player gameplay

does not include AI or win checking

PLEASE REMOVE the following words that do NOT describe your program:

Arcade Graphics Puzzle Strategy Board Misc

http://tibasicdev.wikidot.com/local--files/challenges:25/scn.png

CONECTFR.zip

952 bytes

author: 'skwerlman (David Birnhak)'

description: 'This program looks at two waves of the form ASin(BX+C) and graphs their interference pattern.'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '1'

misc: '0'

image: '/archives:wave-interference-grapher/waveinterferencedemo(1).gif'

download: WAVES.zip

size: '235'

unit: '1'

Name: {$name}Author: {$author}Download: {$download}Compatibility: {$compatibility}File Size: {$size} |
{$description} |

Finds the **G**reatest **C**ommon **D**enominator

gcd(*int1*,*int2*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

The gcd( command is used, as its name implies, to find the greatest common denominator of two numbers.

```
:gcd(351,65)
returns 13
```

# Error Conditions

**260 - Domain error** happens when an argument is not real.

# Related Commands

Well, animation in any Ti basic program can be a problem, though 68k calculators have better capability for animations. There are a virtually unlimited number of picture names, and folders allow for even more possibilities. Due to the limitations of a calculator's basic graphics, the best way to animate is to use a series of pre-drawn pictures, displayed one after another. Even this has limitations, as the relatively slow refresh rate can make animations seem choppy. Also, each frame must be created individually, so animation design is very time-consuming. If anyone could please elaborate on this, it would be greatly appreciated.

<< Sprites |
Overview |
Compression >> |

author: EragonFreakMaster

description: 'Tools to help in your Geometry or Trigonometry class, solving anything to do with triangles.'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '1'

misc: '0'

image: /home/no_image_2.png

download: TrigTools.zip

size: '6223'

unit: '1'

The ▶Bin command converts numbers into binary.

*int*▶Bin

**Menu Location**

- [2nd]
- [Math]
- [up or E]
- [right]
- [4]

This command works on all calculators.

4 bytes

`▶Bin` converts an integer from decimal (base 10) or hexadecimal (base 16) into binary (base 2).

```
:15▶Bin
0b1111
:0h15▶Bin
0b10101
```

# Related Commands

Determines whether an input is a number or string.

*Ans* - the number or string to examine

*Ans* - 1 if the input is a number, 0 if it is a string

A, B [,∟A, ∟B if input is a string]

TI-83/84/+/SE

bfr

*URL:* [http://www.unitedti.org/forum/index.php?showtopic=9191]

```
:DelVar AFor(B,1,1
:Ans->A
:Ans->B
:A=B
```

If Ans is a string, it is stored to ∟A and ∟B. A remains 0, B remains 1, and A=B returns false. If Ans is a number, it is stored into both A and B, thus A=B returns true.

The For( command is used to avoid updating Ans. If this routine is used in a larger program and the input can be stored into a more permanent variable, For(B,1,1 can become 1->B. If this is not possible, the For( statement should have an End added.

Dec |
17 — |
Congrats to AJLitzau13 for winning Challenge 9! |

author: 'Kieran Berard'

description: 'This program guesses any whole number from 1-63. It will guess it on the first try…'

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '1'

image: '/archives:magic-mindz/Magic%20Mindz.gif'

download: Magic_Minds.zip

size: '4292'

unit: '1'

Draws a line between a set of two coordinates.

Line xStart, yStart, xEnd, yEnd, drawmode

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

X byte(s)

The `line` command draws a line between two points. By default, the drawing mode is set to 1, which draws the line normally, so it doesn't have to be included if drawing a regular line.

`Line 0, 3, 0, 9`

# Advanced Uses

The drawmode can be set to 0 to draw a "white" line, which will remove the pixels on the path of the line.

`Line 0, 3, 0, 9, 0 //removes the line`

You can also invert pixels on the line using -1 as the number argument.

`Line 0, 3, 0, 9, -1`

# Related Commands

- Creating graphics is done on the graph screen, not the home screen.
- On the graph screen, locations are given either as point or pixel coordinates.
- Pixel coordinates start with (0,0) at the top left corner, like on the homescreen, but increment in individual pixels.
- Point coordinates depend on the window dimensions.
- You can adjust the window dimensions by manipulating the window variables and/or by using the zoom commands.
- You can also use the format commands to turn the axes off and other related things.
- You can save the window dimensions, format options, and other related things in a GBD. (Graph Database)
- Once you have the graph screen set up, you can draw on it using the draw commands.
- You can erase the graph screen with the ClrDraw command, and you can save what is on the graph screen in a Pic.(Picture)
- Unfortunately Pics can only store the entire screen. They also don't force pixels that are already black to become white; sometimes this can be a good thing.
- One particularly creative and effective way to create sprites is known as the text sprite method.This involves overlapping text to create sprites quickly.

# Commands Introduced

- StorePic, RecallPic, StoreGDB, RecallGDB
- Pxl-On(, Pxl-Off(, Pxl-Change(, Pxl-Test(, Pt-On(, Pt-Off(, Pt-Change(
- ZStandard, ZInteger, FnOff, FnOn, AxesOn, AxesOff
- Horizontal, Vertical, Line(, Circle, DrawF, DrawInv, Tangent(, Shade(, Text(

<< Using Pictures |
Table of Contents |
Chapter Exercises >> |

…that if you have a rather bulky matrix or list, you can store it as a string to one of the sequence variables, *u,v,w* and halve the size? Then, you can evaluate the expression using said variable and `Ans(X)` where X equals the list or matrix element you want?

*IsLocked* checks if a variable is locked.

```
o->var1
lock var1
islocked var1
true
unlock var1
islocked var1
false
```

Checks to see if a variable is archived

isArchiv(*variable*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

X byte(s)

The `isArchiv()` command checks if a variable is archived.

```
0->var1
Archive var1
IsArchiv var1
true
UnArchiv var1
IsArchiv var1
false
```

# Related Commands

Converts a number to a base-16 number.

*integer*▶Hex

**Menu Location**

MATH/base

This command works on all calculators.

2 bytex

The `▶Hex` command takes an integer and converts it to hexadecimal, including the prefix "0h". Here is an example program.

```
15›Hex
//returns F
16›Hex
//returns 10
0b10000›Hex
//returns 20
```

# Related Commands

The *Disp* command displays output in the Home App I/O screen.

```
prgmexmp()
Prgm
Request "Enter something",var1 © Get a value for var1
Disp "var1="&string(var1)
Pause
DelVar var1
ClrIO
DispHome
EndPrgm
```

Unarchives a given variable

Unarchiv *variable*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

The `Unarchiv` command removes a variable from the flash ROM.

```
Prgm
© //assuming var1 and var2 are actual variables
Archive var1,var2
isArchiv(var1)→check
Disp check
Pause
Unarchive var1,var2
Disphome
EndPrgm
```

# Related Commands

Locks a given variable

Unlock *variable1*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 byte(s)

The `Unlock` command unlocks locked variables. It is paired with the `Lock` command.

```
lock var1,var2
unlock var1,var2
```

# Related Commands

Locks the specified variables

Lock *var1, var2, etc*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

X byte(s)

The `lock` command prevents a variable's value from changing. In programs and functions, `lock` is usually used to stop a variable from undesirably changing. If a variable is universally defined (like files in folders), the `lock` command has a popular purpose of making the variable constant (unchanging) throughout use in sets of programs.

```
input "Input var1 here: ",var1
lock var1
text "You can no longer change var1."
© var1 can now be used as a constant variable.
©... <program statements that require the value of var1>
prgm2() ©var1 may not change in any other programs.
unlock var1
```

Note: the © command will turn any code written until the next ':' into comments. (neat-freaks love this.)

Comments are very helpful for people who forget, especially when dealing with tricky commands and code. Using comments for the

*lock*command will help you remember to

*unlock*the variable when the time comes to delete it.

# Related Commands

ztrumpet

Oasis is a basic shell that runs basic programs.

Oasis uses Celtic III (included).

PLEASE REMOVE the following words that do NOT describe your program:

Utility Misc

http://tibasicdev.wikidot.com/local--files/archives:oasis/Oasis.gif

Oasis.zip

2751

This program identifies whether a number is prime.

NOTE: This program does not display a correct result for 0, 1, or 2, which are special cases.

PROGRAM: PRIME

:ClrHome

:Prompt X

:1→Y

:For(P,2,√(X)+1)

:If fPart(X/P)*P=0

:Then

:P→Y

:Goto E

:End

:End

:Lbl E

:If Y≠1

:Then

:Disp X

:Disp "Composite"

:Disp "Divisible by"

:Disp Y

:End

:If Y=1

:Then

:Disp X

:Disp "Is prime"

:End

(If you plan to copy and paste this string of code into a program editor remember to remove the colons.)

author: ztrumpet

description: "Oasis is a basic shell for your calculator that will run basic programs.\nYou must have Celtic III (included) to run Oasis."

arcade: '0'

graphics: '0'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '1'

misc: '1'

image: '/archives:oasis/Oasis.gif'

download: Oasis.zip

size: '2751'

unit: '1'

As proven there is very much intrested in this project. One on the main things to get clear is: Who joins? so far:

Matthias1992 (Me)

Sleight

author: Sleight

description: 'A 3D engine that draws rectangular prisms (any size, solid or transparent) on the graph screen using pseudo-one-point perspective. Also includes Cubes, a simple program that shows what it is capable of.'

arcade: '0'

graphics: '1'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '0'

sports: '0'

casino: '0'

board: '0'

utility: '1'

misc: '0'

image: '/archives:prisms/Prism.png'

download: PRISMS.8xp

size: '473'

unit: '1'

author: 'Roy S.'

description: 'A calculator version of the famous card game: BlackJack. Graphical, fully operational.'

arcade: '0'

graphics: '1'

platform: '0'

puzzle: '0'

rpg: '0'

strategy: '1'

sports: '0'

casino: '1'

board: '0'

utility: '0'

misc: '0'

image: '/archives:blackjack/SCREEN01.gif'

download: BJACK.8xp

size: '5488'

unit: '1'

Member

Member

Member

Joined Oct 26 — |
Is Stranger does not match any existing user name |

**Time Zone**: *Not given*

Outputs the number corresponding to a keypress.

*None*

*Ans* - The number pressed.

TI-83/84/+/SE

Unknown, Toothless the Night Fury

```
:Repeat Ans≤9
:Repeat Ans
:getKey
:End
:Ans(102≠Ans)-13int(Ans/13(2>abs(5-abs(5-abs(Ans-83
:End
```

The routine waits for a key that corresponds to a number 0-9. All magic is on the lengthy line.

An alternate method to this is an adaptation of the Key Code to Letter routine, written below. Both methods share very extremely fast speeds, but the alternate method uses slightly more bytes. However, it does have the advantage of converting keycodes to strings instead of numbers, has the added period, and can be easily converted to numbers (through expr) if needed (unlike the other way around).

```
:Repeat Ans>71 and min(Ans≠{75,81,85,91,95
:getKey
:End
:sub("789 456 123 0.",Ans-36-5int(.1Ans),1
```

# Modifications

- You can delete the :Repeat Ans<=9 :End loop to not wait
- Delete the (102≠Ans) if you don't need the 0 number
- Fixed from "Outputs the letter corresponding to a keypress." to "Outputs the number."
- Added alternate method and general cleanup.

# Error Conditions

None known.

# Related Routines

Outputs a letter corresponding to a keypress.

*None*

*Ans* - the letter as a string

TI-83/84/+/SE

Weregoose

*URL:* Weregoosepage

```
:Repeat Ans>34 and min(Ans≠{44,45,105
:getKey
:End
:sub("ABC**DEFGHIJKLMNOPQRSTUVWXYZθ'* :?",Ans-5int(.1Ans+4),1
```

The Repeat loop makes sure good input is passed.

The last line takes from the string the letter according to the keycode.

# Error Conditions

None.

# Related Routines

author: ztrumpet

description: "Drifter is a game in which you slide until you hit an object.\nThere are many pieces that you will come in contact with that change the direction you're going.\nCollect all the +s and/or numbers 1-9 then reach the flag to win.\nDrifter includes 16 levels and a custom level editor for endless hours of fun."

arcade: '1'

graphics: '0'

platform: '0'

puzzle: '1'

rpg: '0'

strategy: '1'

sports: '0'

casino: '0'

board: '0'

utility: '0'

misc: '0'

image: '/archives:drifter/drifter-video.gif'

download: drifter.zip

size: '11056'

unit: '1'

An efficient OS that lets you run and manage TI-Basic programs and get calculator information. It also has the option to use a USB mouse to control the cursor onscreen.

PLEASE REMOVE the following words that do NOT describe your program:

Utility

http://tibasicdev.wikidot.com/local--files/challenges:23/IlliniOS.gif

IlliniOS.zip

2,642 or 2,836 bytes

Recalls a picture variable and the graph screen at *[row][, column]*

RclPic *picVar*,*[row][, column]*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

This command is used to recall (open) a picture you have saved on your calculator. This is normally used in programs, because you can open pictures from the graph when you are not running a program. It is very useful for sprites as well, as it can recall a picture variable on top of a background, without deleting any of the background. In a program, however, you can recall a different picture for a different input, as shown below:

```
:If a=16
:RclPic 2
:Else
:RclPic 3
```

# Error Conditions

**260 - Domain error** happens when the *[row][,column]* argument is outside the screen range..

**960 - Undefined variable** happens when the picture variable specified does not exist..

# Related Commands

# See Also

Creates a custom menu

**Menu Location**

Describe how to get the command from a menu.

This command works on all calculators.

2 bytes

Similar to the Menu( command, the DropDown is used in a dialog box to make body text that includes a dropdown menu, with multiple options. This is good for use in text RPGs or game menus where a dialog box already exists and there isn't a need for another box. Look at this code for example:

```
:Dialog
:DropDown "Do you like food?", {"Yes", "No"}, t
:EndDlog
```

This will create a window with the title as "Do you like food" and the options as "Yes" and "No". "T" corresponds to the choice you selected For example, if you chose "Yes", the "T" would be equal to 1. However, if you pressed "No", then "T" would be equal to 2. Basically, the value of your chosen variable will correspond to the choice you made in the window.

# Error Conditions

**730 - Missing start or end of block syntax** happens when the command isn't put between a Dialogue/EndDlog block.

# Related Commands

# Credits

Credits to an unknown user (who's account got deleted). He/she created the code and the first paragraph of the explanation.

Sep |
28 — |
Archives have been redesigned. |

Changed the name of the game to [Technica: Clash of the Forces]. It's a completely different game from what I originally had. Get ready for this one; work starts after documentation is finished.

Returns the absolute value of an argument.

abs(*expression*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press 2 to select abs(.

This command works on all calculators.

The `abs()` command returns the absolute value of an expression. The absolute value of a real number is the number of units from 0 the number is. The absolute value of 7 for example is 7 becasue it is that many units away from zero. The absolute value of -7 however is 7. So it in a way gets rid of the negative.

The absolute value of a complex or imaginary number can also be taken, but it is done a little differently. If a complex number is written a+b*i*, then the absolute value of the number is √(a^{2}+b^{2}).

```
abs(5)
5
abs(-5)
5
abs(3+4i)
5
```

# Related Commands

`Negation`(^{-})

Timothy

## Do not process this dummy program!

This is a test for the new system. I want to see what errors out and what doesn't.

New line.

PLEASE REMOVE the following words that do NOT describe your program:

Platform Misc

http://tibasicdev.wikidot.com/local--files/home/no_image_2.png

Unavailable

1024 bytes

Oh my goodness. No wonder TI-Connect is so horrible. It's the calculators fault. Turns out, that to get one variable, you have to get a directory listing of every single one!!!! (That is to say, that I am working on it…)

Member

So I finally found a free USB logger, and could see the data sent/received. Yay!!! This project continues!!!

I have been busy with things, but this projects is not dead. I am trying to see the variable data from a transfer. If you have a program that can do that, would you just do the variable A as 267193, recieve it from your calc, then send it back, and send me what bytes were sent to/received from the calc. This is for USB btw.

Sets the current time on the calculator's clock, returning the previous time setting.

setTime(*hours*,*minutes*,*seconds*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command requires a calculator with AMS version 2.07 or higher (it will also work on any TI-89 Titanium or Voyage 200 calculator)

3 bytes

The setTime() command changes the time of day on the calculator's clock (give it the new time in hours, minutes, and seconds, in that order). The value it returns is the previous time setting, as a list of {*hours*,*minutes*,*seconds*}.

setTime() respects the current time zone: if you set the time to 8 AM, it will change the time to 8 AM in the time zone you're using, not necessarily to 8 AM GMT. Make sure to change the time zone before you set the time, if you plan to do both, or you'll get the wrong result.

The calculator measures time starting from 00:00 GMT on January 1, 1997. Although setDate() will reject any date earlier than that, with a combination of setTime() and setTmZn() you might actually end up with an earlier time than that. If this happens, the calculator keep counting the time correctly, but return a time of 00:00 GMT until it reaches a normally valid time.

A final quirk of setTime() is that it affects the output of startTmr() and checkTmr(). So if you're timing a section of your program, and use setTime() in the middle of that section, the time lapse will get thrown off.

# Error Conditions

**40 - Argument error** happens when an invalid time is given.

# Related Commands

Member

Member

@import url(http://static.wikidot.com/common--theme/co/css/style.css?0); .code { font-size: 105%; } .hidden-collapsible .collapsible-block-link { text-decoration:none; } .hover {color: #3B4;} .hover span {display: none;} .hover:hover span { position: absolute; display: inline; margin: 15px -20px; height: auto; max-width: 200px; background: #FFF; border: 2px solid #34B; color: #000; padding: 1em; } .menu .show { display: none; z-index: 9; } .default .show { display: block; z-index: 8; } .menu:hover .show { display: block; } .infobox{ color: #FFFFFF; } .infobox a{ color: #FFFFFF; } .blink, .blink a { text-decoration: blink; } #header { background: #202817; min-width: 800px; width:expression(document.body.clientWidth < 800? "800px" : "auto"); } #header h1 { padding: 0; margin: 0; width: 800px; //735px; //789px; height: 69px; background: #141B0C; background-image: url(http://tibasicdev.wikidot.com/local--files/logo/Logo10C.PNG); } #header h1 a { padding: 0; margin: 0 320px 0 8px; width: 472px; //721px; //735px; //789px; height: 69px; display: block; } #header h1 span { display: none; } #top-bar { top: 69px; height: 21px; min-width: 976px; padding: 0; background-color: #5C634D; border-bottom: 2px solid #5C634D; } #top-bar a, #top-bar li ul li a { background-color:#5C634D; } #top-bar a:hover, #top-bar li ul li a:hover { background-color:#5C634D; } #side-bar { min-width: 185px; } .special-collapsible .collapsible-block-unfolded .collapsible-block-link { font-weight: bold; padding-left: 0em; } .special-collapsible a { margin: 0; padding-top: 2px; padding-bottom: 2px; display: block; padding-left: 1em; border-bottom: 1px solid #BBBEAB; border-top: 1px solid #D2D3C6; color: #1E2B31; text-decoration: none; } #header h2 { display: none; } #license-areas { color: #E9DCE7; background: #5C634D; } #license-areas a { color: #E9DCE7; background: #5C634D; } table.charmap { background: white; border: #999 solid 1px; border-spacing: 2px; padding: .3em; table-collapse: collapse; } table.charmap tr td { text-align: center; } .wd-editor-toolbar-panel li.hseparator { background: url('http://tibasicdev.wikidot.com/local--files/home/toolbar-separator.png'); width: 22px; height: 22px; margin: 1px; } @media print { #print-head,#page-info, #license-area,#print-footer { display: none !important; } div#page-content:after { text-align: center; width: auto !important; display: block !important; margin: 2em 0 0; clear: both !important; padding-top: .5em; border-top: 1px solid #000; content: "TI-Basic Developer © 2006-2009 — \"A wiki for the TI-Basic beginner and advanced alike!\""; } } .taby .yui-navset .yui-nav a, .taby .yui-navset .yui-navset-top .yui-nav a{ background:#FFF; border:1px solid #AAA; } .taby .yui-navset .yui-nav .selected a, .taby .yui-navset .yui-nav .selected a:focus, .taby .yui-navset .yui-nav .selected a:hover { background:#F4F4F4; color:#222; border:1px solid #AAA; } .taby .yui-navset .yui-nav a:hover, .taby .yui-navset .yui-nav a:focus { background:#EEEEEE; } .taby .yui-content{ background:transparent; border:none; } .taby .yui-navset .yui-nav { border: 0; } #footer{ background:#5C634D; border-color: #141B0C; } body{ background:#E5E9D2; } #side-bar{ background:#C6C9AD; } #side-bar li a{ border-bottom: 1px solid #BBBEA7; border-top: 1px solid #D2D3C2; }

Aug |
27 — |
James Kanjo made the site's CSS theme dynamic. You can manipulate the Site Theme or the Forum Theme without Administrator privileges and with instantaneous results. |

@import url(http://static.wikidot.com/common--theme/co/css/style.css?0); .code { font-size: 105%; } .hidden-collapsible .collapsible-block-link { text-decoration:none; } #search-top-box, #login-status { margin-right: 4em !important; } .chars{ position: absolute; top: 0; right: 0; z-index: 999; } .chars2{ position: fixed; top: 0; right: 0; z-index: 1000; } .chars, .chars2 { text-align: center; border: 1px solid #999; padding: 0; margin: 0 0 0 0; background: #f7f7f7; font-family: Trebuchet MS, Trebuchet, Verdana, Arial, Helvetica; } .infos:after { float: right; content: "→∟‾×√Σ≠≥≤πΔχ▶ֿ¹²³L₁L₂L₃L₄L₅L₆≅ℕºθ÷±∠∞♦⇧∫∏©"; } .pages-list { margin: 0.5em 0; padding: 0; display: block; } .pages-list div.pages-list-item { margin: 0; padding: 0; display: block; } .pages-list-item div.title { margin: 0; padding: 0; } .pages-list div.pages-list-item a { margin: 0; padding-top: 2px; padding-bottom: 2px; padding-left: 1em; color: #1E2B31; display: block; border-bottom: 1px solid #BBBEAB; border-top: 1px solid #D2D3C6; text-decoration: none; } .pages-list div.pages-list-item a:hover { background: #D1D3C3; } .infobox{ color: #FFFFFF; } .infobox a{ color: #FFFFFF; } #header { background: #OC141B; min-width: 800px; width:expression(document.body.clientWidth < 800? "800px" : "auto"); } #header h1 { padding: 0; margin: 0; width: 800px; //735px; //789px; height: 69px; background: #OC141B; background-image: url(http://tibasicdev.wikidot.com/local--files/logo/Logo10B.PNG); } #header h1 a { padding: 0; margin: 0 320px 0 8px; width: 472px; //721px; //735px; //789px; height: 69px; display: block; } #header h1 span { display: none; } #top-bar { top: 69px; height: 21px; min-width: 976px; padding: 0; background-color: #4D5C63; border-bottom: 2px solid #4D5C63; } #top-bar a, #top-bar li ul li a { background-color:#4D5C63; } #top-bar a:hover, #top-bar li ul li a:hover { background-color:#4D5C63; } #side-bar { min-width: 185px; } #header h2 { display: none; } #license-area { display: none !important; } table.charmap { background: white; border: #999 solid 1px; border-spacing: 2px; padding: .3em; table-collapse: collapse; } table.charmap tr td { text-align: center; } .wd-editor-toolbar-panel li.hseparator { background: url('http://tibasicdev.wikidot.com/local--files/home/toolbar-separator.png'); width: 22px; height: 22px; margin: 1px; } @media print { #print-head,#page-info, #license-area,#print-footer { display: none !important; } div#page-content:after { text-align: center; width: auto !important; display: block !important; margin: 2em 0 0; clear: both !important; padding-top: .5em; border-top: 1px solid #000; content: "TI-Basic Developer © 2006-2009 — \"A wiki for the TI-Basic beginner and advanced alike!\""; } } .werecode{ font-family: 'Andale Mono', 'Courier New', Courier, monospace; font-size: 9pt; color: #11119C; } .ti83{ font-family: Ti83pc,'Andale Mono','Courier New',Courier,monospace; border-left:3px dotted #000; background:#EEE; padding-left:3px; color:#367A4B; margin:3px 2em 5px 1em; } .nspire{ background: #FFF; border: 1px dashed #DDD; padding-left:1em; margin: 1em 0 1em 0; font-family:'Arial Unicode MS',verdana,arial,helvetica,sans-serif; color: #222; letter-spacing:1.2pt; }

@import url(/common--theme/co/css/style.css); @import url(/local--code/css:archive); @import url('http://css.wikidot.com/cssnippet:inline-hovertips/code_'); .code { font-size: 105%; } .comments-box .code { max-height: 300px; overflow: auto; } .hidden-collapsible .collapsible-block-link { text-decoration:none; } .hover {color: #3B4;} .hover span {display: none;} .hover:hover span { position: absolute; display: inline; margin: 15px -20px; height: auto; max-width: 200px; background: #FFF; border: 2px solid #34B; color: #000; padding: 1em; } .menu .show { display: none; z-index: 9; } .default .show { display: block; z-index: 8; } .menu:hover .show { display: block; } .infobox{ color: #FFFFFF; } .infobox a{ color: #FFFFFF; } .blink, .blink a { text-decoration: blink; } #header { background: #172028; min-width: 800px; width:expression(document.body.clientWidth < 800? "800px" : "auto"); } #header h1 { padding: 0; margin: 0; width: 800px; //735px; //789px; height: 69px; background: #OC141B; background-image: url(http://tibasicdev.wikidot.com/local--files/logo/Logo10B.PNG); } #header h1 a { padding: 0; margin: 0 320px 0 8px; width: 472px; //721px; //735px; //789px; height: 69px; display: block; } #header h1 span { display: none; } #top-bar { top: 69px; height: 21px; min-width: 976px; padding: 0; background-color: #4D5C63; border-bottom: 2px solid #4D5C63; } #top-bar a, #top-bar li ul li a { background-color:#4D5C63; } #top-bar a:hover, #top-bar li ul li a:hover { background-color:#4D5C63; } #side-bar { min-width: 185px; } .special-collapsible .collapsible-block-unfolded .collapsible-block-link { font-weight: bold; padding-left: 0em; } .special-collapsible a { margin: 0; padding-top: 2px; padding-bottom: 2px; display: block; padding-left: 1em; border-bottom: 1px solid #BBBEAB; border-top: 1px solid #D2D3C6; color: #1E2B31; text-decoration: none; } #header h2 { display: none; } #license-areas { color: #E7E9DC; background: #4D5C63; } #license-areas a { color: #E7E9DC; background: #4D5C63; } table.charmap { background: white; border: #999 solid 1px; border-spacing: 2px; padding: .3em; table-collapse: collapse; } table.charmap tr td { text-align: center; } .wd-editor-toolbar-panel li.hseparator { background: url('http://tibasicdev.wikidot.com/local--files/home/toolbar-separator.png'); width: 22px; height: 22px; margin: 1px; } @media print { #print-head,#page-info, #license-area,#print-footer { display: none !important; } div#page-content:after { text-align: center; width: auto !important; display: block !important; margin: 2em 0 0; clear: both !important; padding-top: .5em; border-top: 1px solid #000; content: "TI-Basic Developer © 2006-2009 — \"A wiki for the TI-Basic beginner and advanced alike!\""; } } .taby .yui-navset .yui-nav a, .taby .yui-navset .yui-navset-top .yui-nav a{ background:#FFF; border:1px solid #AAA; } .taby .yui-navset .yui-nav .selected a, .taby .yui-navset .yui-nav .selected a:focus, .taby .yui-navset .yui-nav .selected a:hover { background:#F4F4F4; color:#222; border:1px solid #AAA; } .taby .yui-navset .yui-nav a:hover, .taby .yui-navset .yui-nav a:focus { background:#EEEEEE; } .taby .yui-content{ background:transparent; border:none; } .taby .yui-navset .yui-nav { border: 0; } .werecode{ font-family: 'Andale Mono', 'Courier New', Courier, monospace; font-size: 9pt; color: #11119C; } .ti83{ font-family: Ti83pc,'Andale Mono','Courier New',Courier,monospace; border-left:3px dotted #000; background:#EEE; padding-left:3px; color:#367A4B; margin:3px 2em 5px 1em; } .nspire{ background: #FFF; border: 1px dashed #DDD; padding-left:1em; margin: 1em 0 1em 0; font-family:'Arial Unicode MS',verdana,arial,helvetica,sans-serif; color: #222; letter-spacing:1.2pt; } .Infobox{ background: #FDFCF6; border: 1px solid #8D9CA3; font-size: 120%; width: auto; padding: 10px; } .image-box-heading{ background: #4D5C63; color: #E7E9DC; } /* Teletype */ .tt { font-weight: 900; } /* Data Forms */ .form-table .form-value {display: inline-block;}

Name: Mix 'n MatchAuthor: Maarten JanssenDownload: Mix 'n MatchCompatibility: Parent page not setFile Size: 3020 bytes |
Mix 'n Match is a Bejeweled type of game where you need to match at least three adjacent tiles of the same type and try to make cascading matches to score points. |

Takes the hyperbolic cosecant of a number.

csch(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 4 to select csch(.

This command requires a calculator with AMS version 2.07 or higher (it will also work on any TI-89 Titanium or Voyage 200 calculator)

1 byte

The `csch()` command returns the hyperbolic cosecant of a number. Along with 11 other trig and hyperbolic functions, it was added in AMS version 2.07; on earlier versions, `csch(x)` can be replaced by 1/`sinh(x)`.

As long as the calculator is in radian mode, `csch()` can be used with complex numbers according to the rule that csch(** i**x)=-csc(x)

*****and csc(

*i***x)=-csch(x)**

*i******. This rule only works in radian mode, and

*i*`csch()`of a complex number will return a domain error when working in degrees or gradians.

Occasionally, `csch()` can compute an exact result; most of the time, the calculator will leave an expression with `csch()` alone unless it's in approximate mode (or you force an approximation). When `csch()` is used with symbolic expressions, the calculator can go back and forth between the `csch()` expression and its exponential equivalent.

```
:csch(0)
undef
:expand(csch(x))
1/(e^x+1)+1/(e^x-1)
:comDenom(1/(e^x+1)+1/(e^x-1))
1/sinh(x)
```

If `csch()` is applied to a list, it will take the hyperbolic cosecant of every element in the list. However, it can't be applied to matrices the way `sinh()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Formulas

The definition of hyperbolic cosecant is, by analogy with `csc()`, the reciprocal of `sinh()`:

# Error Conditions

**260 - Domain error** happens when taking `csch()` of a complex number in degree or gradian mode.

# Related Commands

Takes the hyperbolic secant of a number.

sech(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 5 to select sech(.

1 byte

The `sech()` command returns the hyperbolic secant of a number. Along with 11 other trig and hyperbolic functions, it was added in AMS version 2.07; on earlier versions, `sech(x)` can be replaced by 1/`cosh(x)`.

As long as the calculator is in radian mode, `sech()` can be used with complex numbers according to the rule that `sech(ix)`=

`sec(x)`and

`sec(`=

**x)***i*`sech(x)`. This rule only works in radian mode, and

`sech()`of a complex number will return a domain error when working in degrees or gradians.

Occasionally, `sech()` can compute an exact result; most of the time, the calculator will leave an expression with `sech()` alone unless it's in approximate mode (or you force an approximation). When `sech()` is used with symbolic expressions, the calculator can go back and forth between the `sech()` expression and its exponential equivalent.

```
:sech(0)
1
:expand(sech(x))
2*e^x/((e^x)^2+1)
:comDenom(2*e^x/((e^x)^2+1))
1/cosh(x)
```

If `sech()` is applied to a list, it will take the hyperbolic secant of every element in the list. However, it can't be applied to matrices the way `cosh()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Formulas

The definition of hyperbolic secant is, by analogy with `sec()`, the reciprocal of `cosh()`:

# Error Conditions

**260 - Domain error** happens when taking sech() of a complex number in degree or gradian mode.

# Related Commands

Takes the hyperbolic cotangent of a number.

coth(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 6 to select coth(.

1 byte

The `coth()` command returns the hyperbolic cotangent of a number. Along with 11 other trig and hyperbolic functions, it was added in AMS version 2.07; on earlier versions, `coth(x)` can be replaced by 1/`tanh(x)`.

As long as the calculator is in radian mode, coth() can be used with complex numbers according to the rule that coth(** i**x)=-cot(x)

*****and cot(

*i***x)=-coth(x)**

*i******. This rule only works in radian mode, and

*i*`coth()`of a complex number will return a domain error when working in degrees or gradians.

Occasionally, `coth()` can compute an exact result; most of the time, the calculator will leave an expression with `coth()` alone unless it's in approximate mode (or you force an approximation). When `coth()` is used with symbolic expressions, the calculator can go back and forth between the `coth()` expression and its exponential equivalent.

```
:coth(0)
undef
:expand(coth(x))
-1/(e^x+1)+1/(e^x-1)+1
:comDenom(1-2/((e^x)^2+1))
1/tanh(x)
```

If `coth()` is applied to a list, it will take the hyperbolic cotangent of every element in the list. However, it can't be applied to matrices the way `tanh()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Formulas

The definition of hyperbolic cotangent is, by analogy with `cot()`, the ratio of `cosh()` and `sinh()`:

# Error Conditions

**260 - Domain error** happens when taking `coth()` of a complex number in degree or gradian mode.

# Related Commands

Takes the hyperbolic tangent of a number.

tanh(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 3 to select tanh(.

This command works on all calculators.

1 byte

The tanh() command returns the hyperbolic tangent of a number.

As long as the calculator is in radian mode, tanh() can be used with complex numbers according to the rule that tanh(** i**x)=tan(x)

*****and tan(

*i***x)=tanh(x)**

*i******. This rule only works in radian mode, and tanh() of a complex number will return a domain error when working in degrees or gradians.

*i*Occasionally, tanh() can compute an exact result; most of the time, the calculator will leave an expression with tanh() alone unless it's in approximate mode (or you force an approximation). When tanh() is used with symbolic expressions, the calculator can go back and forth between the tanh() expression and its exponential equivalent.

```
:tanh(0)
0
:expand(tanh(x))
1-2/((e^x)^2+1)
:comDenom(1-2/((e^x)^2+1))
tanh(x)
```

If tanh() is applied to a list, it will take the hyperbolic tangent of every element in the list.

# Advanced Uses

The tanh() of a matrix is not (in general) the same as taking the hyperbolic tangent of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Formulas

The definition of hyperbolic cotangent is, by analogy with tan(), the ratio of sinh() and cosh():

(1)# Error Conditions

**230 - Dimension** happens when taking tanh() of a matrix that isn't square.

**260 - Domain error** happens when taking tanh() of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking tanh() of a matrix that isn't diagonalizable.

# Related Commands

Takes the hyperbolic sine of a number.

sinh(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 1 to select sinh(.

This command works on all calculators.

1 byte

The sinh() command returns the hyperbolic sine of a number.

As long as the calculator is in radian mode, sinh() can be used with complex numbers according to the rule that sinh(** i**x)=sin(x)

*****and sin(

*i***x)=sinh(x)**

*i******. This rule only works in radian mode, and sinh() of a complex number will return a domain error when working in degrees or gradians.

*i*Occasionally, sinh() can compute an exact result; most of the time, the calculator will leave an expression with sinh() alone unless it's in approximate mode (or you force an approximation). When sinh() is used with symbolic expressions, the calculator can go back and forth between the sinh() expression and its exponential equivalent.

```
:sinh(0)
0
:expand(sinh(x))
e^x/2-1/(2*e^x)
:comDenom(e^x/2-1/(2*e^x))
sinh(x)
```

If sinh() is applied to a list, it will take the hyperbolic sine of every element in the list.

# Advanced Uses

The sinh() of a matrix is not (in general) the same as taking the hyperbolic sine of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Formulas

The definition of hyperbolic sine is given in terms of exponents:

(1)# Error Conditions

**230 - Dimension** happens when taking sinh() of a matrix that isn't square.

**260 - Domain error** happens when taking sinh() of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking sinh() of a matrix that isn't diagonalizable.

# Related Commands

Takes the hyperbolic cosine of a number.

cosh(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press C to enter the Hyperbolic submenu.
- Press 2 to select cosh(.

This command works on all calculators.

1 byte

The `cosh()` command returns the hyperbolic cosine of a number.

As long as the calculator is in radian mode, `cosh()` can be used with complex numbers according to the rule that cosh(** i**x)=cos(x) and cos(

**x)=cosh(x). This rule only works in radian mode, and**

*i*`cosh()`of a complex number will return a domain error when working in degrees or gradians.

Occasionally, `cosh()` can compute an exact result; most of the time, the calculator will leave an expression with `cosh()` alone unless it's in approximate mode (or you force an approximation). When `cosh()` is used with symbolic expressions, the calculator can go back and forth between the `cosh()` expression and its exponential equivalent.

```
:cosh(0)
1
:expand(cosh(x))
e^x/2+1/(2*e^x)
:comDenom(e^x/2+1/(2*e^x))
cosh(x)
```

If `cosh()` is applied to a list, it will take the hyperbolic cosine of every element in the list.

# Advanced Uses

The `cosh()` of a matrix is not (in general) the same as taking the hyperbolic cosine of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Formulas

The definition of hyperbolic cosine is given in terms of exponents:

(1)# Error Conditions

**230 - Dimension** happens when taking `cosh()` of a matrix that isn't square.

**260 - Domain error** happens when taking `cosh()` of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking `cosh()` of a matrix that isn't diagonalizable.

# Related Commands

Member

Pauses the program until ENTER is pressed, optionally displaying text on the I/O screen.

:Pause [*expression*]

**Menu Location**

Starting in the program editor:

- Press F2 to enter the Control menu.
- Press 8 to enter the Transfers submenu.
- Press 1 to select Pause.

This command works on all calculators.

3 bytes

Used by itself without parameters, `Pause` temporarily suspends the program until the ENTER key is pressed, displaying an indicator to that effect in the lower right corner of the screen. When ENTER is pressed, the program continues running from the next command in order.

`Pause` can also be given any expression as a parameter. In this case, it will display the expression on a new line on the Program I/O screen (just like `Disp`), and then pause the program as above. Unlike `Disp`, however, it can only display one thing.

# Optimization

Make sure to give Pause an argument if using it with Disp:

```
:Disp x
:Pause
can be
:Pause x
```

# Related Commands

Takes the factorial of a number.

*number*!

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

1 byte

The ! operator takes the factorial of a number: for a positive, whole number, n! is defined as n*(n-1)*(n-2)*…*3*2*1. As a special case, 0! is defined to be 1.

The factorial has a special meaning in combinatorics: n! is the number of ways you can order n objects. For instance, 3!=6 because there are 6 ways to order 3 objects:

- A B C
- A C B
- B A C
- B C A
- C A B
- C B A

As can be expected, factorials get very large very quickly. The calculator can only compute an exact integer result for factorials up to 299!, and an approximate result for factorials up to 449!. Beyond that, the numbers involved are replaced by ∞ (infinity) in expressions.

While there are some formulas to define factorials of non-integer values, the calculator doesn't use them. It will leave an expression like (1/2)! unsimplified. However, the factorial of a number less than or equal to -1 will be "undef".

```
:5!
120
:299!
1020191707388... (600 more digits)
:449!
3.85193e997
:(-2)!
undef
```

# Related Commands

# See Also

Used in entering a vector in polar, cylindrical, or spherical format, or a complex number in polar form.

[*r*,∠*θ*]

[*r*,∠*θ*,*z*]

[*r*,∠*θ*,∠*φ*]

(*r*∠*θ*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 2 to enter the Angle submenu.
- Press 7 to select ∠.

This command works on all calculators.

1 byte

The ∠ operator is used for alternate forms of entering vectors or complex numbers. It will be used for output depending on the Complex Format and Vector Format mode settings, but you can always use it in an expression.

For vectors (which are just 1x2 or 1x3 matrices, as far as ∠ is concerned):

- [r,∠θ] is equivalent to [r*cos(θ),r*sin(θ)]
- [r,∠θ,z] is equivalent to [r*cos(θ),r*sin(θ),z]
- [r,∠θ,∠φ] is equivalent to [r*cos(θ)*sin(φ),r*sin(θ)*sin(φ),r*cos(φ)]

These have to be row vectors — you can't use column vectors with ∠.

For complex numbers, (r∠θ) is equivalent to r*(cos(θ)+* i**sin(θ)). You have to have the parentheses there, and both r and θ must be real numbers or expressions.

# Error Conditions

**260 - Domain error** happens when complex numbers are used in the vector notation.

**580 - Invalid polar complex** happens when the values of r and θ in the complex number notation are invalid.

**640 - Invalid vector syntax** happens when the ∠ mark is misplaced in the vector notation.

# Related Commands

Divides a number by 100.

*number*%

**Menu Location**

- Press 2nd CHAR to enter the CHAR menu.
- Press 3 to enter the Punctuation submenu.
- Press 5 to select %.

This command works on all calculators.

1 byte

The % operator is a cheap shortcut for dividing a number by 100: for instance, 25% = 25/100 = 1/4. When used on a list or matrix, it divides every element by 100.

It's somewhat higher in priority than regular division, so you don't need parentheses as often with it: for instance, 4^50% is equal to 4^(1/2)=2, not to (4^50)%.

# Related Commands

# See Also

Takes the square root of a number.

√(*number*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

1 byte

The √() command takes the square root of a value: √(x) is a number that, when multiplied by itself, gives x. It's a special case of the ^ and root() commands: √(x) = x^(1/2) = root(x,2).

Unless the calculator is in approximate mode, or you force it to approximate (by pressing ♦+ENTER, or using approx()), it won't try to evaluate all square roots: it will take the square root of perfect squares, otherwise, it will just take out all the square factors (for instance, √(20) is simplified to 2√(5)).

For positive numbers, √() will return the positive square root; more generally, if the result is complex (and if the calculator is in complex number mode), the result of √() will be the one with non-negative real part.

```
:√(16)
4
:√(-12)
2*√(3)*i
```

If the square root of a list is taken, it will take the square root of every element of the list.

# Advanced Uses

The √() of a matrix is not (in general) the same as taking the square root of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Error Conditions

**230 - Dimension** happens when taking the square root of a non-square matrix.

**665 - Matrix not diagonalizable** happens when diagonalization (used to take square roots of matrices) fails.

**800 - Non-real result** happens when taking the square root of a negative or complex number, in real number mode.

# Related Commands

Raises a value to a power, doing this element-by-element for matrices.

*base* .^ *exponent*

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 1 to select .+.

…frankly, just typing it is way easier.

This command works on all calculators.

1 byte

The .^ operator is generally the same as ^, except when dealing with matrices. While ^ does quite a lot of matrix-specific stuff (check out its page for more information), .^ just applies it element-by-element:

```
:[a,b;c,d] .^ 2
[a^2 b^2]
[c^2 d^2]
```

The command can handle any choice of matrix and scalar as the base and exponent. However, if you're raising a constant number to a matrix power, be careful that the dot in .^ is not confused for a decimal point, by adding extra spaces:

```
:2.^[a,b;c,d]
Error: Data type
:2 .^ [a,b;c,d]
[2^a 2^b]
[2^c 2^d]
```

Although this doesn't come up often, be aware that .^, like ^, is evaluated from right to left: a.^b.^c is calculated as a.^(b.^c), not as (a.^b).^c.

# Error Conditions

**240 - Dimension mismatch** happens when a matrix is raised to the power of another matrix, with different dimensions.

# Related Commands

# See Also

Divides two values, doing so element-by-element for two matrices.

*value* ./ *value*

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 4 to select ./.

…frankly, just typing it is way easier.

This command works on all calculators.

1 byte

The ./ operator works just like / in most cases. The only exception is with matrices. The / command can't do anything with then (except for dividing a matrix by a value), but ./ will just apply the operation element-by-element. Obviously, when this is done for two matrices, their dimensions have to match up.

```
:[a,b;c,d] ./ [e,f;g,h]
[a/e b/f]
[c/g d/h]
```

When dividing a constant number by a matrix with ./, you may need to space it out so that there's no confusion between ./ and a decimal point.

```
:1./[a,b;c,d]
Error: Data type
:1 ./ [a,b;c,d]
[1/a 1/b]
[1/c 1/d]
```

# Error Conditions

**240 - Dimension mismatch** happens when dividing a matrix by another matrix of a different size.

# Related Commands

# See Also

Multiples two values, using element-by-element multiplication for two matrices.

*value1* .* *value2*

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 3 to select .*.

…frankly, just typing it is way easier.

This command works on all calculators.

1 byte

In most cases, .* does the same thing as *. The difference only applies to multiplying two matrices. Whereas * uses the linear-algebra definition (see its article for details), .* does the simple thing and multiplies the matrices element by element (obviously, they must match in size for this to work).

```
:[1,2;3,4] .* [a,b;c,d]
[a 2*b]
[3*c 4*d]
```

# Error Conditions

**240 - Dimension mismatch** happens when the matrices being multiplied don't match in size.

# Related Commands

# See Also

Subtracts two values, using element-by-element subtraction when subtracting a matrix and a number.

*value1* .- *value2*

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 2 to select .-.

…frankly, just typing it is way easier.

This command works on all calculators.

1 byte

The .- command works like plain - in most cases, taking the difference of two values. It's distinguished by its application to matrices: in particular, when subtracting a matrix and a scalar (in either order). Normally, the operation will be done along the main diagonal only: as though the value were multiplied by the identity matrix. However, .- does the more intuitive thing (for anyone but an algebraist, anyway) and subtracts the value from every element of the matrix (or, if the matrix is being subtracted, subtracts every element from the scalar value).

```
:[a,b;c,d]-x
[-x+a b ]
[c -x+d]
:[a,b;c,d].-x
[-x+a -x+b]
[-x+c -x+d]
```

It doesn't really make much sense to use .- to add other kinds of values, but you can do it if you like.

When subtracting a matrix from a constant number, be warned that the . may be interpreted as a decimal point. You can put spaces to help the calculator figure out what you mean.

```
:5.-[a,b;c,d]
[-a+5. -b ]
[-c -d+5.]
:5 .+ [a,b;c,d]
[-a+5 -b+5]
[-c+5 -d+5]
```

# Related Commands

Adds two values, using element-by-element addition when adding a matrix and a number.

*value1* .+ *value2*

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press 4 to enter the Matrix submenu.
- Press K to enter the Element ops submenu.
- Press 1 to select .+.

…frankly, just typing it is way easier.

This command works on all calculators.

1 byte

The .+ command works like plain + in most cases, adding two values together. It's distinguished by its application to matrices: in particular, when adding a matrix and a scalar. Normal addition of a matrix and a single value will add that value along the main diagonal only: as though the value were multiplied by the identity matrix. However, .+ does the more intuitive thing (for anyone but an algebraist, anyway) and adds the value to every element of the matrix.

```
:[a,b;c,d]+x
[x+a b ]
[c x+d]
:[a,b;c,d].+x
[x+a x+b]
[x+c x+d]
```

It doesn't really make much sense to use .+ to add other kinds of values, but you can do it if you like.

Although the order of the matrix and the scalar doesn't matter, be warned that in some cases, the . will be interpreted as a decimal point. You can put spaces to help the calculator figure out what you mean.

```
:5.+[a,b;c,d]
[a+5. b ]
[c d+5.]
:5 .+ [a,b;c,d]
[a+5 b+5]
[c+5 d+5]
```

# Related Commands

Negates an expression.

‾*expression*

**Menu Location**

Press the ‾ key to enter ‾.

This command works on all calculators.

1 byte

The ‾ operator gives the negative of the value immediately following it. It's not to be confused with the - operator, which subtracts two numbers — while on paper you'd generally use the same symbol for -2 and 4-2, the calculator has two different symbols, and negation is represented by the slightly shorter and higher dash.

You can also use ‾ to negate lists and matrices, which will negate each element, as expected.

```
:1+‾1
0
:‾(x-1)
‾x+1
:‾[1,2;3,4]
[‾1 ‾2]
[‾3 ‾4]
```

Other pages on this site will use - to mean both subtraction and negation, where it isn't confusing.

# Related Commands

# See Also

Marks the rest of the line (in a program) as a comment.

:*line of code* © *comment*

**Menu Location**

Starting in the program editor:

- Press F2 to enter the I/O menu.
- Press 9 to select ©.

This command works on all calculators.

4 bytes (+ length of comment)

The © character is used for adding comments in a program: everything after © is ignored by the calculator for the purposes of actually running the program, so it's a good way to make a note to yourself about what a part of your code does. This is especially helpful if you're going to be reading the program later when you don't quite remember what you were doing.

```
:If ok=0 © If the user pressed ESC
: Stop
```

There are other situations you might use comments in. For instance, you might make a rough sketch of your program and add comments about the code that has yet to be filled in:

```
:If key=264 Then
: © add a confirmation dialog here later
: Exit
:EndIf
```

Yet another use of © is to "comment out" lines of code that you might need later, but want to ignore for now — this is better than deleting the code, since you don't have to rewrite it later.

# See Also

Adds an item to a Custom or ToolBar menu.

Item *text* (with Custom)

Item *text*,*label* (with ToolBar)

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 1 to enter the Dialog submenu.
- Press 8 to select Item.

This command works on all calculators.

3 bytes

The Item command is used in Custom..EndCustm and ToolBar..EndTBar blocks (both of which create toolbar menus) to add an option to one of the tabs. See these commands for more details on how to use it.

Inside a Custom..EndCustm menu, the correct syntax is Item *text* (*text* being a string). This will display *text* for the menu option, and also paste *text* every time the option is selected.

Inside a ToolBar..EndTBar menu, the correct syntax is Item *text*,*label*. This will, as in the previous case, display *text* for the menu option; when the option is selected, the program will resume running from Lbl *label*.

# Error Conditions

**130 - Argument must be a string** happens when the option text isn't a string.

**500 - Invalid label** happens when the label doesn't exist (in this program), when the option is selected.

# Related Commands

Sets the default date format.

setDtFmt(*format-number*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

3 bytes

The setDtFmt() sets the default format for dates: this format is used in the top right corner of the Apps Desktop, and also as the format for the output of getDtStr() (when it's used without a parameter to override this setting).

The eight possible formats each have a number associated to them, which is the number you should pass to setDtFmt(). It will return the number of the previous setting, which is convenient if you want to restore it later.

The eight formats are as follows (dd, mm, and yy are the date, month, and year respectively, in two digits)

Format Number | Date Format |
---|---|

1 | "mm/dd/yy" |

2 | "dd/mm/yy" |

3 | "mm.dd.yy" |

4 | "dd.mm.yy" |

5 | "yy.mm.dd" |

6 | "mm-dd-yy" |

7 | "dd-mm-yy" |

8 | "yy-mm-dd" |

Typically, you'd only use this command in a program if you needed to use getDtStr() many times with the same format. In that case, save the return value of setDtFmt(), and use it to restore the date format at the end of the program.

# Error Conditions

**40 - Argument error** happens when the format number is not an integer in the range 1-8.

# Related Commands

Returns the current default date format.

getDtFmt()

**Menu Location**

This command can't be found in any menu besides the command catalog.

3 bytes

The getDtFmt() returns the number of the current default date format for getDtStr() (that is, the format that getDtStr() with no parameters will use). This same format is also used to display the time in the corner of the Apps Desktop.

The eight formats are as follows (dd, mm, and yy are the date, month, and year respectively, in two digits)

Format Number | Date Format |
---|---|

1 | "mm/dd/yy" |

2 | "dd/mm/yy" |

3 | "mm.dd.yy" |

4 | "dd.mm.yy" |

5 | "yy.mm.dd" |

6 | "mm-dd-yy" |

7 | "dd-mm-yy" |

8 | "yy-mm-dd" |

In a program, it's usually unnecessary to use getDtFmt(). Most of the time, you'll just use getDtStr() with a format already specified; in the rare exceptions where you need to use getDtStr() a lot with the same format, you'd use setDtFmt() to pick the format you want, save the result, and use it to restore the date format at the end of the program.

# Related Commands

Returns the current date in a string.

getDtStr([*format*])

**Menu Location**

This command can't be found in any menu besides the command catalog.

3 bytes

The getDtStr() command returns the current date in a string. The date can be in one of eight formats, numbered from 1 to 8. This format can be given to getDtStr() directly: for instance, getDtStr(5) will return the date in the fifth format. Or, you can set a default format with the setDtFmt() command, and getDtStr() will use that format when it's not given a specific format to use.

The eight formats are as follows (dd, mm, and yy are the date, month, and year respectively, in two digits)

Format Number | Result of getDtStr() |
---|---|

1 | "mm/dd/yy" |

2 | "dd/mm/yy" |

3 | "mm.dd.yy" |

4 | "dd.mm.yy" |

5 | "yy.mm.dd" |

6 | "mm-dd-yy" |

7 | "dd-mm-yy" |

8 | "yy-mm-dd" |

Formats 5 and 8 are useful in that if you store dates in either of those format, sorting the strings will sort the dates in chronological order.

# Error Conditions

**40 - Argument error** happens when the date format given is not an integer 1-8.

# Related Commands

Choosing a good variable name is important. The calculator gives you eight characters of freedom in choosing a variable name, which can be put to good use by describing the purpose of the variable, or it can be wasted by naming the variable "bobby".

Choosing good variable names helps you when you're writing the program, because then you'll be less likely to forget which variable does what. When you're done writing it, it helps other people looking at the program for whichever reason, even if it's just curiosity. Unfortunately, there's a powerful incentive to stick to short variable names: it can reduce the program size a lot, since referring to a variable called "n" takes 1 byte, and referring to a variable called "numusers" takes 10 bytes. Whether readability or size is more important is up to you, but at the very least you should stick to descriptive names when you're still writing the program.

This article has three sections. The first section describes the characters that can make up a variable name. In the second section, you'll learn about some special variable names that the calculator will treat differently. Finally, the third section contains some tips on how to choose a good name for a variable.

# Possible Variable Names

A variable name can have between 1 and 8 characters in it. Of the 255 possible characters (see Character Codes), only some can be used in variable names:

- Obviously, the letters a-z. These are case-insensitive: the calculator can't tell between the names "anumber", "aNumber", and "AnUMbEr".
- The numbers 0-9. These can't
*begin*a variable name, since something like 1xyz is interpreted as 1*xyz, but they're fine anywhere else. - International characters, like Ç or Þ. These are also case-insensitive, in the cases where there's an uppercase and a lowercase variant.
- Greek letters (except for π, which is a constant). These are case sensitive: Ω is not the same variable as ω, even though they're both the same letter (omega).
- The underscore, _. This one's a bit weird, for reasons you'll see in the next section. It can't be used by itself as a single-character variable, and if it's the first character in the name, then it can't appear again: a_b_c will be treated as a single variable, but _a_b will be broken up as the product _a*_b.

Of course, the built-in commands and system variables are excluded from variable names, since their meaning is already defined.

# Special Variable Names

In order from least to most interesting:

**The one-letter variables a-z**- stand out because they only take one byte to access (normally, you need (# of characters + 2) bytes, so 3 bytes for Ω and 10 bytes for varomega). They also get deleted by NewProb and by the relevant menu option on the home screen.
**kbdprgm1() through kbdprgm9()**- can be quickly accessed by pressing ♦ (the diamond key) and the corresponding number, as long as they are defined to be programs. On the TI-89 Titanium and Voyage 200, kbdprgm7() and kbdprgm9() get hijacked, since ♦+7 and ♦+9 are the shortcuts to entering log( and root( respectively. Otherwise, ♦+# will run kbdprgm#() immediately, without even entering it on the home screen.
**Variables ending in _**- are assumed to be complex by math commands. Normally, an undefined variable is assumed real: for instance, real(x) returns x, and imag(x) returns 0. This isn't done for, say, x_. The most useful application for this is when solving for a variable with solve() or cSolve().
**Variables beginning with _**- are user-defined units (suitable for use with ▶, setUnits(), and getUnits()). More importantly, you don't have to use them as units, but they do transcend folders. If you store 5 to _x, then _x will return 5 no matter what the current folder is, until you delete it. The drawback is that these variables can't store functions or programs.

# Choosing Appropriate Names

Good variable names don't have to be long. In fact, there are situations completely unsuited to long variable names. If you're defining a simple function, a good name for its input is just x. And the variable inside a seq() command doesn't need to be long, considering that it's only relevant for one line. In general, long descriptive names are unnecessary if the variable is only going to be around for a short while.

For some particular cases, there's a traditionally used variable name. For instance, the index variable of a For..EndFor loop is usually named i (if there's a second loop inside it, you might name it j). The result of getKey() may be called key or k.

It's always good if the variable name has some indication of its type. This is especially important for list variables, because optimized code for lists looks the same as optimized code for numbers, and in the code :x+1→x it's unclear if x is a number or a list. This is also important for the arguments of a function, since these are the first place you'd look to figure out how to use the function. It's unclear to use a function defined as getindex(a,b) — something like getindex(list,item) is better.

For coordinates on screen, use (x,y) coordinates for point commands (e.g. PtOn) and (row,column) coordinates for pixel commands (e.g. PxlOn). If you have a pair of variables for the coordinates, make sure to indicate which coordinate is which: for instance, shipx and shipy, or shipr and shipc. This does several jobs at once: it shows that the variables are paired, which variable is which, and which type of coordinate is being used.

For subroutine names, using verbs is helpful: there's little doubt about what a routine called findmax() or drawmenu() does. If a function returns a truth value, model it off commands such as isPrime() and isClkOn() — there's no doubt about which option is true, and which is false. If you're trying to tell red things apart from blue things, isblue() is a better name than chkcolor().

For the most part, the variable name is only a question of style. However, there are several cases in which the user of the program gets to see the name of a variable. In such cases, you should take extra care to make sure that the variable name makes sense. These cases are:

- When asking for a value with Prompt. In general, this makes sense if you're entering the values of variables in a known equation: When solving for x in x=a*sin(2πω), you might as well name the variables x, a, and ω, and ask for their values. If it's not clear what a variable name means, use Input instead.
- When using icons in a ToolBar menu. On a TI-89 or TI-89 Titanium, the icon will not show up: the name of the picture variable will, instead. Since it's possible your program might one day end up on one of those calculators, make the icon names helpful.
- The program name itself. It's hard to think of something snappy and memorable in 8 characters, but this goes a long way to making the program usable.

Checks if the hardware clock is turned on.

isClkOn()

**Menu Location**

This command can't be found in any menu besides the command catalog.

3 bytes

The isClkOn() command checks if the calculator's clock (which is used by most time and date commands) is running or stopped. The result of isClkOn() is a truth value — true if the clock is on, and false if the clock is off — which makes it perfect for a condition in commands such as If:

```
:If isClkOn() Then
: Disp "Clock is running."
:Else
: Disp "Clock is stopped."
:EndIf
```

The isClkOn() command, though useful, isn't often called for. For instance, there's no need to check if the clock is on if you're planning to turn it on anyway:

```
:If not isClkOn()
: ClockOn
should just be
:ClockOn
```

One use for isClkOn() is in functions, which aren't allowed to change the global status of the calculator with commands like ClockOn or ClockOff. Instead, you might do the next best thing, and return an error message if the clock is turned off.

# Related Commands

Turns on the hardware clock.

ClockOn

**Menu Location**

This command can't be found in any menu besides the command catalog.

2 bytes

The `ClockOn` command turns on the calculator's clock, used by most time and date commands. Only when the clock is on, will the value returned by `startTmr()`, `getTime()`, and other commands actually change with the passage of time. If you write a program that uses any of these commands, be sure to include this command at the beginning of the program.

Since it modifies the global status of the calculator, `ClockOn` can't be used inside a function. If you're writing a function that depends on measuring time (so you need the clock to be on), the best thing you can do is use the `isClkOn()` command to check if the clock is on or off, and return an error message if it's off.

# Error Conditions

**450 - Invalid in a function or current expression** happens when `ClockOn` is used in a function.

# Related Commands

Turns off the hardware clock.

ClockOff

**Menu Location**

This command can't be found in any menu besides the command catalog.

2 bytes

The `ClockOff` Command turns off the calculator's clock as far as the time and date commands are concerned: that is, the timer used by `startTmr()`, `getTime()`, and other commands will not keep updating every second, but will stay the same until the clock is turned on again.

It's not usually a good idea to use this in a program: there's no real benefit to doing so (it doesn't make the calculator run faster or anything like that) but there's the real drawback that it throws off the calculator's time. However, the mere existence of this command means that you should probably use `ClockOn` anytime you need to use the time and date commands.

Since it modifies the global status of the calculator, `ClockOff` can't be used in a function.

# Error Conditions

**450 - Invalid in a function or current expression** happens when `ClockOff` is used inside a function.

# Related Commands

Takes the integral of an expression.

∫(*expression*,*variable*)

∫(*expression*,*variable*,*constant*)

∫(*expression*,*variable*,*lower*,*upper*)

**Menu Location**

Press [2nd][7] to enter ∫(.

This command works on all calculators.

2 bytes

∫(*expression*,*variable*) takes the integral of *expression* (symbolically) with respect to *variable*. All other variables are treated as constant.

There are three ways to use ∫(). The syntax above returns an indefinite integral. ∫(*expression*,*variable*,*c*) does the same, but with a constant of integration, *c* (this will just get added on to the result). Finally, ∫(*expression*,*variable*,*a*,*b*) takes a definite integral from *a* to *b*. These limits can be anything, including undefined variables, ∞ and -∞, as long as they don't depend on *variable*.

```
:∫(x^2,x)
x^3/3
:∫(x^2,x,c)
x^3/3+c
:∫(x^2,x,a,b)
b^3/3-a^3/3
```

Indefinite integrals are always computed exactly or not at all: if a part of the expression (or the entire expression) can't be integrated, the result will stay in terms of ∫(). However, definite integrals will sometimes be approximated, depending on the Exact/Approx mode setting:

- If EXACT, integrals will never be approximated.
- If AUTO, the calculator will approximate integrals like ∫(
*e*^(-x^2),x,-1,1) that it can't compute exactly. - If APPROX, all definite integrals will be done numerically if possible.

```
:∫(e^(-x^2),x)
∫(e^(-x^2),x)
:∫(e^(-x^2),x,-1,1)
2*∫(e^(-x^2),x,0,1) (in EXACT mode)
1.49365 (in AUTO or APPROX mode)
```

Finally, you can take multiple integrals by applying ∫() to the result of another ∫() (any number of times). The integration limits of the inner integrals can involve the variables of the outer integrals.

```
:∫(∫(x*y,x),y)
y^2*x^2/4
:∫(∫(x*y,x,0,y),y,0,1)
1/8
```

If the expression is a list or matrix, ∫() takes the integral of each element.

# Error Conditions

**140 - Argument must be a variable name** happens when the variable of integration isn't a variable.

**220 - Dependent limit** happens when the integration limits depend on the variable of integration.

# Related Commands

Aug |
09 — |
The entire TI-Basic Developer has 1664 total pages today. |

Asks for a value to be typed in on the I/O screen.

Input [*prompt*,]*variable*

Input

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 3 to select Input.

This command works on all calculators.

3 bytes

Input *prompt*, *variable* displays *prompt* (which should be a string) on a new line on the Program I/O screen, then waits for the user to type in an expression on the next line. Whatever is typed in is then stored to *variable*. You can leave out the *prompt* part to just have the prompt be a question mark.

Note that whatever is typed in will be interpreted very literally: you'll need { } brackets to enter a list, quotes to enter a string, and so on. If you do want to enter a string, InputStr is probably a better choice.

Prompt is a special case of Input: Prompt *variable* works just as Input does, with *variable*? (the variable name, and a question mark) as the prompt.

If there's an error (for example, a syntax error) in the line that got typed in, the calculator will display the appropriate error message, and ask for the line to be typed in again: the program will continue running as usual. The calculator can even be turned off while Input is running; when it's turned back on, it will continue waiting for input, and then the program will still continue running.

# Advanced Uses

Another use of Input is without any parameters at all: Input by itself will display a cursor on the graph screen, and wait until a point is selected (the cursor can be moved left and right as usual, and a point is selected by pressing ENTER).

You can find out which point was selected by using the xc and yc system variables (xc is the x-coordinate, and yc is the y-coordinate). The Coordinates graph setting determines other behavior:

- If it's set to RECT, the values of xc and yc will be displayed at the bottom of the screen when the point is being selected.
- If it's set to POLAR, the polar coordinates will be stored to system variables rc and θc (in addition to the regular coordinates). The values of rc and θc will be displayed while the point is being selected.
- If it's set to OFF, no coordinates will be displayed (although xc and yc will still contain the resulting coordinate).

If Input is located inside a Try..EndTry block, and the ON key is pressed, the "Break" error will be caught (one of the only times this happens). If you're a nice person, you can use this to add code to exit quietly (without an error message) when ON is pressed. If you're not a nice person, you can use this to create an infinite loop you can't use ON to break out of.

# Related Commands

Aug |
08 — |
Milestone: 100 command pages have been written (Goal: to finish them all by November) |

Supplies the title text in one of several types of menus.

Title *text*

or (with ToolBar only)

Title *text-or-icon*[,*label*]

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 1 to enter the Dialog submenu.
- Press 7 to select Title.

This command works on all calculators.

3 bytes

The Title command is used in different ways with several types of menus:

- Inside a Dialog..EndDlog block, it gives the title text for the dialog.
- Inside a ToolBar..EndTBar or Custom..EndCustm block, it gives a title for a tab.

Usually, all that the Title command wants is a string that will be used for the title (the string() command might be useful for other data types). The exception is ToolBar: then, if the tab has no options under it, Title should also have a label to jump to when that tab is selected.

# Advanced Uses

On the widescreen calculators (the TI-92, TI-92 Plus, and Voyage 200), a Toolbar tab can have a picture for a title (the result will look like the F1 tab of the default toolbar menu). To do so, create a 17x17 picture to be used as the icon, and use the picture variable in place of the tab's title string. If this syntax is used on a TI-89 or TI-89 Titanium calculator, the name of the variable will be displayed instead of the icon (the check for the picture size is still done, and will cause an error if it's the wrong size).

# Error Conditions

**120 - Argument must be a Pic or string** happens when the title text is the wrong data type (in a toolbar).

**130 - Argument must be a string** happens when the title text is the wrong data type (in a dialog).

**230 - Dimension** happens when the icon (in a toolbar) is the wrong size.

**530 - Invalid outside Dialog..EndDlog, Custom..EndCustom, or Toolbar..EndTBar blocks** happens when Title is used by itself, outside a menu declaration.

# Related Commands

# See Also

Creates a toolbar menu and waits for input.

:ToolBar

(list of titles and items)

:EndTBar

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 1 to enter the Dialog submenu.
- Press 6 to select ToolBar..EndTBar.

This command works on all calculators.

2 bytes for ToolBar;

2 bytes for EndTBar.

A ToolBar..EndTBar block, usable only inside a program, displays a custom toolbar menu in place of the usual toolbar, and immediately asks for one of the options to be selected. Selecting an object transfers program flow to a label somewhere else in the program.

The toolbar menu can have up to eight tabs (on certain models, there is no upper limit, i.e. TI-92), which correspond to the F1-F8 keys, with any number of options under each tab, or none at all. These are defined by putting the Title and Item commands inside the ToolBar..EndTBar block.

The Title command indicates a new tab, so you can have up to eight of these. After Title, put a string to be displayed for the tab. If the tab doesn't have any options under it, you should also add a label that selecting this tab will jump to.

The Item command indicates an option under the most recent tab — you can have as many items as you like, or none at all. As with Title, you should give Item a name (which will be displayed as the option) and a label that the program will jump to if the option is selected.

Here is an example of the syntax:

```
:ToolBar
: Title "Animals"
: Item "Dog",lab1
: Item "Cat",lab2
: Title "Rocks",lab3
: Title "Plants"
: Item "Grass",lab4
: ...
:EndTBar
```

In this case, the custom toolbar will display | F1 Animals | F2 Rocks | F3 Plants | … |. Pressing F1 would bring up the Animals menu with items 1:Dog and 2:Cat. Then, pressing 1 or ENTER would continue the program from Lbl lab1. Pressing F2 would immediately jump to Lbl lab3, since that tab has no items.

A related command is Custom..EndCustm. It also creates a toolbar menu, but one that's intended for use as a custom menu outside a program.

# Advanced Uses

On the widescreen calculators (the TI-92, TI-92 Plus, and Voyage 200), a tab can have a picture for a title (the result will look like the F1 tab of the default toolbar menu). To do so, create a 16x16 (e.g.[0,0;15,15])picture to be used as the icon, and use the picture variable in place of the tab's title string. If this syntax is used on a TI-89 or TI-89 Titanium calculator, the name of the variable will be displayed instead of the icon (the check for the picture size is still done, and will cause an error if it's the wrong size).

# Error Conditions

**230 - Dimension** happens when an icon is used of the wrong size.

**450 - Invalid in a function or current expression** happens when ToolBar..EndTBar is used in a function.

**480 - Invalid in ToolBar..EndTBar block** happens when any command other than Title or Item is used inside the block.

**590 - Invalid syntax block** happens when the syntax is somehow wrong (e.g. an item has no label).

# Related Commands

Indicates that a number is written in hexadecimal.

0h*digits*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The calculator can work with numbers written in three bases: decimal (the usual), binary, and hexadecimal. The 0h command indicates that a number is written in hexadecimal:

```
:0h10
16
:0h2F6
758
```

When written in hexadecimal, numbers are expressed as signed 32-bit integers (32 bits correspond to 8 hexadecimal digits), which means that only the integers between -2^{31} and 2^{31}-1 can be expressed in hexadecimal. With other hexadecimal-related commands, numbers are simply truncated to fit in this range. Not so with 0h: if you enter more than 8 hexadecimal digits after the 0b, the result is a domain error.

Even if the calculator is in hexadecimal mode, you still have to write 0h for an integer to be interpreted as hexadecimal: the mode setting only affects output. If the calculator is in decimal mode, which is the default, you have to use ▶Hex to get output in hexadecimal.

# Error Conditions

**260 - Domain error** happens when 0h is used with more than 8 hexadecimal digits after it.

# Related Commands

Indicates that a number is written in binary.

0b*digits*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The calculator can work with numbers written in three bases: decimal (the usual), binary, and hexadecimal. The 0b command indicates that a number is written in binary:

```
:0b101
5
:0b100000
32
```

When written in binary, numbers are expressed as signed 32-bit integers, which means that only the integers between -2^{31} and 2^{31}-1 can be expressed in binary. With other binary-related commands, numbers are simply truncated to fit in this range. Not so with 0b: if you enter more than 32 binary digits after the 0b, the result is a domain error.

Even if the calculator is in binary mode, you still have to write 0b for an integer to be interpreted as binary: binary mode only affects output. If the calculator is in decimal mode, which is the default, you have to use ▶Bin to get output in binary.

# Error Conditions

**260 - Domain error** happens when 0b is used with more than 32 binary digits after it.

# Related Commands

Converts an expression from one unit to another.

*expression*▶*units*

**Menu Location**

Press [2nd][▶] to enter ▶: this is

- [2nd][MODE] on a TI-89 or TI-89 Titanium
- [2nd][Y] on a TI-92, TI-92 Plus, or Voyage 200

This command works on all calculators.

2 bytes

The ▶ operator converts an expression to a different unit. Usually, this refers to the built-in units (such as _m (meters), _mph (miles per hour, etc.) which you can select from the UNITS menu.

To use it, you must first have the expression on the left in terms of some unit — this is done by multiplying it by that unit. For instance, "5 meters" is written as 5_m or 5*_m (where _m is the unit). You can combine units as well: for instance, 5_m^2 (5 square meters) or 30_km/_hr (30 kilometers per hour).

To convert that into a different unit, type ▶ and then a different unit to convert to (again, you can combine units). For instance, to convert 5 square meters to acres, type 5_m^2▶_acre. (Note: the result will always be expressed as a decimal)

```
:30_km/_hr▶_m/_s
8.33333*_m/_s
:5_N▶_dyne
500000.*_dyne
```

You can't use ▶ to convert between units of temperature (degrees Celsius to degrees Fahrenheit, for instance), since the calculator isn't sure if you mean absolute temperature or a change in temperature instead. Use the tmpCnv() and ΔtmpCnv() commands instead.

# Advanced Uses

It's possible to define your own units as well: units are just any variable beginning with an underscore, and ▶ will perform just as well converting between those. There are two ways to go about it. The first is to define your units in terms of existing ones: for instance, you might define a furlong (one-eighth of a mile) as follows:

```
:1/8_mi→_furlong
1/8*_mi
:110_yd▶_furlong
.5*_furlong
```

The second method is to start with a unit or several units to keep undefined (for instance, _x). You can then define other units in terms of _x, and convert between them:

```
:5_x→_y
5*_x
:3_y▶_x
15.*_x
:10_x/_s▶_y/_s
2.*_y/_s
```

Units are treated just like variables, except that they're universal across folders: you can have only one instance of _x, and you can access it as _x no matter which folder you're in. You can use this if you want to define a universal variable to access in any folder: for instance, if you define a program as _prgm(), you can run it with _prgm() from any folder.

# Error Conditions

**345 - Inconsistent units** happens when converting between two units that measure different types of quantities (for instance, converting length to time).

# Related Commands

# See Also

Joined Aug 6 — |
guoguo12 does not match any existing user name |

**Time Zone**: *Not given*

Returns the integer part of a number.

iPart(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press 4 to select iPart(.

This command works on all calculators.

1 byte

The iPart() command returns the integer part of a number (removing all the digits after the decimal). Another way of thinking about it is it rounds a number towards 0: positive numbers get rounded down to an integer, and negative numbers get rounded up to an integer.

There are several other rounding commands available, which work in subtly different ways:

- ceiling() always rounds up to the next higher integer.
- floor() always rounds down to the next lower integer. int() does the same thing as floor().
- round() rounds to any given place value, including to an integer; it rounds up or down, whichever is nearest.

However, iPart() is the only one that has a counterpart fPart() which returns the fractional part of a number. This follows the rule that iPart(x)+fPart(x) always equals x.

Using iPart() on the result of a division — iPart(x/y) — is useful so often that there's a specific command, intDiv(), for doing so.

iPart() can also be applied to complex numbers, lists, and matrices, rounding everything that there is to round in each of them.

```
:iPart(3)
3
:iPart({-π,π})
{-3 3}
```

# Related Commands

Returns the ceiling of a number.

ceiling(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press 7 to select ceiling(.

This command works on all calculators.

1 byte

The `ceiling()` command rounds a number up to the nearest integer at least as large as the number. For instance, `ceiling(π)` returns 4, while `ceiling(-π)` returns -3.

There are several commands available to round a number to an integer in slightly different ways:

`int()`and`floor()`— like`ceiling()`, but round down instead.`iPart()`— truncates a number to just its integer part (or, if you prefer, rounds a number toward 0).`round()`— rounds to a specific place value, not just to an integer, but`round(x,0)`will round x to the nearest integer, up or down.

`ceiling()` can also be applied to complex numbers, lists, and matrices, rounding everything that there is to round in each of them.

```
:ceiling(3)
3
:ceiling({-π,π})
{-3 4}
```

# Related Commands

Returns the floor of a number.

floor(*value*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press 6 to select floor(.

This command works on all calculators.

1 byte

The floor() command rounds a number down to the nearest integer less than or equal to the number. For instance, floor(π) returns 3, while floor(-π) returns -4.

The command is an alias for int(): they do the exact same thing. The calculator prefers using floor() (in fact, int() will be converted to floor() in symbolic expressions); int() is left over from earlier calculator models. Other rounding commands include:

- ceiling() — like floor(), but always rounds up (to the next higher integer).
- iPart() — truncates a number to just its integer part (or, if you prefer, rounds a number toward 0).
- round() — rounds to a specific place value, not just to an integer, but round(x,0) will round x to the nearest integer, up or down.

floor() can also be applied to complex numbers, lists, and matrices, rounding everything that there is to round in each of them.

```
:floor(3)
3
:floor({-π,π})
{-4 3}
```

# Related Commands

Returns the floor of a number.

int(*value*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

1 byte

The int() command rounds a number down to the nearest integer less than or equal to the number. For instance, int(π) returns 3, while int(-π) returns -4.

The command is an alias for floor(): they do the exact same thing. The calculator prefers using floor() (in fact, int() will be converted to floor() in symbolic expressions); int() is left over from earlier calculator models. Other rounding commands include:

- ceiling() — like floor(), but always rounds up (to the next higher integer).
- iPart() — truncates a number to just its integer part (or, if you prefer, rounds a number toward 0).
- round() — rounds to a specific place value, not just to an integer, but round(x,0) will round x to the nearest integer, up or down.

int() can also be applied to complex numbers, lists, and matrices, rounding everything that there is to round in each of them.

```
:int(3)
3
:int({-π,π})
{-4 3}
```

# Related Commands

Clears the graph screen, redrawing any functions, plots, or axes/grid/labels.

ClrDraw

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The `ClrDraw` command clears away anything drawn on the graph screen — that is, the result of any of the graphics commands, except for `Graph` (which you can only clear with `ClrGraph`). It also leaves alone any functions or plots (which are disabled by `FnOff` and `PlotsOff`, respectively), as well as axes, labels, a grid, etc. (which can be disabled by the `setGraph()` command).

Be warned that it doesn't update the screen. For example, if you run the following program:

```
:circ()
:Prgm
:Circle 0,0,5
:ClrDraw
:EndPrgm
```

it will draw a circle and then end on the graph screen with the circle still drawn. The screen will actually update the next time you change something on the graph screen; you can also use

`DispG`to update it (although in the program above,

`DispHome`might be more appropriate).

# Related Commands

# See Also

Sets the window variables to their default settings.

ZoomStd

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The ZoomStd command initializes the window variables applicable to the current mode to their default values. These default values are:

**xmin**=-10,**xmax**=10,**xscl**=1 (except in differential equation mode, where**xmin**=-1)**ymin**=-10,**ymax**=10,**yscl**=1**xres**=2 (in function mode)**tmin**=0,**tmax**=2π,**tstep**=π/24 (in parametric mode)**θmin**=0,**θmax**=2π,**θstep**=π/24 (in polar mode)**nmin**=0,**nmax**=10,**plotStrt**=1,**plotStep**=1 (in sequence mode)**eyeθ**=20,**eyeφ**=70,**eyeψ**=0,**xgrid**=14,**ygrid**=14,**zmin**=-10,**zmax**=10, and**ncontour**=5 (in 3D mode)**t0**=0,**tmax**=10,**tstep**=0.1,**tplot**=0,**ncurves**=0,**diftol**=0.001, and**fldres**=20 (in differential equation mode)

See the System Variables article for details on what these variables actually do.

# Advanced Uses

One common use for ZoomStd is as a prelude to ZoomInt in a program. This makes sure that the window variables are the same each time, which ZoomInt alone doesn't guarantee.

# Related Commands

# See Also

Displays the results of an earlier statistics command.

ShowStat

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 6 to enter the Statistics submenu.
- Press 9 to select ShowStat.

This command works on all calculators.

2 bytes

The ShowStat command displays the results of the last regression or summary statistics command in a dialog box. The full list of such commands is: CubicReg, ExpReg, LinReg, LnReg, Logistic, MedMed, OneVar, PowerReg, QuadReg, QuartReg, SinReg, and TwoVar.

For regressions, ShowStat first displays the general form of the regression (for instance, y=a*x+b), then the values of the parameters (a and b, in this case); LinReg also outputs the value of corr, and all of them but MedMed display the value of R^{2}. For OneVar and TwoVar, ShowStat merely displays the list of system variables modified, along with their values.

If there are no statistics to display (for instance, if none of these commands have been used since the calculator was last reset), ShowStat will display "No stat variables" in the dialog box. The calculator also automatically deletes the statistics if the variables they were calculated from are modified or deleted.

ShowStat might not always be the best choice to display these results. For instance, when doing a regression, looking at regeq(x) (assuming x is undefined) will give you the entire equation at once. In a program especially, you might want to display the output in a different way than with ShowStat.

# Related Commands

Takes the cosecant of a number (usually, an angle).

csc(*angle*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press A to enter the Trig submenu.
- Press 4 to select csc(.

1 byte

The `csc()` command returns the cosecant (the reciprocal of the `sine`) of an angle measure. Naturally, the result depends on the angle mode the calculator is in: radian, degree, or (in AMS version 3.10) gradian. You can also use one of the ` ^{r}`,

`°`,

`marks to specify an angle mode.`

^{G}The `csc()` command, along with 11 other trig and hyperbolic functions, was added with AMS version 2.07. It can be easily replaced on earlier versions with 1/sin(x), which is what it simplifies to anyway.

For many common angles, `csc()` can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in radian mode, `csc()` can be used with complex numbers as well.

```
:csc(30°)
2
:csc(x)
1/sin(x)
:csc(0)
undef
```

If `csc()` is applied to a list, it will take the secant of every element in the list. However, it can't be applied to matrices the way `sin()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Error Conditions

**260 - Domain error** happens when taking `csc()` of a complex number in degree or gradian mode.

# Related Commands

Takes the secant of a number (usually, an angle).

sec(*angle*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press A to enter the Trig submenu.
- Press 5 to select sec(.

1 byte

The `sec()` command returns the secant (the reciprocal of the cosine) of an angle measure. Naturally, the result depends on the angle mode the calculator is in: radian, degree, or (in AMS version 3.10) gradian. You can also use one of the ^{r}, °, ^{G} marks to specify an angle mode.

The `sec()` command, along with 11 other trig and hyperbolic functions, was added with AMS version 2.07. It can be easily replaced on earlier versions with 1/cos(x), which is what it simplifies to anyway.

For many common angles, `sec()` can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in radian mode, `sec()` can be used with complex numbers as well.

```
:sec(60°)
2
:sec(x)
1/cos(x)
:sec(π/2)
undef
```

If `sec()` is applied to a list, it will take the secant of every element in the list. However, it can't be applied to matrices the way `cos()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Error Conditions

**260 - Domain error** happens when taking sec() of a complex number in degree or gradian mode.

# Related Commands

Converts an angle to gradians, if necessary.

*angle* ^{G}

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 2 to enter the Angle submenu.
- Press C to select
^{G}.

This command requires a TI-89 Titanium or Voyage 200 calculator with AMS version 3.10 or higher.

1 byte

NOTE: Due to the limitations of the wiki markup language, the^{G}command on this page does not appear as it would on the calculator. See Wiki Markup Limitations for more information.

The ^{G} symbol used after an angle makes sure the angle is interpreted as being in gradians (an obscure angle measure in which a full circle is equal to 400 gradians); this functionality is present only on TI-89 Titanium or Voyage 200 calculators with AMS version 3.10. If the calculator is already in gradian mode, x^{G} is equal to x; in degree mode, x^{G} is equal to 9*x/10; and in radian mode, x^{G} is equal to π*x/200.

If you're using gradian angle measures extensively in a program, it's a better idea to use setMode() to switch to gradian mode and not worry about this. However, there are two reasons you might want to use ^{G}:

- If you need an angle in gradians only once or twice, don't bother changing the mode setting.
- In a function, you're forced to use
^{G}, since setMode() isn't valid in a function.

In gradian mode (no conversion is necessary, so no conversion is done):

```
:cos(100)
1
:cos(100^G)
1
:100^G
100
```

In degree mode:

```
:cos(100)
cos(100)
:cos(100^G)
1
:100^G
90
```

# Related Commands

Converts an angle to radians, if necessary.

*angle* ^{r}

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 2 to enter the Angle submenu.
- Press 2 to select
^{r}.

This command works on all calculators.

1 byte

NOTE: Due to the limitations of the wiki markup language, the^{r}command on this page does not appear as it would on the calculator. See Wiki Markup Limitations for more information.

The ^{r} symbol used after an angle makes sure the angle is interpreted as being in radians. If the calculator is already in radian mode, x^{r} is equal to x; in degree mode, x^{r} is equal to 180*x/π; and in gradian mode, x^{r} is equal to 200*x/π.

If you're using radian angle measures extensively in a program, it's a better idea to use setMode() to switch to radian mode and not worry about this. However, there are two reasons you might want to use ^{r}:

- If you need an angle in radians only once or twice, don't bother changing the mode setting.
- In a function, you're forced to use
^{r}, since setMode() isn't valid in a function.

Make sure to use parentheses around an expression like (π/3)^{r}, since π/3^{r} will be interpreted as π/(3^{r}), and the conversion will be done incorrectly.

In radian mode (no conversion is necessary, so no conversion is done):

```
:sin(π/6)
1/2
:sin((π/6)^r)
1/2
:π^r
π
```

In degree mode:

```
:sin(π/6)
sin(π/6)
:sin((π/6)^r)
1/2
:π^r
180
```

# Related Commands

Converts an angle to degrees, if necessary.

*angle*°

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 2 to enter the Angle submenu.
- Press 1 to select °.

This command works on all calculators.

2 bytes

The ° symbol used after an angle makes sure the angle is interpreted as being in degrees. If the calculator is already in degree mode, x° is equal to x; in radian mode, x° is equal to π*x/180; and in gradian mode, x° is equal to 10*x/9.

If you're using degree measure extensively in a program, it's a better idea to use setMode() to switch to degree mode and not worry about this. However, there are two reasons you might want to use °:

- If you need an angle in degrees only once or twice, don't bother changing the mode setting.
- In a function, you're forced to use °, since setMode() isn't valid in a function.

In radian mode:

```
:sin(30)
sin(30)
:sin(30°)
1/2
:180°
π
```

In degree mode (no conversion is necessary, so no conversion is done):

```
:sin(30)
1/2
:sin(30°)
1/2
:180°
180
```

Another possible use of ° is to write an angle in degrees, minutes, and seconds as x°y'z" (using the usual apostrophe and quote symbols) — this stands for x degrees, y minutes (equal to 1/60th of a degree) and z seconds (equal to 1/60th of a minute). There's no "degree/minute/second" mode setting, so an angle entered in this form will always be simplified: first to (x+y/60+z/3600)^{2} degrees, and then (if necessary) converted to the correct angle measure. However, you can use ▶DMS to express output in this form.

# Related Commands

Creates a list by evaluating a formula over a range of values.

seq(*formula*,*variable*,*start*,*end*[,*step-size*]

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 3 to enter the List submenu.
- Press 1 to select seq(.

This command works on all calculators.

2 bytes

The seq() command creates a list of terms of a sequence: seq(*formula*,*variable*,*start*,*end*) evaluates *formula* for every value of *variable* from *start* to *end*. Optionally, a fifth argument, *step-size*, is included: this increases the value of *variable* by *step-size* for each element, instead of 1.

seq() is similar to a For..EndFor loop, but instead of repeating a block of commands every time, it only evaluates a formula.

```
:seq(f(x),x,1,5)
{f(1) f(2) f(3) f(4) f(5)}
:seq(x,x,3,9,2)
{3 5 7 9}
:seq(x^2,x,5,1,-1)
{25 16 9 4 1}
```

The variable used in seq(), x in the examples, is not actually modified.

# Advanced Uses

Because a matrix is just a list of lists, you can use seq() to create matrices as well as lists. The simplest way to do it is to make the formula a list:

```
:seq({x,2x,3x},x,1,4)
[1 2 3 ]
[2 4 6 ]
[3 6 9 ]
[4 8 12]
```

You can also create a matrix by nesting a seq() command inside another seq() command:

```
:seq(seq(row+col,col,1,4),row,1,3)
[2 3 4 5]
[3 4 5 6]
[4 5 6 7]
```

# Optimization

If all you need to do in a loop is create a list, it's probably better to use seq() than For..EndFor.

You can often use newList() instead of seq() to create an expression that gets evaluated much faster (see List Optimization for details).

# Error Conditions

For the non-generic errors that might occur when using this command (that is, syntax-type errors shouldn't be included). In a format similar to the following:

**260 - Domain error** happens when the *step-size* argument is 0.

**510 - Invalid list or matrix** happens when the formula of seq() is a matrix, or a list that varies in size.

# Related Commands

Displays a line of text in a dialog box.

Text *string of text*

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 1 to enter the Dialog submenu.
- Press 1 to select Text.

This command works on all calculators.

3 bytes

On its own, the Text command displays a simple dialog box with a line of text (left-aligned) inside. It can also be used inside a Dialog..EndDlog block, to add a line of text to a more advanced dialog.

The text must be a single string; but you can build one out of smaller strings and other data types using the & and string() commands.

Text will give an error if the string is too long — how long varies from model to model, and depending on if Text is being used inside or outside Dialog..EndDlog, but in general anything below 30 characters is safe (otherwise, you should test the dialog first to make sure everything fits). It uses the small, variable-width font on the TI-89 and TI-89 Titanium, and the normal fixed-width font on widescreen calculators.

# Advanced Uses

You can add Text "" to a dialog to skip a line between two other elements.

# Error Conditions

**130 - Argument must be a string** happens when Text is used to display other data types without using string() first.

**230 - Dimension** happens when the line of text is too long to fit in a dialog box.

# Related Commands

# See Also

#{$prepend}#{$append}" frameborder="0" scrolling="no" width="100%" height="18px"></iframe>[[/embed]]

Changes any of the graph settings.

setGraph(*setting*,*value*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The setGraph() command is an analog of the setMode() command, except that it's used specifically to change graph settings. setGraph(*setting*,*value*) will change *setting* to *value*, and return the old value of *setting*. Both settings and values are identified by strings (not case-sensitive, but very spelling-sensitive), which are listed on the Mode Settings page.

```
:setGraph("Coordinates","OFF")
"RECT"
:setGraph("Axes","OFF")
"ON"
```

Unlike setMode(), you can't change more than one setting at a time; there isn't a getGraph() function either, although you could use setGraph() to determine the mode setting if you really needed to.

# Advanced Uses

As an alternative to the long and hard-to-remember strings, you can also identify the settings and values of setGraph() with short and still hard-to-remember numbers (or rather, string versions of numbers). The equivalents are also listed on the Mode Settings page. For instance, "Coordinates" can be replaced with "1", and "IMPLICIT PLOT" with "5". If you use these codes as arguments to setGraph(), it will return such a code as well.

There are two advantages to this. First of all, writing the numbers is shorter, so it saves some space in the program. Second, it ensures that if, say, a French speaker is using your program with the language set to French, it will still work (normally, strings like "Coordinates" depend on the language setting).

Use the output of setGraph() to restore settings to what they were previously:

```
:setGraph("Axes","OFF")→oldaxes
...
:setGraph("Axes",oldaxes)
```

# Error Conditions

**130 - Argument must be a string** happens when the data type of arguments is incorrect.

**260 - Domain error** happens when the string used to identify a setting is incorrect or misspelled.

**430 - Invalid for the current mode settings** happens when a setting depends on other settings that are incorrect (e.g. setting "XR Style" when the calculator is not in 3D graphing mode).

**450 - Invalid in a function or current expression** happens when setGraph() is used in a function.

# Related Commands

# See Also

…that the calculator can do math with integers up to 2^{2040}?

…that you can use `part()` to write your own symbolic operations?

…that you can put images in toolbars on the widescreen calculators?

…that you can take the n^{th} root of x by entering x^(1/n)?

…that @1, @2, etc. stand in for arbitrary constants in an expression?

Aug |
01 — |
DarkerLine finished taking screenshots for all 366 command pages, present and future! |

Takes the *n*^{th} root of a value.

root(*value*,*n*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 1 to enter the Number submenu.
- Press D to select root(.

This command requires a TI-89 Titanium or Voyage 200 calculator with AMS version 3.10 or higher.

2 bytes

The root() command takes *n*^{th} roots: root(x,2) is the square root of x, root(x,3) is the cubic root, etc. (*n* doesn't have to be a whole number, or even real). Since root(x,n) is equivalent to x^(1/n), there was never any real need for this command, but it was added in the last AMS update for the Voyage 200 and TI-89 Titanium because users complained about not being able to do this calculation.

As far as complex roots are concerned: if taking a root of a real number, root() will return the real branch if there is one. If taking the root of a complex number, it will always return the principal branch.

```
:root(x,2)
√(x)
:root(1024,10)
2
```

# Advanced Uses

The command uses the same routines as the ^ operator, so it works in all the same ways. This means it can be applied to lists (element-wise), and to matrices either through repeated multiplication (e.g. if taking the 1/100^{th} root of a matrix, which ends up being its 100^{th} power) or by diagonalizing the matrix first (see Matrices and Their Commands for mor information about this method). If you want to take the *n*^{th} root of every element of a matrix, use the .^ command.

# Optimization

You can save a few bytes of space by using root(x,n) instead of x^(1/n); however, this optimization is a bit dodgy. It requires AMS 3.10 to use, so if you're planning on releasing the program anywhere, it will only work on the TI-89 Titanium and the Voyage 200, and even then it might require updating the OS. It's probably not worth it, unless the program is for personal use only.

# Error Conditions

**230 - Dimension** happens when non-square matrices are used with root().

**230 - Domain error** happens when a matrix is raised to an integer power not in the range -32768..32767.

**665 - Matrix not diagonalizable** happens when diagonalization (used to compute most uses of root() with matrices) fails.

**800 - Non-real result** happens when there is no real result to return, and the calculator is in real number mode.

**890 - Singular matrix** happens when raising a matrix with no inverse to a negative power.

# Related Commands

Chooses between two values based on a condition.

when(*condition*,*if-true*,*if-false*,[*if-undef*]])

**Menu Location**

Starting in the program editor:

- Press F2 to enter the Control menu.
- Press 3 to select when(.

This command works on all calculators.

2 bytes

The when() command — a sort of one-line alternative to If — chooses one of (usually) two values based on a condition. The first argument is the condition to check; if the condition is true, when() evaluates the second argument, and if the condition is false, it evaluates the third.

```
:when(2+2=4,"Math works!","Math doesn't work!")
"Math works!"
```

Only the chosen alternative is even calculated. If the condition is true, for example, when() will save time by not even bothering to check what the false condition even is.

Unlike If, when() doesn't have a problem with conditions that can't be fully resolved: it will just stay in its unevaluated form. And it gets better…

# Advanced Uses

You can give when() a third alternative, that will be taken if the condition isn't certain to be true or false. This usually happens because there's an undefined variable in the condition. For instance:

`:when(x>0,"x is positive","x is negative or 0","x is undefined")`

This can also happen if you give it a strange data type: for instance, if the "condition" of when() is an integer, the third alternative will be taken, because it's neither true nor false.

# Optimization

It's usually better to use when() instead of If, at least for short calculations. The result will be more compact, and as the Code Timings page shows, it's marginally faster, as well. However, for complicated conditions, when() is hard to read, especially if there are several when()'s in the same expression.

TI-83 series programmers might be tempted to use when() to convert true and false values to the more familiar 0 and 1:

`:when(cond,1,0)`

This has some applications, but in general you should avoid this: using when() directly is almost always better.

# Related Commands

Declares variables to be local to the current function or program.

Local *var1*[,*var2*,…]

**Menu Location**

Starting in the program editor:

- Press F4 to enter the Var menu.
- Press 3 to select Local.

This command works on all calculators.

3 bytes

The Local command declares one or more variables to be local to the function or program it's used in. This means that the program "owns" these variables, so to speak: their values start out undefined, no matter if a variable with the same name was defined outside the program, and the variables will be cleaned up once the program exits. Even subprograms called from the main program can't see the main program's local variables.

Local is useful to avoid leaving lots of variables behind, but you could do that by deleting them as well. More importantly, it assures that you won't overwrite any already existing variables. Finally, local variables are the only ones a function can use.

You may get a few local variables for free, without the Local command: these are the parameters to a function or program. For example, if you define the function f(x), you can modify x all you like without the fear of changing any variables outside the function.

# Advanced Uses

The interaction of Local with expr() is somewhat bizarre. In a way, expr() is a subprogram, so it can't see the local variables of the program that created it. This is a problem with output: for instance, expr("Disp x") will not work properly if x is a local variable.

In many cases, this doesn't matter: for instance, expr("x^2") may not be able to access the value of x if x is local, but it will return the symbolic value x^2, which will later be simplified in the main program. Things change if there's already a global variable called x defined. In that case, expr("x^2") will not find the local value of x, but it will see the global variable instead, so it will evaluate x^2 based on that value. This isn't usually what you want. But it *does* give you a way to access global variables: expr("x") refers to the global variable x if there is one, and the local variable otherwise.

# Error Conditions

**550 - Invalid outside function or program** happens when Local is used outside a function or program.

**610 - Invalid variable name in a Local statement** happens when making a system variable local.

# Related Commands

# See Also

Reverses a condition.

Can also be used as a bitwise "not" on integers.

not *condition*

not *integer*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 8 to enter the Test submenu.
- Press 7 to select not.

This command works on all calculators.

1 byte

The "not" operator reverses a condition, making it true if it had been false, and false if it had been true. You can create these conditions with the relational operators =, ≠, >, ≥, <, and ≤, with functions such as isPrime(), pxlTest(), and ptTest(), or with any other expression that returns 'true' or 'false'. Other operators for dealing with conditions are and, or, and xor.

In output, it can also appear as ~, and if you type the ~ character, it will be interpreted as "not".

```
:not 2+2=4
false
:not x
~x
```

The operator can also be applied to an integer, treating it as a 32-bit signed integer (larger integers will be truncated to fit) expressed in binary. In this case, it gives the 1's complement, flipping all the bits.

```
:(not 0b1111)▶Bin
0b11111111111111111111111111110000
:not 1000
-1001
```

# Error Conditions

**60 - Argument must be a Boolean expression or integer** happens when the data type is incorrect.

# Related Commands

# See Also

Tests if exactly one of two conditions is true.

Can also be used as a bitwise "xor" on integers.

*condition1* xor *condition2*

*integer1* xor *integer2*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 8 to enter the Test submenu.
- Press A to select xor.

This command works on all calculators.

1 byte

The "xor" (eXclusive OR) operator combines two conditions into one, which will be true if exactly one side is true, and false otherwise. You can create these conditions with the relational operators =, ≠, >, ≥, <, and ≤, with functions such as isPrime(), pxlTest(), and ptTest(), or with any other expression that returns 'true' or 'false'. Other operators for dealing with conditions are and, or, and not.

```
:2+2=4 xor 1=0
true
:2+2=4 xor 1+1=2
false
```

The operator can also be applied to integers, treating them as 32-bit signed integers (larger integers will be truncated to fit) expressed in binary. The bits will be matched up, and "xor" will be applied to the bits individually — a bit in the result will be 1 if the two corresponding bits of the original integers were different, and 0 if they were the same.

```
:(0b11111100 xor 0b00111111)▶Bin
0b11000011
:1000 xor 512
488
```

In complicated logical expressions (both with conditions and with integers), "and" has greater priority than the others ("or" and "xor"). For instance, X or Y and Z will be interpreted as X or (Y and Z).

# Error Conditions

**60 - Argument must be a Boolean expression or integer** happens when the data type is incorrect (or mismatched).

# Related Commands

# See Also

Tests if two conditions are both true.

Can also be used as a bitwise "and" on integers.

*condition1* and *condition2*

*integer1* and *integer2*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 8 to enter the Test submenu.
- Press 8 to select and.

This command works on all calculators.

1 byte

The `and` operator combines two conditions into one, which will be true if both sides are true, and false otherwise. You can create these conditions with the relational operators =, ≠, >, ≥, <, and ≤, with functions such as isPrime(), pxlTest(), and ptTest(), or with any other expression that returns 'true' or 'false'. Other operators for dealing with conditions are or, xor, and not.

```
:2+2=4 and 1=0
false
:2+2=4 and 1+1=2
true
```

The operator can also be applied to integers, treating them as 32-bit signed integers (larger integers will be truncated to fit) expressed in binary. The bits will be matched up, and "and" will be applied to the bits individually — a bit in the result will be 1 if the two corresponding bits of the original integers were 1, and 0 otherwise.

```
:(0b11111100 and 0b00111111)▶Bin
0b111100
:1000 and 512
512
```

In complicated logical expressions (both with conditions and with integers), `and` has greater priority than the others ("or" and "xor"). For instance:

`X or Y and Z`

will be interpreted as:

`X or (Y and Z)`

# Error Conditions

**60 - Argument must be a Boolean expression or integer** happens when the data type is incorrect (or mismatched).

# Related Commands

# See Also

Member

Member

Multiplies together the evaluations of an expression with one variable taking on a range of values.

∏(*expression*, *variable*, *start*, *end*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press B to enter the Calculus submenu.
- Press 5 to select ∏(.

This command works on all calculators.

2 bytes

∏() is used to multiply a sequence of numbers. ∏(*expression*, *variable*, *start*, *end*) will evaluate *expression* for *variable*=*start*, then for *variable*=*start*+1, all the way through *variable*=*end*, and multiply the results:

```
:∏(f(x),x,1,5)
f(1)*f(2)*f(3)*f(4)*f(5)
:∏(x,x,1,5)
120
```

In this way, ∏() is no different from taking product() of a sequence generated by seq(). However, ∏() can be used for more abstract calculations — for instance, when *start* or *end* is an undefined variable, it will try to find the product in terms of that variable. ∏() can also be used to find the product of an infinite series (just make the value of *end* infinity — ∞).

```
:∏(x,x,1,n)
n!
:∏(1-1/x,x,2,n)
1/n
```

# Related Commands

Tests if one value is smaller than another.

*value1*<*value 2*

**Menu Location**

Press [2nd][<] to enter <.

This command works on all calculators.

1 byte

The < operator compares two values, returning true if the right side is greater, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of < and the other relational operators (=, ≠, >, ≥, and ≤) can be combined with the and, or, xor, and not operators to create more complicated conditions.

It returns a single value for most types of data, and returns false if the two sides are mismatched in type: comparing a single number to a list, for instance, or comparing two lists that are of a different size. The only exception is when comparing two lists or two matrices of the same size: in that case, it compares them element-by-element, and returns a list or matrix of true/false values.

```
:3<4
true
:3<2
false
:{1,2,3}<{3,2,1}
{true false false}
```

If either side or both contains undefined variables, < will wait to return a value. You can do math with the resulting inequality, and if an operation makes sense, it will be applied to both sides: for instance, if x<y, then you can negate it to get -x>-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since even if x<y the comparison between x^2 and y^2 could go in any order. You can also extract the two halves of the inequality with left() and right().

# Advanced Uses

The < operator can also compare strings. It does so by comparing the character codes of each character, and orders the strings by the first difference it finds. This ideally means that the strings are ordered by dictionary order: for example, "aardvark"<"apple", since it would come later in the dictionary.

However, the problem is that all uppercase letters have a smaller character code than lowercase letters, so this only holds true if the strings are the same case. Otherwise, strange results can happen: for instance, "Apple"<"aardvark", since "A" comes before "a".

# Related Commands

# See Also

Tests if one value is smaller than or equal to another.

*value1*≤*value 2*

**Menu Location**

Press [♦][<] to enter ≤.

This command works on all calculators.

1 byte

The ≤ operator compares two values, returning true if the right side is greater or if the two are equal, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of ≤ and the other relational operators (=, ≠, >, ≥, and <) can be combined with the and, or, xor, and not operators to create more complicated conditions.

It returns a single value for most types of data, and returns false if the two sides are mismatched in type: comparing a single number to a list, for instance, or comparing two lists that are of a different size. The only exception is when comparing two lists or two matrices of the same size: in that case, it compares them element-by-element, and returns a list or matrix of true/false values.

```
:3≤4
true
:3≤2
false
:{1,2,3}≤{3,2,1}
{true true false}
```

If either side or both contains undefined variables, ≤ will wait to return a value. You can do math with the resulting inequality, and if an operation makes sense, it will be applied to both sides: for instance, if x≤y, then you can negate it to get -x≥-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since even if x≤y the comparison between x^2 and y^2 could go in any order. You can also extract the two halves of the inequality with left() and right().

# Advanced Uses

The ≤ operator can also compare strings. It does so by comparing the character codes of each character, and orders the strings by the first difference it finds. This ideally means that the strings are ordered by dictionary order: for example, "aardvark"≤"apple", since it would come later in the dictionary.

However, the problem is that all uppercase letters have a smaller character code than lowercase letters, so this only holds true if the strings are the same case. Otherwise, strange results can happen: for instance, "Apple"≤"aardvark", since "A" comes before "a".

# Related Commands

# See Also

Tests if one value is larger than or equal to another.

*value1*≥*value 2*

**Menu Location**

Press [♦][>] to enter ≥.

This command works on all calculators.

1 byte

The ≥ operator compares two values, returning true if the left side is greater or if the two are equal, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of ≥ and the other relational operators (=, ≠, >, <, and ≤) can be combined with the and, or, xor, and not operators to create more complicated conditions.

It returns a single value for most types of data, and returns false if the two sides are mismatched in type: comparing a single number to a list, for instance, or comparing two lists that are of a different size. The only exception is when comparing two lists or two matrices of the same size: in that case, it compares them element-by-element, and returns a list or matrix of true/false values.

```
:3≥4
false
:3≥2
true
:{1,2,3}≥{3,2,1}
{false true true}
```

If either side or both contains undefined variables, ≥ will wait to return a value. You can do math with the resulting inequality, and if an operation makes sense, it will be applied to both sides: for instance, if x≥y, then you can negate it to get -x≤-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since even if x≥y the comparison between x^2 and y^2 could go in any order. You can also extract the two halves of the inequality with left() and right().

# Advanced Uses

The ≥ operator can also compare strings. It does so by comparing the character codes of each character, and orders the strings by the first difference it finds. This ideally means that the strings are ordered by dictionary order: for example, "apple"≥"aardvark", since it would come later in the dictionary.

However, the problem is that all uppercase letters have a smaller character code than lowercase letters, so this only holds true if the strings are the same case. Otherwise, strange results can happen: for instance, "aardvark"≥"Apple", since "a" comes after "A".

# Related Commands

# See Also

Tests if one value is larger than another.

*value1*>*value 2*

**Menu Location**

Press [2nd][>] to enter >.

This command works on all calculators.

1 byte

The > operator compares two values, returning true if the left side is greater, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of > and the other relational operators (=, ≠, ≥, <, and ≤) can be combined with the and, or, xor, and not operators to create more complicated conditions.

```
:3>4
false
:3>2
true
:{1,2,3}>{3,2,1}
{false false true}
```

If either side or both contains undefined variables, > will wait to return a value. You can do math with the resulting inequality, and if an operation makes sense, it will be applied to both sides: for instance, if x>y, then you can negate it to get -x<-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since even if x>y the comparison between x^2 and y^2 could go in any order. You can also extract the two halves of the inequality with left() and right().

# Advanced Uses

The > operator can also compare strings. It does so by comparing the character codes of each character, and orders the strings by the first difference it finds. This ideally means that the strings are ordered by dictionary order: for example, "apple">"aardvark", since it would come later in the dictionary.

However, the problem is that all uppercase letters have a smaller character code than lowercase letters, so this only holds true if the strings are the same case. Otherwise, strange results can happen: for instance, "aardvark">"Apple", since "a" comes after "A".

# Related Commands

# See Also

Tests if two values are different.

*value1*≠*value 2*

**Menu Location**

Press [♦][=] key to enter ≠.

This command works on all calculators.

1 byte

The ≠ operator compares two values, returning true if they're different, and false if they're equal. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of ≠ and the other relational operators (=, >, ≥, <, and ≤) can be combined with the and, or, xor, and not operators to create more complicated conditions.

It returns a single value for most types of data, and returns true if the two sides are mismatched in type: comparing a single number to a list, for instance, or comparing two lists that are of a different size. The only exception is when comparing two lists or two matrices of the same size: in that case, it compares them element-by-element, and returns a list or matrix of true/false values.

```
:2+2≠4
false
:2+2≠5
true
:{1,2,3}≠{1,4,3}
{false true false}
```

If either side or both contains undefined variables, ≠ will wait to return a value unless it's something clearly true or false for any value of the variable (for instance, x≠x). You can do math with the resulting inequality: if an operation makes sense, it will be applied to both sides: for instance, if x≠y, then you can negate it to get -x≠-y. An operation will not be applied to both sides if it wouldn't be consistent with the previous inequality: for example, you can't square both sides, since if x≠y it can still be the case that x^2=y^2. You can also extract the two halves of the inequality with left() and right().

# Related Commands

# See Also

Tests if two values are equal.

*value1*=*value 2*

**Menu Location**

Press the [=] key to enter =.

This command works on all calculators.

1 byte

The = operator compares two values, returning true if they're equal, and false otherwise. It is a basic building block of the conditions used by commands such as If, when(), and While. The results of = and the other relational operators (≠, >, ≥, <, and ≤) can be combined with the and, or, xor, and not operators to create more complicated conditions.

```
:2+2=4
true
:2+2=5
false
:{1,2,3}={1,4,3}
{true false true}
```

If either side or both contains undefined variables, = will wait to return a value unless it's something clearly true for any value of the variable (for instance, x=x). You can do math with the resulting equation (most operations will be applied to both sides), and extract the two halves of it with left() and right().

# Optimization

Testing "If x=true" is redundant in most cases; you can shorten that to "If x". Similarly, "If x=false" can be "If not x".

# Related Commands

# See Also

Converts a number to a string with specified formatting.

format(*number*[,*options*])

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press D to enter the Strings submenu.
- Press 9 to select format(.

This command works on all calculators.

3 bytes

NOTE: Due to the limitations of the wiki markup language, the E command on this page does not appear as it would on the calculator. See Wiki Markup Limitations for more information.

The format() command is a more advanced version of string() specifically intended to convert numbers (usually, floating-point numbers) to strings. It can override settings like Display Digits and Exponential Format, and instead lets the user input these options and more in a string. Since it converts even integer input to floating-point, it also doesn't depend on the Base setting.

The format string can have the following values (not case-sensitive):

**F**overrides Display Digits to fixed-point with*[number]**[number]*digits after the decimal;*[number]*can be omitted to use the default, which is 12; it must be between 0 and 12.**S**does this and also overrides Exponential Format to scientific.*[number]***E**does this and also overrides Exponential Format to engineering.*[number]***G**does this and also separates the digits to the left of the decimal into groups of three, with*[number][character]**[character]*as the separator. The default for*[character]*, if it is omitted, is a comma. If you make the separator a period, then the decimal point will become a comma.

To all of these, you can also append **R [character]** to replace the decimal point with

*[character]*. Only 'symbols' are allowed for

*[character]*, which is a bit vague: numbers and letters are not allowed, nor are some international characters.

```
:format(π,"F")
"3.14159265359"
:format(2^25,"S6")
"3.355443e7"
:format(2^25,"E6")
"33.55443e6"
:format(2^25,"G0")
"33,554,432."
:format(2^25,"G0 R ")
"33 554 432 "
```

If the format string is empty, or if the argument is omitted entirely, format() will convert the number to a decimal, but otherwise will work just like string()

# Error Conditions

**260 - Domain error** happens when the format string is improperly formatted.

# Related Commands

Joins two strings together.

*string*&*string*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press D to enter the String submenu.
- Press 4 to select &.

This command works on all calculators.

2 bytes

The & operator joins two strings together, one after the other, returning one large string.

```
:"Hello"&"World"
"HelloWorld"
:5→n
:"The value of n is "&string(n)
"The value of n is 5"
```

Appending strings is very useful when you want to display text. If you want to display more than one string on the same line, for instance with the Text command, you'll need to use & to combine the strings.

By default, & doesn't put in any separation between the strings, which can look weird: you can see this in the above example, where joining "Hello" and "World" made "HelloWorld". With multiple uses of &, you can put in any separator you like:

```
:"Hello"&" "&"World"
"Hello World"
```

If you want to use & to build up a string from scratch, start with "" — the empty string.

# Related Commands

- # (indirection)
- string()
- mid()

# See Also

Shifts the elements of a list, string, or binary integer.

shift(*object*[,*places*])

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press E to enter the Base submenu.
- Press B to select shift(.

This command works on all calculators.

2 bytes.

When shift() is applied to lists or strings, it moves every element or character over, removing the elements that were shifted off the end, and filling in empty spaces with an undefined value: undef for lists and a space for strings. The default action is to shift everything one element right.

A second argument gives the direction and number of places to shift the list or string. Positive numbers are shifts to the left, and negative numbers are shifts to the right, so the default action shift(*object*) is equivalent to shift(*object*,-1). Here are some examples:

```
:shift({1,2,3,4,5})
{undef 1 2 3 4}
:shift("Hello")
" Hell"
:shift({1,2,3,4,5},2)
{3 4 5 undef undef}
:shift("TI-Basic",-3)
" TI-Ba"
```

shift() can also be used on integers, treating them as a sequence of bits (this makes the most sense when expressing them in binary). In this case, the integer is expressed as a 32-bit signed integer (larger integers are truncated), which is then bit-shifted.

When shifting right, the integer is sign extended: that is, the new bits introduced are 1 if the original leftmost bit was 1, and 0 if the original leftmost bit was 0. This preserves the sign of the integer. When shifting left, the integer is zero extended: the new bits are always 0.

As with lists and strings, the default action of shift() is to shift the integer one position right. A second argument gives the direction and number of places to shift the list or string. Positive numbers are shifts to the left, and negative numbers are shifts to the right.

```
:shift(0b00000000000000000000000011111111)▶Bin
0b00000000000000000000000001111111
:shift(0b10000000000000000000000011111111)▶Bin
0b11000000000000000000000001111111
:shift(1,10)
1024
```

# Related Commands

Converts any expression to a string.

string(*expression*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press D to enter the String submenu.
- Press 1 to select string(.

This command works on all calculators.

2 bytes

The string() command converts any expression to its string form. This applies to numbers, but also to lists, matrices, symbolic expressions, and equations. The result depends on all the mode settings that are typically involved with displaying a number: base, exact/approx setting, etc.

```
:string(50)
"50"
:string({1,2,3,4,5})
"{1,2,3,4,5}"
:string(1/(1-x))
"-1/(x-1)"
```

The main use of string() is with output commands like PtText, PxlText, Text, Title, etc. These commands only work with strings, so for any other data type, you'll have to use string() first — & will also come in handy. For example:

`:Text "The value of x is: "&string(x)`

If you're just converting numbers, you might also want to look into format(), which only applies to numbers and also puts them in a specific form.

# Advanced Uses

Together with the # (indirection) operator, string() can be used to access variables like a1, a2, a3, …, in order:

`:#("a"&string(n))`

# Related Commands

Returns a subsection from the right of a list or string, or the right hand side of an equation.

right(*equation*)

right(*list-or-string*,*length*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 3 to enter the List submenu.
- Press B to select right(.

This command works on all calculators.

2 bytes

When applied to a list or a string, right(*x*,*length*) gets the last (right-most) *length* elements/characters of *x*.

When applied to an equation (such as x=5) or an inequality (such as x<3), right() returns the right-hand side of the equation. This only works for equations that don't get simplified: right(2+2=4) will not work, because 2+2=4 will return 'true' first.

```
:right({1,2,3,4,5},3)
{3 4 5}
:right("TI-Basic Developer",9)
"Developer"
:right(x^2+2x+1>0)
0
:right({1,2,3,4,5},0)
{}
```

# Error Conditions

**260 - Domain error** happens when the argument is not a list, string, or equation, or is an equation that has simplified.

# Related Commands

Returns a subsection from the left of a list or string, or the left hand side of an equation.

left(*equation*)

left(*list-or-string*,*length*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 3 to enter the List submenu.
- Press 9 to select left(.

This command works on all calculators.

2 bytes

When applied to a list or a string, left(*x*,*length*) gets the first *length* elements/characters of *x*. This is an alternative to mid(), which will do the same thing from any point in the list or string, not just the beginning.

When applied to an equation (such as x=5) or an inequality (such as x<3), left() returns the left-hand side of the equation. This only works for equations that don't get simplified: left(2+2=4) will not work, because 2+2=4 will return 'true' first.

```
:left({1,2,3,4,5},3)
{1 2 3}
:left("TI-Basic Developer",8)
"TI-Basic"
:left(x^2+2x+1>0)
x^2+2*x+1
:left({1,2,3,4,5},0)
{}
```

# Optimization

Use left() instead of mid() when the substring starts at the beginning of the list or string.

# Error Conditions

**260 - Domain error** happens when the argument is not a list, string, or equation, or is an equation that has simplified.

# Related Commands

Generates a random polynomial.

randPoly(*var*,*deg*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 8 to select randPoly(.

This command works on all calculators.

1 byte

The randPoly() command generates a random polynomial. randPoly(*var*,*deg*) generates a random polynomial in variable *var* of degree *deg*. The coefficients of each power of *var* are random integers from -9 to 9.

```
:RandSeed 0
:randPoly(x,5)
4*x^5-2*x^4-7*x^2+8*x+8
```

# Advanced Uses

Using the RandSeed command makes the resulting polynomial entirely predictable: every time you set the random seed to some variable, you will get the same random coefficients afterwards. Also see RandSeed for details of how random numbers are generated.

# Error Conditions

**260 - Domain error** happens when the value of *deg* is not between 0 and 99.

# Related Commands

Generates a random matrix.

randMat(*rows*,*columns*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 7 to select randMat(.

This command works on all calculators.

1 byte

The randMat() command generates a random matrix: randMat(*rows*,*columns*) generates a *rows* by *columns* matrix whose entries are random integers between -9 and 9.

```
:RandSeed 0
:randM(3,2)
[4 -2]
[0 -7]
[8 8 ]
```

# Advanced Uses

Using the RandSeed command makes the random matrix entirely predictable: after setting the random seed to some value, the same random matrix will be returned every time (assuming the size is the same). See the RandSeed page for details of how random numbers are generated.

# Error Conditions

**260 - Domain error** happens when the *rows* and *columns* parameters aren't positive integers..

# Related Commands

This sitemap is a list of the pages in the 68k section of the site, organized in a hierarchical fashion for easy viewing. Please note that this does not include all of the pages in the 68k section, for instance the command pages.

## General- TI-Basic Developer Home: 68k
- Site News: 68k
- 68k Sitemap
- Guide to TI|BD
- 68k To-Do List
- Page Tags
- Overview of Included Pages
## Preparation- The Calculators
- Why TI-Basic?
- Using This Guide
- 68k Basic Starter Kit
- 68k TI-Basic for 83 TI-Basic Programmers
- Frequently Asked Questions (FAQ)
## Commands |
## Writing Programs- Planning Programs
- Commenting Your Code
- Debugging Programs
- Setup And Cleanup
- Usability
- Optimization
- Code Timings
- Releasing Your Program
## Special Topics |
## Resources## References |

Catches errors that occur in a block of code.

:Try

*(block of code)*

:Else

*(error-catching code)*

:EndTry

**Menu Location**

Starting in the program editor:

- Press F2 to enter the Control menu.
- Press 2 to enter the If..Then submenu.
- Press 4 to select Try..EndTry.

This command works on all calculators.

2 bytes for Try;

2 bytes for Else;

2 bytes for EndTry.

The Try command is used to "catch" errors that occur in a block of code. If an error occurs in a Try..EndTry code block, it doesn't display an error message and exit the program. Instead, it records the type of error in the system variable errornum, and jumps to the Else section of the Try..EndTry block.

Here, you have several options. By checking the Errors page, you can test errornum for specific values to find out what kind of error happened. Ultimately, you'll want to use one of two commands:

Here is an example of Try..EndTry in action:

```
:Try
: UnArchiv var
:Else
: Disp "var is undefined!"
: ClrErr
:EndTry
```

For most errors, Try..EndTry blocks aren't the way to go because you want to prevent them in the first place. They are a good way to handle special cases or circumstances out of your control. Here are two situations you might use Try..EndTry in:

- If your program uses external variables, you might surround that part of the code in a Try..EndTry block, rather than do all the tests to make sure they are unlocked, unarchived, etc.
- If your program requires specially-formatted input, instead of sanity checking it first you might let the program take untreated input, and catch the errors that result from an incorrect format.

# Error Conditions

**290 - EndTry is missing the matching Else statement** happens when the Try..EndTry block doesn't contain an Else.

**490 - Invalid in Try..EndTry block** happens when ??.

# Related Commands

# See Also

Generates a random normally-distributed number.

randNorm(*mean*,*std-dev*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 5 to select randNorm(.

This command works on all calculators.

1 byte

The randNorm() command generates a random number that is normally distributed, with a given mean (first parameter) and standard deviation (second parameter). This means that on average, randNorm(x,y) will give a result of about x; it's 95% certain to be within 2*y of x.

See rand() and RandSeed for more details on the random number generator.

# Formula

The formula for randNorm() is different from the one used by the TI-83 series. To generate normally-distributed values from the output of rand(), the calculator uses the polar form of the Box-Muller transform. The algorithm goes as follows:

First, generate two uniformly distributed numbers *u* and *v* in [-1,1]. Keep doing this until the result lies in the unit circle; the point (0,0), though it's unlikely to occur, is discarded as well. Let *s* equal *u*^{2}+*v*^{2}.

Usually, Box-Muller is used to produce two normally-distributed random numbers, by the formula below. The TI only uses the second of the results:

(1)The result is distributed according to the standard normal distribution: that is, with mean 0 and standard deviation 1. It's easy to get any other normal distribution by scaling: multiplying by the standard deviation, and then adding the mean.

In TI-Basic, the code for randNorm(μ,σ) would be:

```
:Loop
: 2*rand()-1→u
: 2*rand()-1→v
: u^2+v^2→s
: If 0<s and s<1
: Return μ+σ*v*√(-2*ln(s)/s)
:EndLoop
```

# Related Commands

Returns the size of a list, matrix, or string.

dim(*list-matrix-or-string*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press D to enter the String submenu.
- Press 3 to select dim(.

This command works on all calculators.

1 byte

The dim() command returns the size of a list, matrix, or string:

- The number of elements for a list.
- The number of characters for a string.
- A list of {number of rows, number of columns} for a matrix.

This command is critical to using any of these objects, for instance if you want to write a For..EndFor loop to look at every element.

However, unlike the TI-83 series version, you can't use the dim() command to change the size of anything. Use mid() to get a smaller list or string (subMat() for a matrix), or use newList() and newMat() to create a list or matrix of a specific size.

```
:dim({1,2,3,4,5}
5
:dim("TI-Basic Developer")
18
:dim([1,2,3;4,5,6])
{2 3}
```

# Optimization

For matrices, using rowDim() and colDim() is usually better in all practical situations, and you don't have to remember which number goes first.

# Related Commands

Rotates a string, list, or binary integer.

rotate(*object*,*places*)

**Menu Location**

- Press 2nd MATH to enter the MATH menu.
- Press E to enter the Base submenu.
- Press C to select rotate(.

This command works on all calculators.

2 bytes

When rotate() is applied to lists or strings, it moves every element or character over, moving the displaced elements over to the other end. By default, it shifts everything right one space, and moves the rightmost element to the beginning.

A second argument gives the direction and number of places to rotate the list or string. Positive numbers are rotations to the left, and negative numbers are rotation to the right, so the default action rotate(*object*) is equivalent to rotate(*object*,-1). Here are some examples:

```
:rotate({1,2,3,4,5})
{5 1 2 3 4}
:rotate("Hello")
"oHell"
:rotate({1,2,3,4,5},2)
{3 4 5 1 2}
:rotate("TI-Basic",-3)
"sicTI-Ba"
```

rotate() can also be used on integers, treating them as a sequence of bits (this makes the most sense when expressing them in binary). In this case, the integer is expressed as a 32-bit signed integer (larger integers are truncated), whose bits are then rotated.

As with lists and strings, the default action of rotate() is to rotate the integer one position right. A second argument gives the direction and number of places to rotate the list or string. Positive numbers are rotations to the left, and negative numbers are rotations to the right.

```
:shift(0b00000000000000000000000011111111)▶Bin
0b10000000000000000000000001111111
:rotate(1,10)
1024
```

# Related Commands

Returns the remainder of a division.

remain(*dividend*,*divisor*)

**Menu Location**

- Press 2nd MATH to enter the math popup menu.
- Press 1 to enter the Number submenu.
- Press A to select remain(.

This command works on all calculators.

1 byte

The remain() command returns the remainder of a division: remain(A,B) is calculated as A-B*intDiv(A,B) which in turn is equivalent to A-B*iPart(A/B). Although this operation is most useful for dividing whole numbers, this definition works for any number, whole or decimal, real or complex. Additionally, remain(X,0) is defined as X.

The related mod() command returns the same results for positive numbers, however, they disagree when negative integers enter the mix. The result of mod() is defined just as remain(), but with int() instead of iPart(). This means that remain() gives a negative answer if the dividend is negative, and mod() gives a negative answer if the divisor is negative.

```
:remain(125,3)
2
:remain(-125,3)
-2
:remain(2*i+1,i+1)
i
```

The remain() command also works for lists and matrices. Used with a list or matrix and a number, remain() is applied to the number paired with every element of the list or matrix. Used with two lists or two matrices, which must match in size, remain() is applied to matching elements of the list or matrix.

# Advanced Uses

Use intDiv() and remain() for the quotient and remainder results of long division, respectively.

# Error Conditions

**240 - Dimension mismatch** happens when two list or matrix arguments don't match in size.

# Related Commands

Adds together the evaluations of an expression with one variable taking on a range of values.

∑(*expression*, *variable*, *start*, *end*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press B to enter the Calculus submenu.
- Press 4 to select ∑(.

This command works on all calculators.

2 bytes

∑() is used to add a sequence of numbers. ∑(*expression*, *variable*, *start*, *end*) will evaluate *expression* for *variable*=*start*, then for *variable*=*start*+1, all the way through *variable*=*end*, and add up the results:

```
:∑(f(x),x,1,5)
f(1)+f(2)+f(3)+f(4)+f(5)
:∑(x^2,x,1,5)
55
```

In this way, ∑() is no different from taking sum() of a sequence generated by seq(). However, ∑() can be used for more abstract calculations — for instance, when *start* or *end* is an undefined variable, it will try to find the sum in terms of that variable. ∑() can also be used to sum an infinite series (just make the value of *end* infinity — ∞).

```
:∑(x^2,x,1,n)
n*(n+1)*(2*n+1)/6
:∑(2^-x,x,1,∞)
1
```

# Optimization

It's a good idea to replace sum(seq( by ∑( whenever it occurs. The only difficulty arises if seq() uses its *step* argument, since ∑() doesn't have one. There are three options:

- Forget about using ∑() and just go with the sum(seq( alternative.
- Use a when() expression (probably with mod()) to select the entries you care about.
- Use a linear equation to transform values from 1 to N into the correct values with the step.

Here is an example of these approaches:

`:sum(seq(x^2,x,1,9,2))`

This calculates 1

^{2}+3

^{2}+5

^{2}+7

^{2}+9

^{2}.

`:∑(when(mod(x,2)=1,x^2,0),x,1,9)`

The when() command selects only the odd numbers — those with mod(x,2)=1 — from 1 to 9.

`:∑((2x-1)^2,x,1,5)`

The equation 2*x-1 transforms the numbers 1..5 into the odd numbers 1..9.

# Related Commands

Checks the value of the system clock.

checkTmr(*time*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

2 bytes

The `checkTmr()` command, together with `startTmr()` uses the built-in system clock to measure the time (in seconds) that passed between two points of the program. Make sure that the clock is on (with `ClockOn` before using these).

The name of the commands reflects their use: you can think of a `startTmr()` call as creating and starting a timer:

`:startTmr()→timer`

The `checkTmr()` command will then return the number of seconds that have elapsed on the timer (without stopping it):

`:Disp "Seconds elapsed:",checkTmr(timer)`

This is a good abstraction and you don't need to know the details of how `startTmr()` and `checkTmr()` work to use them. In reality, what `startTmr()` actually returns is the current value of a system timer (which increases by 1 every second). The `checkTmr()` command does the same thing, but subtracts its parameter: so `checkTmr(x)` is equivalent to `startTmr()`-x.

Because both `startTmr()` and `checkTmr()` deal with whole numbers of seconds, the resulting difference in time could be off by up to a second in either direction. That is, if `checkTmr()` gives 15 seconds as the time, you know the time that actually passed is between 14 and 16 seconds.

# Advanced Uses

The `startTmr()` and `checkTmr()` commands can be used to figure out how much time a command or routine takes with much greater precisions by running it multiple times. For example:

```
:startTmr()→t
:For i,1,1000
: somecmd()
:Disp checkTmr(t)
```

Suppose that the result displayed was 100 seconds. This is accurate to 1 second, so the actual time was between 99 and 101 seconds. However, this actual time is for 1000 repetitions of

`somecmd()`(we assume that the time the code takes to increment i is negligible, although that may also be taken into account). So

`somecmd()`repeated only once takes between 99/1000 and 101/1000 seconds, so the actual time is 100 ms, measured to within 1 millisecond error.

See Code Timings for more information on this, as well as the results of some common comparisons.

# Related Commands

# See Also

Returns the value of the system clock.

startTmr()

**Menu Location**

This command can't be found in any menu besides the command catalog.

3 bytes

The startTmr() command returns the number of seconds that passed since 00:00 GMT of January 1, 1997 — as far as the calculator knows, anyway, since this value is adjusted every time the current time and date changes with setTime() or setDate(). If the clock is running, this number is also updated every second, which is how the calculator keeps track of time.

Together with checkTmr(), startTmr() can be used to measure off a time interval (in seconds) while a program is running (make sure to use ClockOn first). the name of the commands reflects their use: you can think of a startTmr() call as creating and starting a timer:

`:startTmr()→timer`

The checkTmr() command will then return the number of seconds that have elapsed on the timer (without stopping it):

`:Disp "Seconds elapsed:",checkTmr(timer)`

This is a good abstraction and you don't need to know the details of how startTmr() and checkTmr() work to use them. In reality, checkTmr(x) returns startTmr()-x, so using it on the result of startTmr() gives a time difference.

Because both startTmr() and checkTmr() deal with whole numbers of seconds, the resulting difference in time could be off by up to a second in either direction. That is, if checkTmr() gives 15 seconds as the time, you know the time that actually passed is between 14 and 16 seconds.

# Advanced Uses

The startTmr() and checkTmr() commands can be used to figure out how much time a command or routine takes with much greater precisions by running it multiple times. For example:

```
:startTmr()→t
:For i,1,1000
: somecmd()
:EndFor
:Disp checkTmr(t)
```

Suppose that the result displayed was 100 seconds. This is accurate to 1 second, so the actual time was between 99 and 101 seconds. However, this actual time is for 1000 repetitions of somecmd() (we assume that the time the code to increment i takes is negligible, although that, too, may be taken into account). So somecmd() repeated only once takes between 99/1000 and 101/1000 seconds, so the actual time is 100 ms, measured to within 1 millisecond error.

See Code Timings for more information on this, as well as the results of some common comparisons.

# Related Commands

# See Also

Takes the tangent of a number (usually, an angle).

tan(*angle*)

**Menu Location**

Press the TAN button to enter tan(.

This command works on all calculators.

1 byte

The `tan()` command returns the tangent of an angle measure. Naturally, the result depends on the angle `mode` the calculator is in: `radian`, `degree`, or (in AMS version 3.10) `gradian`. You can also use one of the ` ^{r}`,

`°`,

`marks to specify an angle mode.`

^{G}For many common angles, `tan()` can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in `radian` mode, `tan()` can be used with complex numbers as well.

```
:tan(60°)
√3
:tan(x+π)
tan(x)
:tan(ix)
tanh(x)*i
```

If `tan()` is applied to a list, it will take the tangent of every element in the list.

# Advanced Uses

The `tan()` of a matrix is not (in general) the same as taking the tangent of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Error Conditions

**230 - Dimension** happens when taking `tan()` of a matrix that isn't square.

**260 - Domain error** happens when taking `tan()` of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking `tan()` of a matrix that isn't diagonalizable.

# Related Commands

Takes the cotangent of a number (usually, an angle).

cot(*angle*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press A to enter the Trig submenu.
- Press 6 to select cot(.

1 byte

The `cot()` command returns the cotangent (the reciprocal of the `tangent`) of an angle measure. Naturally, the result depends on the angle mode the calculator is in: radian, degree, or (in AMS version 3.10) gradian. You can also use one of the ` ^{r}`,

`°`,

`marks to specify an angle mode.`

^{G}The `cot()` command, along with 11 other trig and hyperbolic functions, was added with AMS version 2.07. It can be easily replaced on earlier versions with `1/tan(x)`, which is what it simplifies to anyway.

For many common angles, `cot()` can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in radian mode, `cot()` can be used with complex numbers as well.

```
:cot(60°)
√3/3
:cot(x)
1/tan(x)
:cot(0)
undef
```

If `cot()` is applied to a list, it will take the cotangent of every element in the list. However, it can't be applied to matrices the way `cos()` can (this is probably an oversight; all the trig and hyperbolic functions that were present in all AMS versions work with matrices, but the ones added in version 2.07 do not).

# Error Conditions

**260 - Domain error** happens when taking `cot()` of a complex number in degree or gradian mode.

# Related Commands

Jul |
27 — |
The TI-Basic Developer goes Pro on Wikidot! |

Work on this game begins now.

If you start a variable transfer while in a program, it will end the program. I believe, that the calc can do getcalc to the computer. I will test it on Monday.

Jul |
25 — |
burr, the founder of this site, transfers Master Administrator status to DarkerLine. |

A futuristic Role Playing Game with several abilities and a unique style of battle.

Yes, another RPG to add to the projects page.

**Features:**

Utilizes the Horiz function, which splits the screen between text and graphics.

Supports a dynamic inventory system similar to professional rpgs, with item stacking.

Runs decently on 83+ and almost too fast on 84/+/SE. Seriously, the battle animations are pretty hard to make out.

A unique battle engine: you have to build up charge in battle to use stronger techniques and abilities

A graphical overworld and battle engine; this is not a text-based game.

Supports NPC's, random encounters, selling items, and most typical RPG stuff.

**Goals:**

3-4 areas and bosses

A storyline that makes sense

Finished by the end of summer—although that might be a bit overambitious

**Screenshots:**

(note that I'm having a bit of a problem with the run indicator.)

Unfortunately, the rich vocabulary of wiki syntax doesn't allow to properly display a command in titles and code blocks. When this happens, the offending page will link here so we can properly apologize, clarify what is meant, and give the syntax that displays them correctly where it is possible to do so.

Here are the commands and symbols that suffer from this problem:

- The
^{r}command- Use ^^r^^ to render it correctly where possible.
- Use ^^[[[68k:radian|r]]]^^ to render it in a link.
- Replace it with ^r in code blocks.

- The
^{G}command- Use ^^G^^ to render it correctly where possible.
- Use ^^[[[68k:gradian|G]]]^^ to render it in a link.
- Replace it with ^G in code blocks.

- The
*d*() command- Use //d//() to render it correctly where possible.
- Use //[[[68k:d]]]//[[[68k:d|()]]] to render it in a link.
- Use [[span style="font-style:italic;"]][[[68k:d]]][[/span]][[[68k:d|()]]] if the above fails to work properly.
- Replace it with d() in code blocks.

- The E command
- Use [[size 75%]]E[[/size]] to render it correctly where possible.
- Use [[size 75%]][[[68k:e-ten|E]]][[/size]] to render it in a link.
- Replace it with E in code blocks.

- The
^{T}command- Use ^^T^^ to render it correctly where possible.
- Use ^^[[[68k:transpose|T]]]^^ to render it in a link.
- Replace it with ^T in code blocks.

- The $\bar{x}$ and $\bar{y}$ symbols.
- Use [[$ \bar{x} $]] to render $\bar{x}$ correctly.
- Use [[$ \bar{y} $]] to render $\bar{y}$ correctly.
- Avoid using these in code blocks, or replace with xbar and ybar.

On a related note, there are two operators that don't have any trouble being displayed, but can't be used in a link, so every page that refers to them has to dance around the issue much like this page does in the next sentence. They are: # (indirection) and | (with).

# See Also

- The wiki syntax description on www.wikidot.com.

Takes a symbolic derivative of an expression.

*d*(*expression*,*variable*[,*order*])

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press B to enter the Calculus submenu.
- Press 1 to select
*d*(.

This command works on all calculators.

2 bytes

NOTE: Due to the limitations of the wiki markup language, thed() command on this page does not appear as it would on the calculator. See Wiki Markup Limitations for more information.

The *d*() command takes the derivative of an expression with respect to a given variable. All other variables are treated as constant.

Optionally, you can give it a third argument (an integer), and take the derivative that many times. If the argument is negative, it will actually integrate.

```
:d(x^2,x)
2*x
:d(x^5,x,4)
120*x
:d(x^2+y^2+2*x*y,x)
2*x+2*y
```

# Related Commands

NOTE: Due to the limitations of the wiki markup language, the {$cmd} command on this page does not appear as it would on the calculator. See Wiki Markup Limitations for more information.

Calculates several summary statistics for a list.

OneVar *list*[,*freq*,*arg3*,*arg4*]

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 6 to enter the Statistics submenu.
- Press 1 to select OneVar.

This command works on all calculators.

3 bytes

The OneVar command generates some summary statistics for a list. In its simplest form, it takes one argument — a list variable to analyze (it won't work with a list expression). It will store results to the following system variables:

- $\bar{x}$ — the average, as given by mean()
- Σx — the sum, as given by sum()
- Σx
^{2}— the sum of squares - Sx — the sample standard deviation, as given by stdDev()
- σx — the population standard deviation, as given by stDevPop()
- nStat — the length of the list, as given by dim()
- minX — the smallest element, as given by min()
- q1 — the first quartile
- medStat — the median, as given by median()
- q3 — the third quartile
- maxX — the largest element, as given by max()

It won't actually display any of these results without prompting (although you could check the variables to find out their values). To display all of these statistics, use the ShowStat command.

# Advanced Uses

The OneVar command takes up to 4 list arguments. The second argument, if present, is a list of frequencies. This must be the same length as the first list, and if it's there, its N^{th} element indicates how many times the N^{th} element of the first list should be counted. The calculator has no problems accepting zero or fractional numbers as frequencies.

The third and fourth arguments don't actually have an application. Their intention is to divide the elements into several categories: the third list would indicate which category each element of the data list falls under, and the fourth list would be a list of categories. However, this was apparently never implemented, and adding these lists doesn't affect the output.

# Error Conditions

**230 - Dimension** happens when either the data list is {}, or the frequency list only contains 0s.

**240 - Dimension mismatch** happens when the frequency list (or the category list) isn't the same length as the data list.

**260 - Domain** happens when the frequency list contains negative elements.

# Related Commands

# See Also

Checks the current mode settings.

getMode(*setting*)

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The getMode() command checks any one current mode setting. Just give it the name of the mode setting to check, as a string, and it will give you the current value. For example:

```
:getMode("Angle")
"RADIAN"
:getMode("Complex Format")
"REAL"
```

The name of the setting is not case-sensitive, but is very typo-sensitive.

In practice, getMode() is almost entirely superseded by setMode() — usually, you don't care about a setting unless you want to change it if it's wrong. In particular, it is silly to do the following:

```
:If getMode("Angle")≠"RADIAN"
: setMode("Angle","RADIAN")
```

In this case, just the setMode() command instruction by itself would have been fine, since changing the mode from radian to radian would've done nothing anyway.

It is *also* silly to do the following:

```
:getMode("Angle")→oldmode
:setMode("Angle","RADIAN")
...
:setMode("Angle",oldmode)
```

It is a noble impulse to try to preserve the old setting and restore it later. However, the same is accomplished more elegantly with (note the { } brackets):

```
:setMode({"Angle","RADIAN"})→oldmode
...
:setMode(oldmode)
```

# Optimization

Every string like "Angle" or "FLOAT 12" can be replaced by a numerical equivalent (one that is, for some reason, still given as a string, e.g. "3" or "26"). Using these is shorter, and it has the benefit of being international.

See the Table of Mode Settings to look up these numbers, as well as read about what the various mode settings do.

# Error Conditions

**260 - Domain error** happens when a mode setting or value doesn't exist, at least not with this spelling.

# Related Commands

# See Also

Seeds the random number generator.

RandSeed *value*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 6 to select RandSeed.

This command works on all calculators.

2 bytes

The RandSeed command seeds the random number generator. The value you use should be a positive integer: the sign and any decimals will be simply ignored.

To explain what this means, first you have to understand how pseudo-random number generators work. Every time a command like rand() is called the calculator gives a different number — this means that the calculator must keep some variable around that changes when rand() is called. This variable is called the seed. Generating a random number is done as follows:

- To get the number itself, apply some function that takes the seed to a real number between 0 and 1 (for a simple rand() call).
- If a different type of random number is needed (e.g. a random integer), the real number 0..1 is adjusted in some way.
- The seed itself is updated by some carefully chosen mathematical operation.

"Seeding" the random number generator means setting the seed to some specific value. This is done for two reasons:

- To ensure randomness, you might seed the random generator with the current time — that way, it's guaranteed to be different every second of every day.
- Every time you seed the random number generator with a specific number, the random numbers that follow will be the same. For example, the following output is guaranteed to be the same on all calculators every time (except for formatting):

```
:RandSeed 100
:rand()
.556077
:rand()
.590054
```

# Advanced Uses

Seed the RNG with the current time by using the following command:

`:RandSeed startTmr()`

The random number generator is very popular as an encryption method to implement on calculators. This is done as follows:

- Use the encryption key as a random number seed.
- Do something to the text to be encrypted that involves random numbers (e.g. a randomly generated One-Time Pad)
- To decrypt, use the encryption key as a seed, and reverse the operation above.

Most of the security of this method lies in the obscurity of the random number generator. Someone that has read this page (or someone from Texas Instruments) could break the code in a matter of seconds on a computer; and if they knew anything at all about the message, they could probably break the code with just a calculator.

In general, after you mess with the random number seed, you must 'restore randomness' somehow — otherwise, every time you run that program, random numbers will be the same afterwards every time. Using startTmr() as above is one way of doing so; another is generating a random integer before you run RandSeed, and using it as the seed at the end. For example:

```
:rand(10^10) →r
:RandSeed 0
(code with predictable random numbers)
:RandSeed r
```

# The RNG Algorithm

The algorithm used by the calculator to generate random numbers is known as L'Ecuyer's algorithm. This particular implementation works as follows.

The following constants are used:

```
:2147483563→mod1
:2147483399→mod2
:40014→mult1
:40692→mult2
```

RandSeed n is equivalent to the following code:

```
:abs(int(n))→n
:If n=0 Then
: 12345→seed1
: 67890→seed2
:Else
: mod(mult1*n,mod1)→seed1
: mod(n,mod2)→seed2
:EndIf
```

rand() is equivalent to the following code:

```
:Local result
:mod(seed1*mult1,mod1)→seed1
:mod(seed2*mult2,mod2)→seed2
:(seed1-seed2)/mod1→result
:If result<0
: result+1→result
:Return result
```

# Related Commands

Returns a list of calculator configuration info.

getConfg()

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

3 bytes

The getConfg() command returns a list of useful and not-so-useful information about the calculator. Every other entry in the list is a description of the next entry, so it's not too hard to figure out which entry you need if necessary.

The values returned by getConfg() are:

List position | Value | List position | Value |
---|---|---|---|

1 | "Product Name" | 2 | "Advanced Mathematics Software" |

3 | "OS Version" | 4 | "version #, date" |

5 | "Product ID" | 6 | string unique to calculator model |

7 | "ID #" | 8 | string unique to specific calculator |

9 | "Screen Width" | 10 | 160 or 240 |

11 | "Screen Height" | 12 | 100 or 128 |

13 | "Window Width" | 14 | varies (see Note 1.) |

15 | "Window Height" | 16 | varies (see Note 1.) |

17 | "RAM Size" | 18 | depends on model |

19 | "Free RAM" | 20 | varies (see Note 2.) |

21 | "Archive Size" | 22 | depends on model |

23 | "Free Archive" | 24 | varies |

Notes:

- The window width and window height depend on calculator model and on the split screen setting. They're also off by varying amounts. It's best to use one of the other settings to determine calculator type (widescreen or standard), and getMode() to determine split screen status if necessary.
- Even with all variables deleted, Free RAM will be considerably less than RAM Size, due to operating system variables taking up that much of it.

There are several interesting applications for getConfg(). One is compatibility with other calculator models:

- If you want to make graphics compatible, use Screen Width or Screen Height to check if you're on a widescreen calculator.
- If you want to use an advanced OS feature, check the OS Version.
- If you use lots of features of your calculator model and think it won't work on any other, check Product ID and exit if it doesn't match your own.

Another application: if your program is very memory-intensive, you might want to make sure that there is enough free RAM to fit all the variables you will need. The same is, in theory, true for the archive, but having little archive memory available is rare.

Using the ID #, you might detect when the program has been transferred to a different calculator, and react accordingly (e.g. re-initialize certain variables). A more subtle application: supplying a number calculated from the ID # as the random number seed will ensure that your program always behaves in the same way for the same calculator, but will be different on different calculators — this might be completely inappropriate in some cases, but an interesting gimmick in others!

# Related Commands

# See Also

Gives the ASCII code of a character.

ord(*string*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press D to enter the string submenu.
- Press B to select ord(.

This command works on all calculators.

2 bytes

The ord() command gives the ASCII code of a character (that is, its character code, which is a modification of standard ASCII). The input is meant to be a single character, but the command doesn't actually check for that — so in practice, it gives the ASCII code of the first character in a string. You can convert multiple characters at once by giving ord() a list (or matrix) of characters.

The inverse of ord() is char(), which converts a character code to a character.

```
:ord("America")
65
:ord({"A","b","c"})
{65 98 99}
:ord("")
0
```

# Optimization

Code such as

`:inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",str)`

should be replaced by appropriate use of ord(); in this case,

`:ord(str)-64`

# Related Commands

# See Also

Member

RSA is a popular encryption algorithm. It is a public-key algorithm — this means that anyone can encrypt messages using the "public key", but only the person who knows the "private key" can decrypt them.

The security of RSA relies on factoring large numbers being difficult. Unfortunately, numbers that would be large enough to be secure are also too large for the calculator to handle. Any key you could generate on a calculator could be broken on a computer in a matter of minutes or hours, depending on the length.

This program is a good example of a number-theoretic algorithm implemented on 68k calculators.

# The Code

```
rprime(a,b)
:Func
:Local p
:a+rand()(a-b)→p
:p+mod(p,2)+1→p
:Loop
: If isPrime(p)
: Return p
: p+2→p
:EndLoop
:EndFunc
```

```
extgcd(a,b)
:Func
:Local q,r
:{1,0,a}→a
:{0,1,b}→b
:While b[3]>0
: intDiv(a[3],b[3])→q
: a-q*b→r
: b→a
: r→b
:EndWhile
:a
:EndFunc
```

```
rsakey(nbits)
:Func
:Local m,p,q,d,e
:intDiv(nbits,2)→nbits
:rprime(2^nbits,2^(nbits+1))→p
:rprime(2^nbits,2^(nbits+1))→q
:(p-1)(q-1)→m
:1+rand(m-2)→e
:While gcd(e,m)>1
: 1+rand(m-2)→e
:EndWhile
:extgcd(m,e)[2]→d
:{e,d,p*q}
:EndFunc
```

```
rsa(txt,e,n)
:Func
:txt/txt→result
:While e>0
: If mod(e,2)=1
: mod(result*txt,n)→result
: mod(txt^2,n)→txt
: intDiv(e,2)→e
:EndWhile
:result
:EndFunc
```

# An Explanation

The code for this program is divided into four parts. Two of them are necessarily independent: rsakey() is used to generate a public and private key, and rsa() is used to encrypt or decrypt. The other two functions could easily be part of rsakey(); they're isolated here for clarity, and because they're somewhat useful on their own; rprime() generates a random prime, and extgcd() is the extended Euclidean Algorithm.

First, here is a description of how RSA works.

To generate the key:

- We find two large primes P and Q, and find N=PQ which will be used as a modulus. Let M=(P-1)(Q-1).
- Take a random integer E, 1<E<M, which has no divisors in common with M.
- Find E's inverse mod M: an integer D such that DE ≡ 1 mod M.
- The pair (E,N) is the public key, and (D,N) is the private key.

To encrypt text:

- Divide it into blocks which are encoded as integers A, 1<A<N.
- Compute A^E mod N for each block, giving the encrypted version of that block.

To decrypt text, encrypt it using D instead of E.

It's a basic result in number theory that if N and M are defined as above, then A^{M}≡ 1 mod N. This means that (A^{E})^{D} = A^{DE} ≡A^{M+1}≡A mod N. Therefore the decryption actually does reverse the encryption.

We could find D from E easily because we know M, which depends on knowing P and Q. However, someone who knows just the public key only knows N=PQ; to get P and Q from there, he'd need to factor N, which is hard. This means that someone who doesn't know D can't easily find it, and the encryption is secure.

## The rprime() function

This is by far the most time-consuming part of the entire algorithm. Fortunately, it only has to be done to generate a key, and keys are reusable. Still, the key generation could easily take a minute or two as a consequence.

The purpose of rprime() is to generate a prime number between its two arguments (i.e. rprime(1,100) generates a random prime between 1 and 100). In practice, it can end up overflowing past the upper bound, but this is very unlikely, especially for the ranges RSA deals with.

The idea is simple: a+rand(a-b)→p generates a random number between a and b to start at. The next line makes sure this starting point is odd. From there, we keep testing the number to see if it's prime; if it's not, we increase it by 2 and try again.

## The extgcd() function

The extended Euclidean Algorithm not only computes the GCD of a and b, but finds two constants M and N such that M*a+N*b=GCD(a,b) — this has lots of applications, only one of which is RSA.

The idea is similar to the standard Euclidean Algorithm to compute GCD. Initially, we can express a as 1*a+0*b, and b as 0*a+1*b. After that, each time we take a remainder, we can express it as a sum of a and b. The final remainder is the GCD, giving us the M and N above.

## The rsakey() function

The first part of the code is easy: we generate the random primes P and Q. Each of them has half the bits that N should, since multiplying them will approximately add the number of bits.

The next few lines just follow the algorithm outlined earlier. Note that to get a random number relatively prime to M, we just keep picking numbers until the GCD is 1. This shouldn't take a long time, since most numbers are relatively prime to M (if factoring is hard, *accidentally* factoring should be even harder).

The only tricky part is that we use extgcd() to find D. The reason this works is the following: If DE≡1 mod M, then D*E=k*M+1 for some k, so D*E-k*M=1. This is just the equation that the extended Euclidean Algorithm solves! (note that GCD(E,M)=1).

## The rsa() function

This function should work equally well for encrypting lists and single numbers. We'll assume that txt is a single number for simplicity, but every operation used distributes over lists, so a list would work the same way.

The exponentiation routine is not the For loop you'd expect. This would be terribly slow, since E is, on average, around 2^{127} for a 128-bit modulus. Instead, we use the following logic:

- If E is even, then computing A
^{E}is the same as computing (A^{2})^{E/2}. - If E is odd, then A
^{E}=A*A^{E-1}, for which the first bullet applies.

Therefore, every loop, we do the following:

- If E is odd, then we multiply A into the result, and we're left with the task of computing A
^{E-1}. - Now E is even no matter what, so we square A and divide E by 2.

To prevent the numbers from getting too large, we take mod() ahead of time with every product.

Takes the sine of a number (usually, an angle).

sin(*angle*)

**Menu Location**

Press the SIN button to enter sin(.

This command works on all calculators.

1 byte

The sin() command returns the sine of an angle measure. Naturally, the result depends on the angle mode the calculator is in: radian, degree, or (in AMS version 3.10) gradian. You can also use one of the ^{r}, °, ^{G} marks to specify an angle mode.

For many common angles, sin() can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in radian mode, sin() can be used with complex numbers as well.

```
:sin(30°)
1/2
:sin(x+2π)
sin(x)
:sin(πi/2)
sinh(π/2)*i
```

If sin() is applied to a list, it will take the sine of every element in the list.

# Advanced Uses

The sin() of a matrix is not (in general) the same as taking the sine of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Error Conditions

**230 - Dimension** happens when taking sin() of a matrix that isn't square.

**260 - Domain error** happens when taking sin() of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking sin() of a matrix that isn't diagonalizable.

# Related Commands

Jul |
24 — |
To bring the excitement of wiki editing to all visitors, a progress bar was added to the home page. |

Takes the cosine of a number (usually, an angle).

cos(*angle*)

**Menu Location**

Press the COS button to enter cos(.

This command works on all calculators.

1 byte

The `cos()` command returns the cosine of an angle measure. Naturally, the result depends on the angle mode the calculator is in: radian, degree, or (in AMS version 3.10) gradian. You can also use one of the ^{r}, `°`, ^{G} marks to specify an angle mode.

For many common angles, `cos()` can compute an exact result. Other angles, the calculator will leave alone unless it's in approximate mode (or unless you make it approximate), and then it will give a decimal approximation. As long as the calculator is in radian mode, `cos()` can be used with complex numbers as well.

```
:cos(60°)
1/2
:cos(x+2π)
cos(x)
:cos(πi/2)
cosh(π/2)
```

If `cos()` is applied to a list, it will take the cosine of every element in the list.

# Advanced Uses

The `cos()` of a matrix is not (in general) the same as taking the cosine of every element of the matrix. A different definition is used to compute the result; see Matrices and Their Commands. It requires the matrix to be square and diagonalizable in order to apply.

# Error Conditions

**230 - Dimension** happens when taking `cos()` of a matrix that isn't square.

**260 - Domain error** happens when taking `cos()` of a complex number in degree or gradian mode.

**665 - Matrix not diagonalizable** happens when taking `cos()` of a matrix that isn't diagonalizable.

# Related Commands

Inverts a point on the graph screen.

PtChg *x*, *y*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The `PtChg` command inverts a point on the graph screen — drawing it if it isn't already there, and erasing it otherwise. It uses point coordinates, which means that the result is determined by window variables: the x-coordinate must be between xmin and xmax, and the y-coordinate must be between ymin and ymax (with (xmin,ymin) being the bottom left and (xmax,ymax) the top right corner).

Unlike pixel commands such as `PxlChg`, however, `PtChg` won't give an error if the coordinates happen to be outside these bounds — it simply won't have any effect.

# Advanced Uses

`PtChg` can also be used with two lists of the same size. In that case, it will invert the points for every pair of elements (xlist[n], ylist[n]). This can be used as an alternative to plots (see `NewPlot`) to plot a set of points.

# Related Commands

Erases a point on the graph screen.

PtOff *x*, *y*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The PtOff command erases a point on the graph screen. It uses point coordinates, which means that the result is determined by window variables: the x-coordinate must be between xmin and xmax, and the y-coordinate must be between ymin and ymax (with (xmin,ymin) being the bottom left and (xmax,ymax) the top right corner).

Unlike pixel commands such as PxlOff, however, PtOff won't give an error if the coordinates happen to be outside these bounds — it simply won't have any effect.

# Advanced Uses

PtOff can also be used with two lists of the same size. In that case, it will erase the points for every pair of elements (xlist[n], ylist[n]).

# Related Commands

Draws a point on the graph screen.

PtOn *x*, *y*

*or*

PtOn {*x1, x2, x3*}, {*y1, y2, y3*}

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The `PtOn` command draws a point on the graph screen. It uses point coordinates, which means that the result is determined by window variables: the x-coordinate must be between xmin and xmax, and the y-coordinate must be between ymin and ymax (with (xmin,ymin) being the bottom left and (xmax,ymax) the top right corner).

Unlike pixel commands such as `PxlOn`, however, `PtOn` won't give an error if the coordinates happen to be outside these bounds — it simply won't have any effect (exactly the same as the 83+ version of `Pt-On`).

# Advanced Uses

`PtOn` can also be used with two lists of the same size. In that case, it will draw the points for every pair of elements (xlist[n], ylist[n]). This can be used as an alternative to plots (see `NewPlot`) to plot a set of points.

# Related Commands

Changes a pixel on the graph screen.

PxlChg *row*, *column*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The PxlChg command inverts a pixel on the graph screen: drawing it if it was erased, and erasing it otherwise. It uses pixel coordinates, which means that the result isn't affected by window variables like xmin and xmax: PxlChg P, Q will always change the pixel P rows down and Q columns across from the top left corner of the graph screen.

The range of possible values (anything outside this range will give an error) is:

- 0..76 for the row and 0..158 for the column, on a TI-89 or TI-89 Titanium.
- 0..102 for the row and 0..238 for the column, on a TI-92, TI-92 Plus, or Voyage 200.

Note that this doesn't match the output of getConfg() — the command is reliable for figuring out which of the two situations you're in, but the values it gives for window width/height are incorrect.

When in split screen mode, PxlChg still won't give an error as long as the values are in the regular range, but drawing a pixel off the screen will have no effect. The output of getConfg() will reflect the change in window size, but the values themselves still won't be correct.

In practice, PxlChg is the most useful of the pixel-toggling commands, because it can be used both to draw and to erase pixels.

# Advanced Uses

PxlChg can also be used with two lists of the same size. In that case, it will change the pixels for every pair of elements (rowlist[n], collist[n]). This is a rarely-used alternative to a command like XorPic, with the one advantage that it doesn't require a picture variable (of course, if you had two such lists, you could easily use NewPic to create a picture variable).

# Error Conditions

**260 - Domain error** happens when the pixel coordinates are not in the allowed range.

# Related Commands

Turns off a pixel on the graph screen.

PxlOff *row*, *column*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The PxlOff command erases a pixel on the graph screen. It uses pixel coordinates, which means that the result isn't affected by window variables like xmin and xmax: PxlOff P, Q will always erase the pixel P rows down and Q columns across from the top left corner of the graph screen.

The range of possible values (anything outside this range will give an error) is:

- 0..76 for the row and 0..158 for the column, on a TI-89 or TI-89 Titanium.
- 0..102 for the row and 0..238 for the column, on a TI-92, TI-92 Plus, or Voyage 200.

Note that this doesn't match the output of getConfg() — the command is reliable for figuring out which of the two situations you're in, but the values it gives for window width/height are incorrect.

When in split screen mode, PxlOff still won't give an error as long as the values are in the regular range, but erasing a pixel off the screen will have no effect. The output of getConfg() will reflect the change in window size, but the values themselves still won't be correct.

# Advanced Uses

PxlOff can also be used with two lists of the same size. In that case, it will erase the pixels for every pair of elements (rowlist[n], collist[n]). This is a rarely-used alternative to a command like AndPic, with the one advantage that it doesn't require a picture variable (of course, if you had two such lists, you could easily use NewPic to create a picture variable).

# Error Conditions

**260 - Domain error** happens when the pixel coordinates are not in the allowed range.

# Related Commands

Turns on a pixel on the graph screen.

PxlOn *row*, *column*

**Menu Location**

This command can't be found in any menu besides the command catalog.

This command works on all calculators.

2 bytes

The PxlOn command turns on a pixel on the graph screen. It uses pixel coordinates, which means that the result isn't affected by window variables like xmin and xmax: PxlOn P, Q will always turn on the pixel P rows down and Q columns across from the top left corner of the graph screen.

The range of possible values (anything outside this range will give an error) is:

- 0..76 for the row and 0..158 for the column, on a TI-89 or TI-89 Titanium.
- 0..102 for the row and 0..238 for the column, on a TI-92, TI-92 Plus, or Voyage 200.

Note that this doesn't match the output of getConfg() — the command is reliable for figuring out which of the two situations you're in, but the values it gives for window width/height are incorrect.

When in split screen mode, PxlOn still won't give an error as long as the values are in the regular range, but drawing a pixel off the screen will have no effect. The output of getConfg() will reflect the change in window size, but the values themselves still won't be correct.

# Advanced Uses

PxlOn can also be used with two lists of the same size. In that case, it will turn on the pixels for every pair of elements (rowlist[n], collist[n]). This is a rarely-used alternative to a command like RclPic, with the one advantage that it doesn't require a picture variable (of course, if you had two such lists, you could easily use NewPic to create a picture variable).

# Error Conditions

**260 - Domain error** happens when the pixel coordinates are not in the allowed range.

# Related Commands

I have the engine for drawing maps and storing data sort of done.

This is an RPG game that deals with controlling armies in a strategic fashion to accomplish goals.

There isn't much of a storyline yet.

*"Please excuse my dear Aunt Sally" —Anonymous*

To figure out order of operations, the calculator divides all the operations into 15 priority levels. When evaluating an expression, everything on one priority level is simplified (usually, going from left to right) before moving on to the next.

Of course, everything inside parentheses, brackets, and braces is simplified first.

Priority Level |
Operations on that level |

1 |
Everything inside parentheses ( ), brackets [ ], and braces { } |

2 |
Indirection (#)^{1} |

3 |
Function calls: everything with its own parenthesis, e.g. sin() |

4 |
Operators that go after their operand, e.g. ^{T}This also includes taking elements from lists and matrices with [ ] |

5 |
Exponentiation (^, .^)^{2} |

6 |
Negation (-) |

7 |
String concatenation (&) |

8 |
Multiplication and division (*, /, .*, ./) |

9 |
Addition and Subtraction (+, -, .+, .-) |

10 |
Equality relations: (=, ≠, >, ≥, <, ≤) |

11 |
Logical and arithmetic not^{3} |

12 |
Logical and arithmetic and |

13 |
Logical and arithmetic or, xor |

14 |
Constraint "with" operator (|) |

15 |
Store (→) |

The OS version 2.07 update introduced several commands for dealing with times and dates. Some of these rely on the built-in clock, while others are used for formatting.

TI-84+ programmers will not find many differences in function here — these commands were added to both calculator series at the same time, and are almost exactly the same. The only difference is the addition of the getTmZn() and setTmZn() commands, and the absence of a days-between-dates command.

## Low-Level Commands

**startTmr()**— This command returns the current value of a timer that is updated every second when the clock is enabled. This value doesn't correspond to any actual time, but can be used with checkTmr() to get a time difference.**checkTmr()**— checkTmr(t) is equivalent to startTmr()-t. This can be used to get the time elapsed since startTmr was used.**ClockOn**,**ClockOff**— Enables or disables the hardware clock.**isClkOn()**— Tests if the clock is enabled or not.

## Time Commands

**setTime()**— Sets the current time, in hours, minutes, and seconds. If the clock is enabled, this time will be updated every second.**getTime()**— Returns the current time as the list {hours, minutes, seconds}. This command is unaffected by time format.**setTmFmt()**— Sets the time format - 12 hour, or 24 hour.**getTmFmt()**— Returns this time format setting.**getTmStr()**— Returns the current time as a string, affected by time format (though you can override it with an optional argument).**setTmZn()**— Sets the current time zone, as an offset (in minutes) from GMT.**getTmZn()**— Returns the current time zone.

## Date Commands

**setDate()**— Sets the current date (year, month, and day). If the clock is enabled, this date will be updated as needed.**getDate()**— Returns the current date as the list {year, month, day}. This command is unaffected by date format.**setDtFmt()**— Sets the date format - 1 for month/day/year, 2 for day/month/year, or 3 for year/month/day.**getDtFmt()**— Returns this date format setting.**getDtStr()**— Returns the current date as a string, affected by date format (though you can override it with an optional argument).

## Time/Date Manipulation

.