The left() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:left

The length( Command

Returns the length of a string.

length(*string*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to access the command catalog
- L to skip to commands starting with L
- scroll down to length( and select it

TI-83/84/+/SE

2 bytes

This command is used to determine the length of a string. Unlike the dim( command for lists and matrices, it cannot be used to change this length, as there is no null character for strings (the null value is 0 for lists and matrices).

```
:length("HELLO
5
```

Keep in mind that the length is measured in the number of tokens, and not the number of letters in the string. For example, although the sin( command contains 4 characters ("s", "i", "n", and "("), it will only add 1 to the total length of a string it's in. The execution time for length( is directly proportional to the length of the string.

# Advanced Uses

The code for looping over each character (technically, each token) of a string involves length(:

```
:For(N,1,length(Str1
...
use sub(Str1,N,1 for the Nth character
...
:End
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/length

The Line( Command

Draws a line at any angle.

Line(X_{1},Y_{1},X_{2},Y_{2}*[,erase,color,style]*)

Press:

- 2nd DRAW to enter the draw menu
- 2 to insert the Line( token, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The Line( command is used to draw lines at any angle, as opposed to only drawing vertical or horizontal lines. Line(X_{1},Y_{1},X_{2},Y_{2}) will draw a line from (X_{1},Y_{1}) to (X_{2},Y_{2}). Line( is affected by the window settings, although you can use a friendly window so there is no impact on the command.

`:Line(5,5,20,3)`

# Advanced Uses

Line has an optional fifth argument. It can be any real number, but the default is one. If the fifth argument, *erase*, is something other than 0, then it will simply draw the line. If *erase* is 0, then it will erase the line.

`:Line(5,5,20,3,0)`

Leave off the ending argument if you are just drawing the line.

```
:Line(5,5,20,3,1)
can be
:Line(5,5,20,3)
```

The ending argument can be a formula, which is useful for movement applications and other things such as health bars where the lines drawn are constantly different. The following draws or erases a line depending on whether a key is pressed.

```
:getKey
:Line(5,5,20,3,not(Ans
```

If working on a TI 84+CSE or TI 84+CE, then the fifth argument of the Line( command can be a color name or ID number:

`:Line(5,5,20,3,BROWN`

The last argument, line style, is an optional argument that chooses what style of line to draw on the color calculators.

```
1 pixel wide line
:Line(5,5,20,3,RED,1
2 pixel wide line
:Line(5,5,20,3,RED,2
shaded above
:Line(5,5,20,3,RED,3
shaded below
:Line(5,5,20,3,RED,4
```

# Command Timings

If you are drawing horizontal or vertical lines that stretch the entire graph screen, such as a border, it is better to use Vertical or Horizontal. These are smaller and are usually faster as well.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/line

The LinReg(a+bx) Command

Calculates the best fit line through a set of points.

LinReg(a+bx) [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 8 to select LinReg(a+bx), or use arrows

TI-83/84/+/SE

1 byte

The LinReg(a+bx) command is one of several that can calculate the line of best fit through a set of points (it differs from LinReg(ax+b) only in the format of its output). To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points.

In its simplest form, LinReg(a+bx) takes no arguments, and calculates a best fit line through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LinReg(a+bx)
```

On the home screen, or as the last line of a program, this will display the equation of the line of best fit: you'll be shown the format, y=a+bx, and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, r, and r² will be set as well. These latter two variables will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

You don't have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:LinReg(a+bx) ∟FAT,∟CALS
```

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the line of best fit will be in terms of X anyway, this doesn't make much sense.

An example of LinReg(a+bx) with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:LinReg(a+bx) ∟FAT,∟CALS,∟FREQ,Y₁
```

# Advanced Uses (for programmers)

LinReg(a+bx), along with LinReg(ax+b), can be used to convert a number to a string.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/linreg-a-bx

The LinReg(ax+b) Command

Calculates the best fit line through a set of points.

LinReg(ax+b) [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 4 to select LinReg(ax+b), or use arrows

TI-83/84/+/SE

1 byte

The LinReg(ax+b) is one of several commands that can calculate the line of best fit through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points.

In its simplest form, LinReg(ax+b) takes no arguments, and calculates a best fit line through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LinReg(ax+b)
```

On the home screen, or as the last line of a program, this will display the equation of the line of best fit: you'll be shown the format, y=ax+b, and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, r, and r² will be set as well. These latter two variables will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

You don't have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:LinReg(ax+b) ∟FAT,∟CALS
```

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the line of best fit will be in terms of X anyway, this doesn't make much sense.

An example of LinReg(ax+b) with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:LinReg(ax+b) ∟FAT,∟CALS,∟FREQ,Y₁
```

# Advanced Uses (for programmers)

LinReg(ax+b), along with LinReg(a+bx), can be used to convert a number to a string.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/linreg-ax-b

The LinRegTInt Command

Calculates the linear regression of two sets of data with a confidence interval for the slope coefficient.

LinRegTInt [*x-list*, *y-list*, [*frequency*], [*confidence level*], [*equation*]]

Press:

- STAT to access the statistics menu
- RIGHT to access the TESTS submenu
- ALPHA G to select LinRegTInt, or use arrows

TI-84+(SE) OS 2.30 or greater

2 bytes

Like LinReg(ax+b) and similar commands, LinRegTInt finds the best fit line through a set of points. However, LinRegTInt adds another method of checking the quality of the fit, by calculating a t confidence interval for the slope b. If the confidence interval calculated contains zero, the data supplied is insufficient to conclude a linear relation between the variables.

To use LinRegTInt, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points. You do not have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command.

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they are L₁ and L₂.

You can supply a confidence level probability as the fourth argument. It should be a real number between zero and one. If not supplied, the default value is .95. (95% confidence level) If you need to specify a different confidence level, you must enter the names of the lists as well, even if they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last.

For example, both

```
:{4,5,6,7,8→L₁
:{1,2,3,3.5,4.5→L₂
:LinRegTInt
```

and

```
:{4,5,6,7,8→X
:{1,2,3,3.5,4.5→Y
:{1,1,1,1,1→FREQ
:LinRegTTest ∟X,∟Y,∟FREQ,.95,Y₁
```

will give the following output:

```
LinRegTInt
y=a+bx
(.69088,1.0091)
b=.85
df=3
s=.158113883
a=-2.3
r²=.9897260274
r=.9948497512
```

(the last two lines will only appear if diagnostics have been turned on - see DiagnosticOn)

- The first line shows the confidence interval containing the slope of the fitted line; as mentioned above, if the interval contains 0, it cannot be concluded that the two variables have a linear relationship. Also, the smaller the difference between the two numbers, the more precision that can be attributed to the calculated slope.
- df is the degrees of freedom, equal to the number of points minus two.
- a and b are the parameters of the equation y=a+bx, the regression line we've calculated
- s is the standard error about the line, a measure of the typical size of a residual (the numbers stored in ∟RESID). It is the square root of the sum of squares of the residuals divided by the degrees of freedom. Smaller values indicate that the points tend to be close to the fitted line, while large values indicate scattering.
- r² and r are respectively the coefficients of determination and correlation: a value near 1 or -1 for the former, and near 1 for the latter, indicates a good fit.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/linregtint

The LinRegTTest Command

Calculates the best fit line through a set of points, then uses a significance test on the slope of the line.

LinRegTTest [*x-list*, *y-list*, [*frequency*], [*alternative*], [*equation*]

Press:

- STAT to access the statistics menu
- RIGHT to access the TESTS submenu
- ALPHA E to select LinRegTTest, or use arrows

Change the last keypress to ALPHA F on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

Like `LinReg(ax+b)` and similar commands, `LinRegTTest` finds the best fit line through a set of points. However, `LinRegTTest` adds another method of checking the quality of the fit, by performing a `t-test` on the slope, testing the null hypothesis that the slope of the true best fit line is 0 (which implies the absence of correlation between the two variables, since a relation with a slope of zero means the x-variable does not affect the y-variable at all). If the p-value of the test is not low enough, then there is not enough data to assume a linear relation between the variables.

To use `LinRegTTest`, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points.

In its simplest form, `LinRegTTest` takes no arguments, and calculates a best fit line through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LinRegTTest
```

The output will look as follows:

```
LinRegTTest
y=a+bx
β≠0 and ρ≠0
t=53.71561274
p=4.2285344e-8
df=5
a=145.3808831
b=13.09073265
s=5.913823968
r²=.9982701159
r=.9991346836
```

(the last two lines will only appear if diagnostics have been turned on - see

`DiagnosticOn`)

- β and ρ: this line represents the alternative hypothesis. β is the true value of the statistic b (it is what we would get if the regression was done on the entire population, rather than a sample); ρ is the true value of the statistic r.
- t is the test statistic, used to calculate p.
- p is the probability that we'd get a correlation this strong by chance, assuming the null hypothesis that there is no actual correlation. When it's low, as here, this is evidence against the null hypothesis. Since p<.01, the data is significant on a 1% level, so we reject the null hypothesis and conclude that there is a correlation.
- df is the degrees of freedom, equal to the number of points minus two
- a and b are the parameters of the equation y=a+bx, the regression line we've calculated
- s is the standard error about the line, a measure of the typical size of a residual (the numbers stored in ∟RESID). It is the square root of the sum of squares of the residuals divided by the degrees of freedom. Smaller values indicate that the points tend to be close to the fitted line, while large values indicate scattering.
- r² and r are respectively the coefficients of determination and correlation: a value near 1 or -1 for the former, and near 1 for the latter, indicates a good fit.

You do not have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:LinRegTTest ∟FAT,∟CALS
```

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they are L₁ and L₂.

You can add the *alternative* argument to change the alternative hypothesis from the default (β≠0 and ρ≠0). This is used when you have prior knowledge either that a negative relation is impossible, or that a positive one is impossible. The values of the *alternative* argument are as follows:

- negative: the alternative hypothesis is β<0 and ρ<0 (we have prior knowledge that there can be no positive relation)
- 0: the alternative hypothesis is β≠0 and ρ≠0 (we have no prior knowledge)
- positive: the alternative hypothesis is β>0 and ρ>0 (we have prior knowledge that there can be no negative relation)

Obviously, if you want the alternative hypothesis to be β≠0 and ρ≠0, the default, you don't need to supply this argument. However, if you do, you must enter the names of the lists as well, even if they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the line of best fit will be in terms of X anyway, this doesn't make much sense.

An example of `LinRegTTest` with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:LinRegTTest ∟FAT,∟CALS,∟FREQ,1,Y₁
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/linregttest

The List►matr( Command

Builds a matrix from one or more lists.

List►matr(*list1*, [*list2*, …], *matrix*

Press:

- MATRX (on the 83) or 2nd MATRX (83+ or higher) to access the matrix menu
- LEFT to access the MATH submenu
- 9 to select List►matr(, or use arrows.

Alternatively, press:

- 2nd LIST to access the list menu
- LEFT to access the OPS submenu
- 0 to select List►matr(, or use arrows

TI-83/84/+/SE

2 bytes

The List►matr( builds a matrix by combining several list expressions, and stores it to the specified variable ([A] through [J]). Each list specifies a column of the matrix: the first list will be stored down the first (leftmost) column, the second list down the second column, and so on. For example:

```
List►matr({1,2,3},{10,20,30},{100,200,300},[A]
Done
[A]
[[1 10 100]
[2 20 200]
[3 30 300]]
```

# Advanced Uses

The calculator can actually handle lists that are not the same size. It will pad zeroes to the shorter lists, until they have the same length as the longest list.

```
List►matr({1,2,3},{10},{100,200},[A]
Done
[A]
[[1 10 100]
[2 0 200]
[3 0 0]]
```

# Error Conditions

**ERR:ARGUMENT**is thrown if there are more than 99 lists (since a matrix can be at most 99x99)**ERR:INVALID DIM**is thrown if one of the lists is longer than 99 elements (since a matrix can be at most 99x99)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/list-matr

The ln( Command

Computes the (principal branch of the) natural logarithm.

ln(*value*)

Press the LN key to paste ln(.

TI-83/84/+/SE

1 byte

The ln( command computes the natural logarithm of a value — the exponent to which the constant *e* must be raised, to get that value. This makes it the inverse of the *e^(* command.

ln( is a real number for all positive real values. For negative numbers, ln( is an imaginary number (so taking ln( of a negative number will cause ERR:NONREAL ANS to be thrown in Real mode), and of course it's a complex number for complex values. ln( is not defined at 0, even if you're in a complex mode.

# Advanced Uses

Using either the ln( or the log( command, logarithms of any base can be calculated, using the identity:

(1)So, to take the base B log of a number X, you could use either of the following equivalent ways:

`:log(X)/log(B)`

`:ln(X)/ln(B)`

This is the exponent to which B must be raised, to get X.

# Error Conditions

**ERR:DOMAIN**when calculating ln(0).**ERR:NONREAL ANS**if taking ln( of a negative number in Real mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/ln

The LnReg Command

Calculates the best fit logarithmic curve through a set of points.

LnReg [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 9 to select LnReg, or use arrows

TI-83/84/+/SE

1 byte

LnReg tries to fit a logarithmic curve (y=a+b*lnx) through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points.

The calculator does this regression by taking the natural log ln( of the x-coordinates (this isn't stored anywhere) and then doing a linear regression. This means that if any x-coordinates are negative or 0, the calculator will instantly quit with ERR:DOMAIN.

In its simplest form, LnReg takes no arguments, and fits a logarithmic curve through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LnReg
```

On the home screen, or as the last line of a program, this will display the equation of the curve: you'll be shown the format, y=a+b*ln(x), and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, r, and r² will be set as well. These latter two variables will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

You don't have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:LnReg ∟FAT,∟CALS
```

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the curve's equation is stored to this variable automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the equation will be in terms of X anyway, this doesn't make much sense.

An example of LnReg with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:LnReg ∟FAT,∟CALS,∟FREQ,Y₁
```

# Error Conditions

**ERR:DOMAIN**is thrown if any x-coordinates are negative or 0.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/lnreg

The Local Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:local

The log( Command

Computes the (principal branch of the) base 10 logarithm.

log(*value*)

Press the LOG key to paste log(.

TI-83/84/+/SE

1 byte

The log( command computes the base 10 logarithm of a value — the exponent to which 10 must be raised, to get that value. This makes it the inverse of the 10^( command.

log( is a real number for all positive real values. For negative numbers, log( is an imaginary number (so taking log( of a negative number will cause ERR:NONREAL ANS to be thrown in Real mode), and of course it's a complex number for complex values. log( is not defined at 0, even if you're in a complex mode.

# Advanced Uses

Using either the ln( or the log( command, logarithms of any base can be calculated, using the identity:

(1)So, to take the base B log of a number X, you could use either of the following equivalent ways:

`:log(X)/log(B)`

`:ln(X)/ln(B)`

This is the exponent to which B must be raised, to get X.

The base 10 logarithm specifically can be used to calculate the number of digits a whole number has:

`:1+int(log(N))`

This will return the number of digits N has, if N is a whole number. If N is a decimal, it will ignore the decimal digits of N.

# Error Conditions

**ERR:DOMAIN**when calculating log(0).**ERR:NONREAL ANS**if taking log( of a negative number in Real mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/log

The Logistic Command

Calculates the least-squares best fit logistic curve through a set of points.

Logistic [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- ALPHA B to select Logistic, or use arrows

TI-83/84/+/SE

1 byte

Logistic tries to fit a logistic curve (y=*c*/(1+*a***e*^{-b*x})) through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the *i*th element of one list matches up with the *i*th element of the other list. L₁ and L₂ are the default lists used, and the List Editor (STAT > Edit…) is a useful window for entering the points.

The explanation for the odd format of a logistic curve is that it is the solution to a differential equation that models population growth with a limiting factor: a population that grows according to a logistic curve will start out growing exponentially, but will slow down before reaching a carrying capacity and approach this critical value without reaching it. The logistic curve also has applications, for example, in physics.

In its simplest form, Logistic takes no arguments, and fits a logistic curve through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:Logistic
```

On the home screen, or as the last line of a program, this will display the equation of the curve: you'll be shown the format, y=*c*/(1+*a**e*^(-*b*x)), and the values of *a*, *b* and *c*. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables *a*, *b*, and *c* will be set as well. There are no correlation statistics available for Logistic even if Diagnostic Mode is turned on (see DiagnosticOn and DiagnosticOff).

You do not have to do the regression on L₁ and L₂, in which case you will have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:Logistic ∟FAT,∟CALS
```

Finally, you can enter an equation variable (such as Y₁) after the command, so that the curve's equation is stored to this variable automatically. This does not require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the equation will be in terms of X anyway, this doesn't make much sense.

An example of Logistic with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:Logistic ∟FAT,∟CALS,∟FREQ,Y₁
```

Warning: if your data is not even slightly logistic in nature, then the calculator may return an error such as ERR:OVERFLOW. This happens when the calculator tries to calculate a carrying capacity, *c*, for the data, but since the rate of change in data doesn't seem to be slowing down, it assumes that the carrying capacity is still very far off, and tries large values for it. These values may get so large as to cause an overflow.

The Levenberg-Marquardt nonlinear least-squares algorithm is used by Logistic.

# Error Conditions

**ERR:ARGUMENT**is thrown by using only one list.**ERR:DIM MISMATCH**is thrown if the dimensions of two lists do not match.**ERR:DOMAIN**is thrown if Logistic is left without using lists or enough instructions.**ERR:DATA TYPE**is thrown if lists are not used, or a list contains a number like "4i".

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/logistic

The Loop Command

Repeats a block of code forever.

:Loop

*(block of code)*

:EndLoop

**Menu Location**

Starting in the program editor:

- Press F2 to enter the Control menu.
- Press 6 to paste Loop..EndLoop.

This command works on all calculators.

2 bytes for Loop;

4 bytes for EndLoop.

A Loop..EndLoop block is used to make the code inside the Loop repeat forever. For example, the following code will keep printing "Hello!" until you break out of the program with the ON key or the calculator runs out of batteries:

```
:Loop
: Disp "Hello!"
:EndLoop
Hello!
Hello!
Hello!
...
```

Generally, Loop isn't used just like that, because having to end a program with the ON key lacks style. There are two ways to break out of the loop:

- using Goto, you can jump to somewhere else in the program.
- using Exit, you can exit the loop, continuing the program immediately after the EndLoop command.

Generally, using Exit is considered more stylish — and it's easier to read the code, because you don't have to search the entire program for the Goto's matching label.

# Error Conditions

**730 - Missing start or end of block syntax** happens when the Loop is missing an EndLoop, or vice versa.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:loop

The Manual-Fit Command

Allows user to create a line of best fit and modify it

Manual-Fit {*Function*}

Under Statistics or Catalog

- Press STAT
- Go to CALC
- Press ALPHA D (or scroll to bottom)

TI-84+/SE (OS 2.30 or greater)

2 bytes

This command will allow the user to create a line of best fit according to their judgment. Activate the command by just pasting it on the screen. Then, click on a point for the line to begin followed by an end point. The calculator will then draw your line and display its equation at the top left corner of the screen. You can modify it by selecting the equation part and pressing enter. Input your desired value for the calculator to change it. The equation is stored into Y₁. If you specify what equation you want to store it to, then it will store to that function.

```
:Manual-Fit
(this activates the command and stores to Y₁
:Manual-Fit Y₃
(this stores to Y₃ instead)
```

One note about this is that it only graphs linear models. It is written in the form

*y=mx+b*, and you can modify

*m*or

*b*.

Exit out by 2nd QUIT.

# Advanced Uses

This command is able to function in a program, but you cannot modify the values. This is a unique form of gathering user input that stores into the specified Y= function. Of course, this draws a line across the graph screen. You can then convert the function into a different form, like this:

```
:Manual-Fit
:Equ▶String(Y₁,Str1
```

This will turn the equation the user drew into a string which can then be used for output or calculations.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/manual-fit

The MATHPRINT Command

Mode command that puts the calculator into Classic mode.

MATHPRINT

Press:

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

Alternatively, use the catalog.

TI-84 2.53MP or later

2 bytes

MATHPRINT will put the calculator into Mathprint mode as opposed to Classic mode. In MathPrint mode, enhanced homescreen input formatting is available. The Classic mode will make the calculator display everything as a calculator of lower 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

When in Mathprint mode, text and numbers are displayed much slower than classic on the home screen and the function menus load slower. This can be inconvenient in games that use the home screen, but can also make solving equations that involve fractions and exponents easier as the numbers are in their correct positions and are the appropriate size.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/mathprint-mode

The Matr►list( Command

Stores one or more columns of a given matrix to list variables

Matr►list(*matrix*, *list-var1*, [*list-var2*, …])

Matr►list(*matrix*, *column#*, *list-var*)

Press:

- MATRX (on the 83) or 2nd MATRX (83+ or higher) to access the matrix menu
- LEFT to access the MATH submenu
- 8 to select Matr►list(, or use arrows.

TI-83/84/+/SE

2 bytes

The Matr►list( command stores one or more columns of a matrix (or expression resulting in a matrix) to list variables. The syntax is simple: first enter the matrix, then enter the list or lists you want to store columns to. The first (leftmost) column will be stored to the first list entered, the second column will be stored to the second list, and so on. For example:

```
[[11,12,13,14][21,22,23,24][31,32,33,34
[[11 12 13 14]
[21 22 23 24]
[31 32 33 34]]
Matr►list(Ans,L1,L2
Done
L1
{11 21 31}
L2
{12 22 32}
```

If there are more lists than columns in the matrix when doing Matr►list(, the extra lists will be ignored.

Matr►list( can also be used to extract a specific column of a matrix to a list. The order of the arguments is: matrix, column number, list name.

```
[[11,12,13,14][21,22,23,24][31,32,33,34
[[11 12 13 14]
[21 22 23 24]
[31 32 33 34]]
Matr►list(Ans,4,L1
Done
L1
{14 24 34}
```

# Advanced Uses

While the command deals with columns, occasionally you might want to store the matrix to lists by rows. The ^{T} (transpose) command is your friend here: applying it to the matrix will flip it diagonally, so that all rows will become columns and vice-versa. For example:

[[11,12,13,14][21,22,23,24][31,32,33,34

[[11 12 13 14]

[21 22 23 24]

[31 32 33 34]]

Matr►list(Ans^{T},L_{1},L_{2}

Done

L_{1}

{11 12 13 14}

L_{2}

{21 22 23 24}

# Optimizations

When using Matr►list( to store to named lists, only the first list must have an ∟ in front of its name — it can be omitted for the rest. For example:

```
:Matr►list([A],∟COL1,∟COL2,∟COL3
can be
:Matr►list([A],∟COL1,COL2,COL3
```

On the other hand, when storing a specific column of a matrix to a named list, the list does not need to be preceded by an ∟.

```
:Matr►list([A],N,∟COL1
can be
:Matr►list([A],N,COL1
```

# Related Commands

- List►matr(
^{T}(transpose)

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/matr-list

The max( Command

Returns the maximum of two elements or of a list.

- for two numbers: max(
*x*,*y*) - for a list: max(
*list*) - comparing a number to each element of a list: max(
*x*,*list*) or max(*list*,*x*) - pairwise comparing two lists: max(
*list1*,*list2*)

Press:

- MATH to access the math menu.
- RIGHT to access the NUM submenu.
- 7 to select max(, or use arrows.

Alternatively, press:

- 2nd LIST to access the list menu.
- LEFT to access the MATH submenu.
- 2 to select max(, or use arrows.

TI-83/84/+/SE

1 byte

max(*x*,*y*) returns the largest of the two numbers *x* and *y*. max(*list*) returns the largest element of *list*. max(*list1*,*list2*) returns the pairwise maxima of the two lists. max(*list1*,*x*) (equivalently, max(*x*,*list1*)) returns a list whose elements are the larger of *x* or the corresponding element of the original list.

```
max(2,3)
3
max({2,3,4})
4
max({1,3},{4,2})
{4 3}
max({1,3},2)
{2 3}
```

Unlike comparison operators such as < and >, max( can also compare complex numbers. To do this, both arguments must be complex — either complex numbers or complex lists: max(2,*i*) will throw an error even though max(2+0*i*,*i*) won't. In the case of complex numbers, the number with the largest absolute value will be returned. When the two numbers have the same absolute value, the first one will be returned: max(*i*,-*i*) returns *i* and max(-*i*,*i*) returns -*i*.

# Advanced Uses

max( can be used in Boolean comparisons to see if at least one of a list is 1 (true) — useful because commands like If or While only deal with numbers, and not lists, but comparisons like L1=L2 return a list of values. In general, the behavior you want varies, and you will use the min( function or the max( function accordingly.

Using max( will give you a lenient test — if any one element of the list is 1 (true), then the max( of the list is true — this is equivalent to putting an 'or' in between every element. For example, this tests if K is equal to any of 24, 25, 26, or 34 (the getKey arrow key values):

```
:If max(K={24,25,26,34
:Disp "ARROW KEY
```

To get the element of a real list with the greatest absolute value, use imag(max(iAns.

# Error Conditions

**ERR:DATA TYPE**is thrown when comparing a real and a complex number. This can be avoided by adding +0*i*to the real number (or*i^4*right after it, for those who are familiar with complex numbers)**ERR:DIM MISMATCH**is thrown, when using max( with two lists, if they have different dimensions.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/max

The mean( Command

Finds the mean (the average) of a list.

mean(*list*,[*freqlist*])

Press:

- 2ND LIST to enter the LIST menu.
- LEFT to enter the MATH submenu.
- 3 to select mean(, or use arrows.

TI-83/84/+/SE

1 byte

The mean( command finds the mean, or the average, of a list. It's pretty elementary. It takes a list of real numbers as a parameter. For example:

```
:Prompt L1
:Disp "MEAN OF L1",mean(L1
```

That's not all, however. Awesome as the mean( command is, it can also take a frequency list argument, for situations when your elements occur more than once. For example:

`:Disp mean({1,2,3},{5,4,4})`

is short for

`:mean({1,1,1,1,1,2,2,2,2,3,3,3,3})`

The frequency list {5,4,4} means that the first element, 1, occurs 5 times, the second element, 2, occurs 4 times, and the third element, 3, occurs 4 times.

# Advanced Uses

You can also use the frequency list version of mean( to calculate weighted averages. For example, suppose you're trying to average grades in a class where homework is worth 50%, quizzes 20%, and tests 30%. You have a 90% average on homework, 75% on quizzes (didn't study too well), but 95% average on tests. You can now calculate your grade with the mean( command:

`:mean({90,75,95},{50,20,30`

You should get a 88.5 if you did everything right.

Frequency lists don't need to be whole numbers. Amazing as that may sound, your calculator can handle being told that one element of the list occurs 1/3 of a time, and another occurs 22.7 times. It can even handle a frequency of 0 - it will just ignore that element, as though it weren't there. In particular, mean(L1,L2) is effectively equivalent to sum (L1*L2)/sum(L2).

One caveat, though - if all of the elements occur 0 times, there's nothing to take an average of and your calculator will throw an error.

# Error Conditions

**ERR:DATA TYPE**is thrown, among other cases, if the data list is complex, or if the frequencies are not all positive and real.**ERR:DIM MISMATCH**is thrown if the frequency list and the data list have a different number of elements.**ERR:DIVIDE BY 0**is thrown if the frequency list's elements are all 0.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/mean

The median( Command

Finds the median of a list.

median(*list*,[*freqlist*])

Press:

- 2ND LIST to enter the LIST menu.
- LEFT to enter the MATH submenu.
- 4 to select median(, or use arrows.

TI-83/84/+/SE

1 byte

The median( command finds the median of a list. It takes a list of real numbers as a parameter. For example:

```
:Prompt L1
:Disp "MEDIAN OF L1",median(L1
```

That's not all, however. Awesome as the median( command is, it can also take a frequency list argument, for situations when your elements occur more than once. For example:

`:Disp median({1,2,3},{5,4,4})`

is short for

`:median({1,1,1,1,1,2,2,2,2,3,3,3,3})`

The frequency list {5,4,4} means that the first element, 1, occurs 5 times, the second element, 2, occurs 4 times, and the third element, 3, occurs 4 times.

# Advanced Uses

Frequency lists don't need to be whole numbers. Amazing as that may sound, your calculator can handle being told that one element of the list occurs 1/3 of a time, and another occurs 22.7 times. It can even handle a frequency of 0 - it will just ignore that element, as though it weren't there. One caveat, though - if all of the elements occur 0 times, there's nothing to take the median of and your calculator will throw an error.

# Error Conditions

**ERR:DATA TYPE**is thrown, among other cases, if the data list is complex, or if the frequencies are not all positive and real.**ERR:DIM MISMATCH**is thrown if the frequency list and the data list have a different number of elements.**ERR:DIVIDE BY 0**is thrown if the frequency list's elements are all 0.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/median

The Med-Med Command

Calculates the median fit line through a set of points.

Med-Med [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 3 to select Med-Med, or use arrows

TI-83/84/+/SE

1 byte

The Med-Med command is one of several that can calculate a line of best fit through a set of points. However, unlike the LinReg(ax+b) and LinReg(a+bx) commands, which generate the same result in different formats, Med-Med produces a different line entirely, known as the 'median fit line' or the 'median-median model'. This model is more resistant to outliers than the best-fit line produced by LinReg(ax+b)-type commands, in much the same way that the median of a set of data is more resistant to outliers than the mean. The process of calculating a median fit line is roughly as follows (reference):

- Divide the data into three equal groups by their x-values (the smallest third, the middle third, and the largest third)
- Find the "median point" for each group by pairing the median x-value in the group with the median y-value (this need not be an actual data point).
- These points are stored to (x₁,y₁), (x₂,y₂), and (x₃,y₃) on the calculator.
- Find the line passing through the median point for the first and third group.
- Shift this line one-third of the way toward the median point of the second group.

To use the Med-Med command, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points. As you can see from the steps shown above, Med-Med requires at least three points with different x-values to work with.

In its simplest form, Med-Med takes no arguments, and calculates a regression line through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:Med-Med
```

On the home screen, or as the last line of a program, this will display the equation of the regression line: you'll be shown the format, y=ax+b, and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a and b will be set as well. There are no diagnostics available for the Med-Med command, so r and r² will not be calculated or displayed even if you run DiagnosticOn.

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:Med-Med ∟FAT,∟CALS
```

An example of Med-Med with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:Med-Med ∟FAT,∟CALS,∟FREQ,Y₁
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/med-med

The Menu( Command

Displays a generic menu on the home screen, with up to seven (or nine on color calculators) options for the user to select.

Menu("*Title*","*Option 1*",Label 1[,…,"*Option 7*",Label 7])

While editing a program, press:

- PRGM to enter the PRGM menu
- Press ALPHA PRGM to choose Menu( or use arrows

TI-83/84/+/SE

1 byte

Menus are used for organization, to provide a list of choices for the user to select from, as well as a good way for users to interact with and navigate programs. Although using the Menu( command requires branching (which is generally frowned upon in most circumstances), the menu looks like a generic built-in menu, so it is familiar and easy to use for the user.

When the Menu( command is encountered during a program, the menu screen is displayed with the specified menu title in white-on-black text on the top line and each menu item listed below on its own line, the pause indicator turns on, and execution pauses until the user selects a menu item. There is a cursor that the user can move up and down the menu to select a menu item.

The menu title can be 16 characters or less on monochrome calculators (because of the screen width), and 26 characters or less on color calculators, and must be enclosed in a pair of quotation marks. The menu title looks best if you center it on the screen (using spaces to fill in the rest of the line), so that the entire top line will be highlighted. The menu can have up to seven menu items on monochrome and up to nine on color calculators (because of the screen height and the menu title on top).

After the menu title, you put a comma and then the menu items. There are two parts to a menu item: the text that will be displayed on the screen and the label that program execution will continue at if the user presses ENTER on the menu item or presses its corresponding number. The text can be fourteen characters or less on monochrome and 24 or less on color (because the menu item number is displayed on the left) and must be enclosed in a pair of quotation marks, and you have to separate the text and label with a comma.

```
PROGRAM:MENU
:Lbl NY
:Menu(" Select A Place ","NY",NY,"LA",NY,"MN",MN
:Lbl MN
:Disp "Good Choice!
```

# Advanced Uses

When a program needs more than seven (or nine on color calculators) menu items, you will have to create another menu and then link to that menu from the first menu with one of the menu items. Similarly, you can also have two menu items go to the same label (you do not need two labels if they are right next to each other).

If you get tired of using the Menu( command every time you want to make a menu, the alternative is to make your own custom menu. A custom menu provides a richer experience for the user, and isn't much more work than using the Menu( command. In addition, as you get more experienced as a programmer, you'll come to enjoy using custom menus.

You can use a string variable for the menu title and menu item text instead of the text in quotes, which may sometimes be smaller if the text is used at other places in the program. Similarly, its possible to place all the menu titles in one string variable, and then just access the respective menu title as a substring Unfortunately, variables will not work for the menu item labels. You can also leave the menu title blank to give the illusion that there is no menu title by using two quotes side by side (i.e. "").

For many programs, including text-based programs (where menus are heavily used), there is a main menu that is used for navigating to the different parts of the program. While each program's main menu is unique, two of the most standard menu items on a main menu are Start and Quit — Start goes to the beginning of the program, while Quit goes to the end. It is also fairly common to place a label right before the main menu, so you can return to it again later in the program.

# Problems

1. There is only one line for the title.

2. There are only seven (or nine on color calculators) slots for the menu items and no scrolling (you CAN add a "next" at the bottom, but that just looks bad, especially if you have a "back" and/or "exit" down there already)

3. The screen refreshes or blinks when you press down at the bottom to go back to the top.

4. During the loading of the menu, you can see what is written on the home screen.

# Optimization

Because the Menu( command displays the menu screen instead of clearing the home screen, you do not need to put the ClrHome command before it.

```
:ClrHome
:Menu("Choose","Right",1,"Wrong",2
Remove ClrHome
:Menu("Choose","Right",1,"Wrong",2
```

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.**ERR:LABEL**is thrown when an option is chosen whose label doesn't exist.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/menu

The mid() Command

Selects a substring from a string, or a sublist from a list.

mid(*string-or-list*,*start*[,*count*])

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press D to enter the String submenu.
- Press 5 to paste mid(.

This command works on all calculators.

2 bytes

The mid() command can be used in two ways: to select a sublist from a list, or a substring from a string. In both cases, the syntax is similar:

- the first argument is the list or string to start with.
- the second argument is the number of the first element or character to include,
- the third argument is how long the sublist or substring should be.

That is, mid(*list*,*x*,*y*) will give a list of the *x*^{th} element, (*x*+1)^{th} element, and so on up to the (*x*+*y*-1)^{th} element of *list*. If *x*=2 and *y*=3, this will give a 3-element list starting from the 2^{nd} element.

```
:mid({1,2,3,4,5},2,3)
{2 3 4}
```

For strings, mid(

*string*,

*x*,

*y*) will give a

*y*-character-long string starting from the

*x*

^{th}character of

*string*:

```
:mid("TI-Basic",2,5)
"I-Bas"
```

In practice, the mid() command is rarely useful for lists, although it might occasionally come in handy. It really shines with strings, since there is no other way to select a character from within a string. Whereas you might use list[5] to select the 5^{th} element of a list, with a string you have to write mid(string,5,1) to get that single character.

A noteworthy feature of mid() is that out-of-bounds indices don't cause an error. If the length you give for the substring or sublist is more than the number of remaining characters or elements, then it will give you as many as there are, instead. If the value of *start* happens to be past the end, then the output will be a null value: the empty list {} for a list, and the empty string "" for a string.

# Optimization

The third argument — the length of the sublist or substring — is optional if you want to include everything past the first element or character. For example:

```
:mid({1,2,3,4,5},3)
{3 4 5}
:mid("TI-Basic",4)
"Basic"
```

In this case, the result is the same as the result of right(), but the input is different.

Furthermore, if you're always going to start at the beginning of the string, left() is a better alternative to mid(): left(var,x) is equivalent to mid(var,1,x), and saves you a total of 3 bytes.

```
:mid(str,1,5)
can be
:left(str,5)
```

# Error Conditions

**260 - Domain error** happens when *start* isn't positive, or *count* is negative.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:mid

The min( Command

Returns the minimum of two elements or of a list.

- for two numbers: min(
*x*,*y*) - for a list: min(
*list*) - comparing a number to each element of a list: min(
*x*,*list*) or min(*list*,*x*) - pairwise comparing two lists: min(
*list1*,*list2*)

Press:

- MATH to access the math menu.
- RIGHT to access the NUM submenu.
- 6 to select min(, or use arrows.

Alternatively, press:

- 2nd LIST to access the list menu.
- LEFT to access the MATH submenu.
- ENTER to select min(.

TI-83/84/+/SE

1 byte

min(*x*,*y*) returns the smallest of the two numbers *x* and *y*. min(*list*) returns the smallest element of *list*. min(*list1*,*list2*) returns the pairwise minima of the two lists. min(*list1*,*x*) (equivalently, min(*x*,*list1*)) returns a list whose elements are the smaller of *x* or the corresponding element of the original list.

```
min(2,3)
2
min({2,3,4})
2
min({1,3},{4,2})
{1 2}
min({1,3},2)
{1 2}
```

Unlike relational operators, such as < and >, min( can also compare complex numbers. To do this, both arguments must be complex — either complex numbers or complex lists: min(2,*i*) will throw a ERR:DATA TYPE error even though min(2+0*i*,*i*) won't. In the case of complex numbers, the number with the smallest absolute value will be returned. When the two numbers have the same absolute value, the second one will be returned: min(*i*,-*i*) returns -*i* and min(-*i*,*i*) returns *i*.

# Advanced Uses

min( can be used in Boolean comparisons to see if every value of a list is 1 (true) — useful because commands like If or While only deal with numbers, and not lists, but comparisons like L1=L2 return a list of values. In general, the behavior you want varies, and you will use the min( or max( functions accordingly.

Using min( will give you a strict test — only if every single value of a list is true will min( return true. For example, the following code will test if two lists are identical — they have the same exact elements — and print EQUAL in that case:

```
:If dim(L1)=dim(L2
:Then
:If min(L1=L2
:Disp "EQUAL
:End
```

The first check, to see if the sizes are identical, is necessary because otherwise comparing the lists will return a ERR:DIM MISMATCH error.

# Error Conditions

**ERR:DATA TYPE**is thrown when comparing a real and a complex number. This can be avoided by adding 0*i*to the real number.**ERR:DIM MISMATCH**is thrown, when using min( with two lists, if they have different dimensions.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/min

The nCr Command

Calculates the combinatorial number of combinations.

*a* nCr *b*

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 3 to select nCr, or use arrows.

TI-83/84/+/SE

1 byte

nCr is the number of combinations function (or binomial coefficient), defined as *a* nCr *b* = *a*!/(*b*!*(*a*-*b*)!), where *a* and *b* are nonnegative integers. The function also works on lists.

**Tip**: nCr has a higher priority in evaluation than operators such as + or *: for example, 5X nCr 10 will be interpreted as 5(X nCr 10) and not as (5X) nCr 10. You might wish to use parentheses around complex expressions that you will give to nCr as arguments.

```
6 nCr 4
15
```

The combinatorial interpretation of *a* nCr *b* is the number of ways to choose *b* objects, out of a total of *a*, if order doesn't matter. For example, if there 10 possible pizza toppings, there are 10 nCr 3 ways to choose a 3-topping pizza.

# Error Conditions

**ERR:DIM MISMATCH**is thrown when applying nCr to two lists that have different dimensions.**ERR:DOMAIN**is thrown for negative integers or decimals.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/ncr

The nDeriv( Command

Calculates the approximate numerical derivative of a function, at a point.

nDeriv(*f*(*variable*),*variable*,*value*[,*h*])

Press:

- MATH to access the math menu.
- 8 to select nDeriv(, or use arrows.

TI-83/84/+/SE

1 byte

nDeriv(*f*(*var*),*var*,*value*[,*h*]) computes an approximation to the value of the derivative of *f*(*var*) with respect to *var* at *var*=*value*. *h* is the step size used in the approximation of the derivative. The default value of *h* is 0.001.

nDeriv( only works for real numbers and expressions. nDeriv( can be used only once inside another instance of nDeriv(.

```
π→X
3.141592654
nDeriv(sin(T),T,X)
-.9999998333
nDeriv(sin(T),T,X,(abs(X)+e-6)e-6)
-1.000000015
nDeriv(nDeriv(cos(U),U,T),T,X)
.999999665
```

# Advanced

If the default setting for *h* doesn't produce a good enough result, it can be difficult to choose a correct substitute. Although larger values of *h* naturally produce a larger margin of error, it's not always helpful to make *h* very small. If the difference between f(x+h) and f(x-h) is much smaller than the actual values of f(x+h) or f(x-h), then it will only be recorded in the last few significant digits, and therefore be imprecise.

A suitable compromise is to choose a tolerance *h* that's based on X. As suggested here, (abs(X)+E-6)E-6 is a reasonably good value that often gives better results than the default.

# Formulas

The exact formula that the calculator uses to evaluate this function is:

(1)(.001 is substituted for h when the argument is omitted)

# Error Conditions

**ERR:DOMAIN**is thrown if h is 0 (since this would yield division by 0 in the formula)**ERR:ILLEGAL NEST**is thrown if nDeriv( commands are nested more than one level deep. Just having one nDeriv( command inside another is okay, though.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/nderiv

The newList() Command

Returns a list filled with zeroes.

newList(*length*)

**Menu Location**

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

This command works on all calculators.

1 byte

The `newList()` command returns a list of a specific length that is filled entirely with zeroes.

```
:newList(3)
{0 0 0}
:newList(5)
{0 0 0 0 0}
:newList(0)
{}
```

This can be easily expanded to returning a list filled with any value: to return a list filled with a value x, just add x to the result of `newList()`. This works for strings as well, since "Hello"+0 simplifies to "Hello".

# Advanced Uses

`newList()` can be used for making a comparison between a single value and a list. Normally, something like {1,2,3,4}=2 simply returns "false", since 2 is not a list and {1,2,3,4} is. To do a comparison element-by-element, use `newList()` to turn the single value into a list: in this case, 2+`newList(4)`. Comparing {1,2,3,4} to 2+`newList(4)` will return {false, true, false, false} (you might use `when()` to get a single value out of this list).

This works to extend other operations to a number and a list, as well, though comparisons are the most useful application of this technique, since most operations already work this way.

# Optimization

In many cases, an expression with `newList()` can be used to optimize a `seq()` command. First, observe that the simple

`:seq(k,k,1,n)`

which will return the list {1,2,3,…,n}, can be replaced by

`:cumSum(1+newList(n))`

The result is about twice as fast.

This is useful because many `seq()` expressions can be expressed using something like `seq(k,k,1,n)`. For example:

```
:seq(k^2,k,1,n)
can be
:seq(k,k,1,n)^2
which is
:cumSum(1+newList(n))^2
```

This rearrangement is not always possible, but when it is, it gives a significant improvement in speed, with no real difference in size.

Here is a more complicated example (which is a sequence of probabilities with the binomial distribution). Notice the use of the `with` operator.

```
:seq(nCr(n,k) p^k (1-p)^(n-k),k,1,n)
can be
:nCr(n,a) p^a (1-p)^(n-a)|a=cumSum(1+newList(n))
```

# Error Conditions

**260 - Domain error** happens when the length is not an integer ≥0.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:newlist

The NewPic command

Forms a new picture out of a n x 2 matrix.

NewPic *matrix, picVar[, maxRow][, maxColumn]*

**Menu Location**

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

This command works on all calculators.

This command forms a new picture from a matrix. The matrix must have only 2 columns, and should contain as many rows as there are "on" pixels (darkened pixels) in the image. If the picture variable specified already exists, this command will overwrite it. This command takes each row of the matrix, and forms pixel coordinates from the two numbers there. The optional arguments maxRow and maxColumn specify the boundaries of the picture, so this is a good way to form a small sprite from a matrix.

`:newPic [1,1;2,2;3,3;4,4;5,5], picline`

The above code would form a picture named "picline" which would have pixels at (1,1),(2,2),(3,3),(4,4), and (5,5), which would basically be a straight line.

# Error Conditions

**260 - Domain error** happens when an element of the matrix is outside the screen range..

**230 - Dimension error** happens when The matrix has more or less then 2 columns..

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:newpic

The ►Nom( Command

Converts an effective interest rate to a nominal interest rate.

►Nom(*interest rate*,*compounding periods*)

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- ALPHA B to select ►Nom(.

On the TI-83+ or higher, press:

- APPS to access the applications menu.
- ENTER or 1 to select Finance…
- ALPHA B to select ►Nom(.

TI-83/84/+/SE

2 bytes

The ►Nom( command converts from an effective interest rate to a nominal interest rate. In other words, it converts an interest rate that takes compounding periods into account into one that doesn't. The two arguments are 1) the interest rate and 2) the number of compounding periods.

For example, you want to know the interest rate, compounded monthly, that will yield a total increase of 10% per year:

```
►Nom(10,12)
9.568968515
```

# Formulas

The formula for converting from an effective rate to a nominal rate is:

(1)Here, Eff is the effective rate, Nom is the nominal rate, and CP is the number of compounding periods.

# Error Conditions

**ERR:DOMAIN**is thrown if the number of compounding periods is not positive, or if the nominal rate is -100% or lower (an exception's made for the nominal rate if there is only one compounding period, since ►Nom(X,1)=X).

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/nom

The Normal Command

Puts the calculator in "normal" mode regarding scientific notation.

Normal

While editing a program, press:

- MODE to access the mode menu.
- ENTER to select Normal.

TI-83/84/+/SE

1 byte

The Normal command puts the calculator in normal number mode, in which it only uses scientific notation for large enough numbers (10 000 000 000 or higher), negative numbers large enough in absolute value (-10 000 000 000 or lower), or numbers close enough to 0 (less than .001 and greater than -.001)

The other possible settings are Sci (which always uses scientific notation), or Eng (which uses a specific form of scientific notation based on powers of 1000)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/normal

The normalcdf( Command

Finds the probability for an interval of the normal curve.

normalcdf(*lower*, *upper* [, *μ*, *σ*])

Press:

- 2ND DISTR to access the distribution menu
- 2 to select normalcdf(, or use arrows.

TI-83/84/+/SE

2 bytes

normalcdf( is the normal (Gaussian) cumulative density function. If some random variable follows a normal distribution, you can use this command to find the probability that this variable will fall in the interval you supply.

There are two ways to use normalcdf(. With two arguments (lower bound and upper bound), the calculator will assume you mean the standard normal distribution, and use that to find the probability corresponding to the interval between "lower bound" and "upper bound". You can also supply two additional arguments to use the normal distribution with a specified mean and standard deviation. For example:

```
for the standard normal distribution
:normalcdf(-1,1
for the normal distribution with mean 10 and std. dev. 2.5
:normalcdf(5,15,10,2.5
```

# Advanced

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound. For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use E99 to get a very large number that will work equally well in this case (E is the decimal exponent obtained by pressing [2nd] [EE]). Use E99 for positive infinity, and -E99 for negative infinity.

The normal distribution is often used to approximate the binomial distribution when there are a lot of trials. This isn't really necessary on the TI-83+ because the binompdf( and binomcdf( commands are already very fast - however, the normal distribution can be slightly faster, and the skill can come in handy if you don't have access to a calculator but do have a table of normal distributions (yeah, right). Here is how to convert a binomial distribution to a normal one:

```
:binompdf(N,P,X
can be
:normalcdf(X-.5,X+.5,NP,√(NP(1-P
:binomcdf(N,P,X,Y
can be
:normalcdf(X-.5,Y+.5,NP,√(NP(1-P
```

How much faster this is will depend on N and P, since the binomial distribution takes a long time to evaluate for large values of N, but the normal distribution takes about the same time for any mean and standard deviation. Also, this is an approximation that is only valid for some binomial distributions - a common rule of thumb is NP>10.

# Formulas

As with other continuous distributions, any probability is an integral of the probability density function. Here, too, we can define normalcdf( for the standard normal case in terms of normalpdf(:

(1)or in terms of the error function:

(2)For the arbitrary mean μ and standard deviation σ, normalcdf( is defined in terms of the standard normal distribution, with the bounds of the interval standardized:

(3)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/normalcdf

The normalpdf( Command

Evaluates the normal probability density function at a point.

normalpdf(*x*[,*μ*, *σ*])

Press:

- 2ND DISTR to access the distribution menu
- ENTER to select normalpdf(.

TI-83/84/+/SE

2 bytes

normalpdf( is the normal (Gaussian) probability density function.

Since the normal distribution is continuous, the value of normalpdf( doesn't represent an actual probability - in fact, one of the only uses for this command is to draw a graph of the normal curve. You could also use it for various calculus purposes, such as finding inflection points.

The command can be used in two ways: normalpdf(*x*) will evaluate the standard normal p.d.f. (with mean at 0 and a standard deviation of 1) at *x*, and normalpdf(*x*,*μ*,*σ*) will work for an arbitrary normal curve, with mean *μ* and standard deviation *σ*.

# Formulas

For the standard normal distribution, normalpdf(*x*) is defined as

For other normal distributions, normalpdf( is defined in terms of the standard distribution:

(2)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/normalpdf

The not (~) Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:not

The not( Command

Flips the truth value of its argument.

not(*value*)

Press:

- 2nd TEST to access the test menu.
- RIGHT to access the LOGIC submenu.
- 4 to select not(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The last logical operator available on the 83 series takes only one value as input. **not(** comes with its own parentheses to make up for this loss. Quite simply, it negates the input: False becomes True (1) and True returns False (0). not( can be nested; one use is to make any True value into a 1.

```
:not(0)
1
:not(-20 and 14)
0
:not(not(2))
1
```

# Advanced Uses

not(not(X)) will make any value X into 1 if it's not 0, and will keep it 0 if it is.

# Optimization

not(X) and X=0 have the same truth value, but not( is shorter if the closing parenthesis is omitted:

```
:If A=0
can be
:If not(A
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/not

The nPr Command

Calculates the combinatorial number of permutations.

*a* nPr *b*

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 2 to select nPr, or use arrows.

TI-83/84/+/SE

1 byte

nPr is the number of permutations function, defined as *a* nPr *b* = *a*!/(*a*-*b*)!, where *a* and *b* are nonnegative integers. The function also works on lists.

**Tip**: nPr has a higher priority in evaluation than operators such as + or *: for example, 5X nPr 10 will be interpreted as 5(X nPr 10) and not as (5X) nPr 10. You might wish to use parentheses around complex expressions that you will give to nPr as arguments.

```
6 nPr 4
360
```

The combinatorial interpretation of *a* nPr *b* is the number of ways to choose *b* objects in order, when there are *a* objects in total. For example, when giving 1st, 2nd, and 3rd place awards in a competition between 10 teams, there are 10 nPr 3 different ways to assign the awards.

# Error Conditions

**ERR:DIM MISMATCH**is thrown when applying nPr to two lists that have different dimensions.**ERR:DOMAIN**is thrown for negative integers or decimals.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/npr

The npv( Command

Computes the net present value of money over a specified time period.

npv(*interest rate*,*CF0*,*CFList*[,*CFFreq*])

Press:

- 2nd FINANCE (on a TI-83) or APPS (TI-83+ or higher) to access the finance menu
- On the TI-83+ or higher, select the first option "Finance…" from the APPS menu
- 7 or use arrow keys to scroll to it

TI-83/84/+/SE

2 bytes

The npv( command computes the net present value of money over a specified time period. If a positive value is returned after executing npv(, that means it was a positive cashflow; otherwise it was a negative cashflow. The npv( command takes four arguments, and the fourth one is optional:

**interest rate**— the percentage of the money that is paid for the use of that money over each individual period of time.**CF0**— the initial amount of money that you start out with; this number must be a real number, otherwise you will get a ERR:DATA TYPE error.**CFList**— the list of cash flows added or subtracted after the initial money.**CFFreq**— the list of frequencies of each cash flow added after the initial money; if this is left off, each cash flow in the cash flow list will just appear once by default.

# Sample Problem

Your mom recently opened a bank account for you, with $500 as a gift to start you off. This is welcome news to you, until you find out that the bank charges 5% as the interest rate for the account. So, you get a job at Rocco's Pizzas delivering pizzas, which brings in $1,000-$2,000 each month. For the last five months, in particular, you have earned $1,250, $1,333, $1,575, $1,100, and $1,900. (Assume there are no other expenses, such as gas, car payment, etc.)

Plugging in all of the different values into the npv( command, this is what our code looks like:

`:npv(5,500,{1250,1333,1575,1100,1900`

# Optimization

The npv( command's optional fourth argument should be left off if each cash flow of money in the list of cash flows just appears once.

```
:npv(5,1550,{2E3,3E3,4E3},{1,1,1
can be
:npv(5,1550,{2E3,3E3,4E3
```

At the same time, if there are cash flows that occur multiple times, it can be smaller to just use the frequency argument:

```
:npv(8,0,{200,200,300,300,300
can be
:npv(8,0,{200,300},{2,3
```

# Formulas

Without a frequency list, the formula for npv( is the following:

(1)When a frequency list is used, the same formula can be applied if we expand the list with frequencies into a long list without frequencies. However, it's possible to do the calculation directly. We define the cumulative frequency S_{j} as the sum of the first j frequencies (S_{0} is taken to be 0):

# Error Conditions

**ERR:DATA TYPE**is thrown if you try to use anything other than a real number for the interest rate.**ERR:DIM MISMATCH**is thrown if the list of cash flows and the list of cash flow frequencies have different dimensions.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/npv

The OneVar Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:onevar

The OpenLib( Command

Sets up a compatible Flash application library for use with ExecLib

OpenLib(*library*)

This command is only found in the catalog menu. Press:

- 2nd CATALOG to access the command catalog.
- O to skip to commands starting with O.
- ENTER to select OpenLib(.

TI-84+/SE

2 bytes

Together with ExecLib, OpenLib( is used on the TI-84 Plus and TI-84 Plus SE for running routines from a Flash App library. This only works, of course, with libraries that have been specifically written for this purpose. The only such library so far is usb8x, for advanced interfacing with the USB port.

The following program, which displays the version of usb8x, is an example of how to use OpenLib( and ExecLib:

```
:OpenLib(USBDRV8X
:{6
:ExecLib
:Ans(2)+.01Ans(3
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/openlib

The or Command

Returns the truth value of *value1* or *value2* being true.

*value1* or *value2*

Press:

- 2nd TEST to access the test menu.
- RIGHT to access the LOGIC submenu.
- 2 to select or, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

**or** takes two numbers or expressions, and checks to see if *either one* is True. If both are False, it returns 0. If at least one is True, it returns 1. **or** is commutative (i.e. the order of arguments does not matter). As with **and**, you can use variables and expressions, and use multiple **or**'s together.

```
:0 or 1-1
0
:0 or -1
1
:2 or 6*4
1
:0 or 1 or 0
1
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/or

The or Command

Tests if either of two conditions is true.

Can also be used as a bitwise "or" on integers.

*condition1* or *condition2*

*integer1* or *integer2*

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 8 to enter the Test submenu.
- Press 9 to select or.

This command works on all calculators.

1 byte

The "or" operator combines two conditions into one, which will be true if either side is true, and false if both are false. 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, xor, and not.

```
:2+2=4 or 1=0
true
:2+2=5 or 1+1=3
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 "or" will be applied to the bits individually — a bit in the result will be 1 if either of the two corresponding bits of the original integers was 1, and 0 otherwise.

```
:(0b11111100 or 0b00111111)▶Bin
0b11111111
:256 or 512
768
```

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:or

The ord() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:ord

The Output Command

Output is used to display text to pixel coordinates on the Program I/O screen.

Output *row*,*col*,*text*

**Menu Location**

Starting in the program editor:

- Press F3 to enter the I/O menu.
- Press 6 to paste Output.

This command works on all calculators.

2 bytes

The Output command is the most basic command for displaying text. It can display any type of expression on the Program I/O screen in the large font, using "Pretty Print" if it is enabled. It uses (row, column) pixel coordinates to determine the top left corner from which it displays the expression. By far the most common use of Output is for displaying strings.

`:Output 20,20,"Hello, world"`

# Advanced Uses

Both the row and the column coordinates for displaying text can be arbitrary integers — they can be negative, and they can go off-screen. The portion of the text that fits on the screen (if any) is drawn, and the rest is omitted: there is no wrapping of any kind.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:output

The Output( Command

Displays an expression on the home screen starting at a specified row and column. Wraps around if necessary.

Output(*row*, *column*, *expression*)

While editing a program press:

- PRGM to enter the PRGM menu
- RIGHT to enter the I/O menu
- 6 to choose Output(, or use arrows

TI-83/84/+/SE

1 byte

The `Output(` command is the fastest way to display text on the home screen. It takes three arguments: the row (1-8) at which you want to display something, the column (1-16), and whatever it is you want to display. It allows for more freedom than the `Disp` command.

Although off-screen values for the row and column values will cause an error, it's okay if part of the text displayed goes off the screen. When text goes past the last (16th on monochrome calculators, 26th on color calculators) column, it will wrap to the first column of the next row. If the text goes past the last column of the last row, the remainder will be truncated. `Output(` will never cause the screen to scroll.

When the horizontal screen split mode is activated, only the first four rows of the home screen are available for the `Output(` command, which may cause undesirable behavior, and trying to output to the last four rows will cause an error. It is advisable to use the `Full` command at the beginning of a program that relies on `Output(`.

Like other text display commands, you can display each function and command as text. However, this is not without problems as each function and command is counted as one character. The two characters that you can't display are quotation marks (") and the store command (→). However, you can mimic these respectively by using two apostrophes (' ' ), and two subtract signs and a greater than sign (—>).

# Advanced Uses

If the last text display command of a program is an `Output(` command, then "Done" will not be displayed as the program finishes. Some programmers use this to get rid of the Done message by using an empty `Output(` command at the end (there is no text after the quote):

`:Output(1,1,"`

This trick does not work on recent "MathPrint" OSes.

You can also use `Output(` to get rid of the run indicator. Unfortunately, it only silences it for a moment and needs to be repeated in a loop to make it appear to be gone. In a game, it should be incorporated into the main loop. The run indicator is momentarily stopped every time that you output something to the upper right corner, it just needs to be repeated for it to appear to be gone. If you're on the graph screen, you can accomplish the same thing using the `Text(` command.

`:Output(1,16," "`

Since the text displayed by an `Output(` command wraps, a single command can be used to overwrite the entire screen by displaying 8*16=128 (10*26=260 for color calculators) characters of text starting from row 1, column 1. Since every space on the screen is overwritten, this does not require a `ClrHome` to clear previously displayed characters. Keep in mind that exactly 16 (26 on color calculators) characters will be on each line.

# Optimization

`Output(` does not allow for more than one expression to be displayed by a single command. However, if several strings are going to be displayed next to each other by several commands they might be combined into one (keep in mind how wrapping works):

```
:Output(3,3,"Some Text Here
:Output(4,3,"More Text Here
can be
:Output(3,3,"Some Text Here More Text Here
```

In addition, if you are displaying text on the entire home screen, you can place the all the text in a string and then simply display the string. This is especially useful when combined with movement because you can shift the screen quite easily.

`:Output(1,1,Str1`

# Command Timings

The `Output(` command is the fastest possible way of displaying text (short of storing text to a picture and then recalling it). In particular, when going for speed, it should be preferred instead of `Disp`.

# Error Conditions

**ERR:DOMAIN**is thrown when the starting row or column are not integers in the valid range (this is affected by split screen mode).**ERR:INVALID**occurs if this statement is used outside a program.- An error is
**not**thrown when the argument is an empty list (unlike with Disp or pretty much anything else, really)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/output

The Param Command

Enables parametric graphing mode.

Param

While editing a program, press:

- MODE to access the mode menu.
- Use arrows to select Par.

TI-83/84/+/SE

1 byte

The Param command enables parametric graphing mode.

Parametric mode is in many ways a generalization of function mode. Instead of writing y as a function of x, both x and y are written as a function of a parameter t (hence the name, parametric mode). You can easily see that equations in function mode are just a special case of equations in parametric mode: if you set x equal to t, then writing y=f(t) is equivalent to writing y=f(x). Of course, graphing a function this way on a calculator will be slightly slower than doing it in function mode directly, because of the overhead.

Parametric mode allows you the greatest freedom of all the possible graphing modes - nearly every curve you could encounter can be expressed in parametric form.

In mathematics, the parameter t is commonly allowed to take on all values from negative to positive infinity. However, this would be impossible to do on a calculator, since the equation would never stop graphing (unlike function mode, there's no easy way to check for which values of t the equation will go off the screen and there's no need to graph it). Instead, the calculator has window variables Tmin, Tmax, and Tstep: it will evaluate the parameter at every value from Tmin to Tmax, increasing by Tstep each time, and 'connect the dots'.

Polar mode, which you'll read about in the next section, is also a special case of parametric mode: To graph r=f(θ), you can instead graph x=f(t)cos(t) and y=f(t)sin(t), with t graphed over the same interval as θ.

# Advanced Uses

The window variables that apply to parametric mode are:

**Tmin**— Determines the minimum T-value graphed for equations.**Tmax**— Determines the maximum T-value graphed for equations.**Tstep**— Determines the difference between consecutive T-values.**Xmin**— Determines the minimum X-value shown on the screen.**Xmax**— Determines the maximum X-value shown on the screen.**Xscl**— Determines the horizontal space between marks on the X-axis in AxesOn mode or dots in GridOn mode.**Ymin**— Determines the minimum Y-value shown on the screen.**Ymax**— Determines the maximum Y-value shown on the screen.**Yscl**— Determines the vertical space between marks on the Y-axis in AxesOn mode or dots in GridOn mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/param

The Pause Command

Pauses the program until the user presses ENTER.

Pause [*value-or-text*]

While editing a program, press:

- PRGM to enter the PRGM menu
- 8 to choose Pause, or use arrows

TI-83/84/+/SE

1 byte

The `Pause` command is used for suspending the execution of a program at a certain point. This is useful when you have text or instructions on the home screen that you want the user to read before the program continues on to the next thing. While the program is paused, the pause indicator turns on in the top-right corner of the screen (it is the dotted line that moves around).

After the user is done reading the text or instructions, they must press ENTER to resume program execution. One place the `Pause` command is commonly used is right before clearing the screen with `ClrHome`, because otherwise the text on the screen will show up for a split second before it is erased. The `Pause` command gives the user ample time to look at and read the text.

`:Pause`

An alternative to the `Pause` command that is commonly used is a `Repeat` loop with a `getKey` command as the condition. This is sometimes more appropriate in a program if you don't want to bring the program to a complete standstill, and you want the user to be able to resume program execution with any key instead of just ENTER (see usability for more information).

```
:Repeat getKey
:End
```

# Advanced Uses

The `Pause` command has an optional argument that can either be text, a number, a variable, or an expression. This argument will be displayed on the next available blank line on the home screen while the program is paused, and it can be scrolled if it is larger than the screen. Although the `Pause` command can be used with the graph screen, the argument will still be displayed on the home screen.

**Caution**: Unlike any other text command, or indeed any other command at all, this optional argument will be stored to `Ans` after the pause! This could be used to your advantage, but most of the time, it's a nuisance, and if you use Ans for optimization, watch out for this side effect.

Displaying text with the `Pause` command follows the same pattern as the `Disp` command, so text is displayed on the left and everything else is displayed on the right. It also means that if there is already text on the seventh row, it will automatically move everything up one row so it can display its text. In addition, the Pause command is affected by the `Output(` command and its text.

```
PROGRAM:PAUSE
:ClrHome
:"World!
:Disp " Hello "+Ans
:Output(2,2,"Goodbye
:Pause Ans
```

When the calculator is paused, it is possible for another linked calculator to use the `GetCalc(` command to transfer a variable.

The TI-84+CE also introduced an optional second argument to the Pause command. With this argument, you can specify the amount of time you wish to wait for in seconds:

`:Pause "HELLO",2`

Using the empty string "" with the optional second argument will cause the Pause command to wait for the specified amount of time without displaying anything on the screen:

`:Pause "",3.5`

The more recent

`Wait`command can do this as well. Here’s the first example, but using Wait:

```
:Disp “HELLO
:Wait 2
```

# Optimization

When you have a `Disp` command before a `Pause` command, you can take the text or variable from the `Disp` command and place it after the Pause command as its optional argument. This allows you to remove the `Disp` command. If the `Disp` command has multiple arguments, you just take the last one off and put it as the optional argument.

```
:Disp A
:Pause
can be
:Pause A
```

When using the optional argument of `Pause`, it is stored to `Ans`, and this can in rare cases be used for optimization. The most common one would probably be using `Pause` to show work for a calculation, as in the following program:

```
:Disp "A+B=
:Pause A+B
:Disp "(A+B)²=
:Pause Ans²
:Disp "(A+B)²-C²=
:Pause Ans-C²
```

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pause

The Pause Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:pause

The Pen Tool

Allows the user to draw on the graph screen.

Pen isn't a command, it's a menu option.

From the home screen, press:

- 2nd PRGM to enter the DRAW menu
- Scroll up to select Pen, or use arrows.

TI-83/84/+/SE

The Pen tool allows you to draw on the graph screen using a + cursor for the "pen", similar to what you see when accessing the graph screen with graphs or with the Input command. You can find Pen by pressing [2nd][PRGM] to go to the DRAW menu, but it is only accessible from the calculator's home screen (where you do math and run programs); it won't show up when you are inside the program editor.

You use the arrow keys to move the pen around, and you can press [2nd][<] and [2nd][>] to move five pixels over instead of just the typical one (this does not work with the up or down keys, since that would change the calculator's contrast). Pressing ENTER starts or stops the drawing respectively, and you just have to press CLEAR twice to return back to the home screen.

When you are done drawing, the calculator stores the coordinates of the cursor to the respective graph screen variables (R and θ for PolarGC format, otherwise X and Y).

Unfortunately, anything that you draw with Pen will be erased or overwritten whenever another program accesses the graph screen or somebody graphs something, so you should store it to a picture if you want to keep it for future use.

Even more unfortunately, you can't erase pixels with Pen. If you're the type of person who makes mistakes once in a while, it might be better to go to the graph screen and choose Pt-Change( from the DRAW menu. This will require you to press ENTER for every pixel you want to draw, but it will also allow you to erase a pixel (by drawing to it again).

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pen

The Plot#( Commands

Displays a statistical plot of one of six types.

Plot#(*type*,…

The syntax varies based on the type of plot:

Plot#(Scatter, *x-list*, *y-list*, *mark*)

Plot#(xyLine, *x-list*, *y-list*, *mark*)

Plot#(Histogram, *x-list*, *freq list*)

Plot#(Boxplot, *x-list*, *freq list*)

Plot#(ModBoxplot, *x-list*, *freq list*, *mark*)

Plot#(NormProbPlot, *data list*, *data axis*, *mark*)

While editing a program, press:

- 2nd PLOT to access the stat plot menu.
- 1, 2, or 3 (or use arrows) to select Plot1(, Plot2(, Plot3( respectively.

(outside a program, this brings you to the plot editor screen)

TI-83/84/+/SE

1 byte

The commands `Plot1(`, `Plot2(`, and `Plot3(`, which are identical except for which stat plot (1, 2, or 3) they affect, define their corresponding stat plot. When the stat plot is defined, it is also turned on so no `PlotsOn` command is necessary.

The first argument of the commands is always the type of plot, and is one of `Scatter`, `xyLine`, `Histogram`, `Boxplot`, `ModBoxplot`, and `NormProbPlot` - these types are found in the TYPE submenu of the stat plot menu. The other arguments vary. For all but `Histogram` and `Boxplot`, there is a *mark* argument - this is a dot, a cross, or a box, symbols that can be found in the MARK submenu of the stat plot menu.

## Scatter plot

Plot#(Scatter, *x-list*, *y-list*, *mark*) defines a scatter plot. The points defined by *x-list* and *y-list* are plotted using *mark* on the graph screen.

*x-list* and *y-list* must be the same length.

## xyLine plot

Plot#(xyLine, *x-list*, *y-list*, *mark*) defines an `xyLine` plot. Similarly to a scatter plot, the points defined by *x-list* and *y-list* are plotted using *mark* on the graph screen, but with an `xyLine` plot they are also connected by a line, in the order that they occur in the lists.

*x-list* and *y-list* must be the same length.

## Histogram plot

Plot#(Histogram, *x-list*, *freq list*) defines a `Histogram` plot. The x-axis is divided into intervals that are Xscl wide. A bar is drawn in in each interval whose height corresponds to the number of points in the interval. Points that are not between Xmin and Xmax are not tallied.

Xscl must not be too small - it can divide the screen into no more than 47 different bars.

## Box plot

Plot#(Boxplot, *x-list*, *freq list*) defines a box plot. A rectangular box is drawn whose left edge is Q_{1} (the first quartile) of the data, and whose right edge is Q_{3} (the third quartile). A vertical segment is drawn within the box at the median, and 'whiskers' are drawn from the box to the minimum and maximum data points.

The box plot ignores the Ymax and Ymin dimensions of the screen, and any plots that aren't box plots or modified box plots. Each box plot takes approximately 1/3 of the screen in height, and if more than one are plotted, they will take up different areas of the screen.

## Modified box plot

Plot#(ModBoxplot, *x-list*, *freq list*, *mark*) defines a modified box plot. This is almost entirely like the normal box plot, except that it also draws outliers. Whiskers are only drawn to the furthers point within 1.5 times the interquartile range (Q_{3}-Q_{1}) of the box. Beyond this point, data points are drawn individually, using *mark*.

The box plot ignores the Ymax and Ymin dimensions of the screen, and any plots that aren't box plots or modified box plots. Each box plot takes approximately 1/3 of the screen in height, and if more than one are plotted, they will take up different areas of the screen.

## Normal probability plot

Plot#(NormProbPlot, *data list*, *data axis*, *mark*) defines a normal probability plot. The mean and standard deviation of the data are calculated. Then for each point, the number of standard deviations it is from the mean is calculated, and the point is plotted against this number using *mark*. *data axis* can be either X or Y: it determines whether the value of a point determines it's x-coordinate or y-coordinate.

The point behind this rather convoluted process is to test the extent to which the data is normally distributed. If it follows the normal distribution closely, then the result will be close to a straight line - otherwise it will be curved.

# Advanced Uses

After doing a regression, a scatter plot of ∟RESID against the x-list is a useful measure of the effectiveness of the regression. If the plot appears random, this is a good sign; if there is a pattern to the plot, this means it's likely that a better regression model exists.

# Optimization

The ∟ symbol at the beginning of list names can be omitted everywhere in this command.

In addition, every element except the plot type and the data list or data lists are optional, and take on the following default values:

*freq list*is 1 by default, meaning that all frequencies are 1.*mark*is the box by default.*data axis*is X by default.

# Error Conditions

**ERR:DIM MISMATCH**is thrown if the x and y lists, or the data and frequency lists, have different dimensions.**ERR:STAT**is thrown if Xscl is too small in the case of a Histogram.

All errors are thrown when plotting the stat plot, as opposed to when the command is executed, and do not provide a 2:Goto option.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/plotn

The PlotsOff Command

Turns stat plots (all of them, or only those specified) off.

PlotsOff numbers//

Press:

- 2nd PLOT to access the stat plot menu.
- 4 to select PlotsOff, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

By itself, the command will turn off all three stat plots.

If it is given arguments, there can be any number of them (actually, no more than 255, but this won't stop most people), but they must all be numbers 1 to 3. Then, the command will only turn off the specified plots. Unlike some commands, it is okay to give PlotsOff an expression as an argument (for example, PlotsOff X), as long as it has a value of 1, 2, or 3.

# Error Conditions

**ERR:DOMAIN**is thrown if a plot that is not 1, 2, or 3 is specified.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/plotsoff

The PlotsOn Command

Turns stat plots (all of them, or only those specified) on.

PlotsOn numbers//

Press:

- 2nd PLOT to access the stat plot menu.
- 5 to select PlotsOn, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

By itself, the command will turn on all three stat plots.

If it is given arguments, there can be any number of them (actually, no more than 255, but this won't stop most people), but they must all be numbers 1 to 3. Then, the command will only turn on the specified plots. Unlike some commands, it is okay to give PlotsOn an expression as an argument (for example, PlotsOn X), as long as it has a value of 1, 2, or 3.

# Error Conditions

**ERR:DOMAIN**is thrown if a plot that is not 1, 2, or 3 is specified.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/plotson

The Pmt_Bgn Command

Sets the TVM solver to use payments at the beginning of a period.

Pmt_Bgn

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- ALPHA F to select Pmt_Bgn, or use arrows and ENTER.

On the TI-83+ or higher, press:

- APPS to access the applications menu.
- ENTER to select Finance…
- ALPHA F to select Pmt_Bgn, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The Pmt_Bgn and Pmt_End commands toggle a setting with the finance solver. In Pmt_Bgn mode, the calculator assumes that the payments are made at the beginning of each time period, rather than at the end.

Make sure to set the calculator to one of the modes before using the finance solving commands in a program, since otherwise the result is unpredictable.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pmt-bgn

The Pmt_End Command

Sets the TVM solver to use payments at the end of a period.

Pmt_End

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- ALPHA E to select Pmt_End, or use arrows and ENTER.

On the TI-83+ or higher, press:

- APPS to access the applications menu.
- ENTER to select Finance…
- ALPHA E to select Pmt_End, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The Pmt_End and Pmt_Bgn commands toggle a setting with the finance solver. In Pmt_End mode, the calculator assumes that the payments are made at the end of each time period, rather than at the beginning.

Make sure to set the calculator to one of the modes before using the finance solving commands in a program, since otherwise the result is unpredictable.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pmt-end

The poissoncdf( Command

Calculates the Poisson cumulative probability for a single value

poissoncdf(*mean*, *value*)

Press:

- 2ND DISTR to access the distribution menu
- ALPHA C to select poissoncdf(, or use arrows.

Press ALPHA D instead of ALPHA C on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

This command is used to calculate Poisson distribution cumulative probability. In plainer language, it solves a specific type of often-encountered probability problem, that occurs under the following conditions:

- A specific event happens at a known average rate (X occurrences per time interval)
- Each occurrence is independent of the time since the last occurrence
- We're interested in the probability that the event occurs at most a specific number of times in a given time interval.

The poissoncdf( command takes two arguments: The *mean* is the average number of times the event will happen during the time interval we're interested in. The *value* is the number of times we're interested in the event happening (so the output is the probability that the event happens at most *value* times in the interval). Note that you may need to convert the mean so that the time intervals in both cases match up. This is done by a simple proportion: if the event happens 10 times per minute, it happens 20 times per two minutes.

For example, consider point on a city street where an average of 5 cars pass by each minute. What is the probability that in a given minute, no more than 3 cars will drive by?

- The event is a car passing by, which happens at an average rate of 5 occurences per time interval (a minute)
- Each occurrence is independent of the time since the last occurrence (we'll assume this is true, though traffic might imply a correlation here)
- We're interested in the probability that the event occurs at most 3 times in the time interval.

The syntax in this case is:

`:poissoncdf(5,3`

This will give about .265 when you run it, so there's a .265 probability that in a given minute, no more than 3 cars will drive by.

# Formulas

The poissoncdf( command can be seen as a sum of poissonpdf( commands:

(1)We can also write the poissoncdf( command in terms of the incomplete gamma function:

(2)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/poissoncdf

The poissonpdf( Command

Calculates the Poisson probability for a single value

poissonpdf(*mean*, *value*)

Press:

- 2ND DISTR to access the distribution menu
- ALPHA B to select poissonpdf(, or use arrows.

Press ALPHA C instead of ALPHA B on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

This command is used to calculate Poisson distribution probability. In plainer language, it solves a specific type of often-encountered probability problem, that occurs under the following conditions:

- A specific event happens at a known average rate (X occurrences per time interval)
- Each occurrence is independent of the time since the last occurrence
- We're interested in the probability that the event occurs a specific number of times in a given time.

The poissonpdf( command takes two arguments: The *mean* is the average number of times the event will happen during the time interval we're interested in. The *value* is the number of times we're interested in the event happening (so the output is the probability that the event happens *value* times in the interval).

For example, consider point on a city street where an average of 5 cars pass by each minute. What is the probability that in a given minute, 8 cars will drive by?

- The event is a car passing by, which happens at an average rate of 5 occurrences per time interval (a minute)
- Each occurrence is independent of the time since the last occurrence (we'll assume this is true, though traffic might imply a correlation here)
- We're interested in the probability that the event occurs 8 times in the time interval

The syntax in this case is:

`:poissonpdf(5,8`

This will give about .065 when you run it, so there's a .065 probability that in a given minute, 8 cars will drive by.

# Formulas

The value of poissonpdf( is given by the formula

(1)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/poissonpdf

The Polar Command

Enables polar graphing mode.

Polar

While editing a program, press:

- MODE to access the mode menu.
- Use arrows to select Pol.

TI-83/84/+/SE

1 byte

The Polar command enables the polar graphing mode.

Unlike the previous modes, polar mode doesn't use the more common (x,y) coordinates. Instead, the coordinates (r,θ) are used, where θ is the counterclockwise angle made with the positive x-axis, and r is the distance away from the origin (the point (0,0)). Although it's possible to translate from one system to the other, polar coordinates are more useful for some expressions (and, of course, less useful for others).

In particular, they're very good at graphing anything circle-related. The equation for a circle in polar mode is just r=1 (or any other number, for a circle of different radius).

Like in parametric mode, the parameter θ uses the window variables θmin, θmax, and θstep to determine which points are graphed. A common situation is θmin=0, θmax=2π: in Radian mode, this corresponds to going all the way around the circle. Of course, you could use Degree mode and set θmax to be 360, but this is uncommon in mathematics.

# Advanced Uses

The window variables that apply to polar mode are:

**θmin**— Determines the minimum θ-value graphed for equations.**θmax**— Determines the maximum θ-value graphed for equations.**θstep**— Determines the difference between consecutive θ-values.**Xmin**— Determines the minimum X-value shown on the screen.**Xmax**— Determines the maximum X-value shown on the screen.**Xscl**— Determines the horizontal space between marks on the X-axis in AxesOn mode or dots in GridOn mode.**Ymin**— Determines the minimum Y-value shown on the screen.**Ymax**— Determines the maximum Y-value shown on the screen.**Yscl**— Determines the vertical space between marks on the Y-axis in AxesOn mode or dots in GridOn mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/polar-mode

The ►Polar Command

Formats a complex value in polar form when displaying it.

*value*►Polar

Press:

- MATH to access the math menu.
- RIGHT RIGHT to access the CPX submenu.
- 7 to select ►Polar, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The ►Polar command can be used when displaying a complex number on the home screen, or with the Disp and Pause commands. It will then format the number as though re^θi mode were enabled. It also works with lists.

```
i
i
i►Polar
1e^(1.570796327i)
{1,i}►Polar
{1 1e^(1.570796327i)}
```

It will also work when displaying a number by putting it on the last line of a program by itself. It does **not** work with Output(, Text(, or any other more complicated display commands.

To actually separate a number into the components of polar form, use abs( and angle(.

# Error Conditions

**ERR:SYNTAX**is thrown if the command is used somewhere other than the allowed display commands.**ERR:DATA TYPE**is thrown if the value is real.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/polar-display

The PolarGC Command

Sets the calculator to display point coordinates using polar coordinates.

PolarGC

Press:

- 2nd FORMAT to access the graph format screen
- Use arrows and ENTER to select PolarGC.

TI-83/84/+/SE

2 bytes

The PolarGC ("Polar Grid Coordinates") command (like its opposite, the RectGC) command, affects how the coordinates of a point on the graph screen are displayed. When PolarGC is enabled, the coordinates of a point are displayed as (R,θ).

The polar coordinates of a point can be interpreted as the distance R it is away from the origin (0,0), and the direction θ. θ is the angle that a ray to the point would make with the positive X-axis (so polar coordinates are affected by Degree/Radian mode). An angle of 0 means the point is to the left of the origin; an angle of 90° (π/2 radians) means it's up from the origin, and so on. So, for example, the point with R=2 and θ=270° (3π/2 radians) would be two units down from the origin.

Of course, coordinates are only displayed with the CoordOn setting; however, with CoordOff, RectGC and PolarGC are still useful, because in a variety of cases, the coordinates of a point are also stored to variables. PolarGC doesn't change the fact that they're stored to X and Y, as with RectGC; however, with PolarGC, they are also stored to R and θ.

Although the PolarGC command naturally goes with Polar graphing mode, the two settings are independent; you can use both PolarGC and RectGC with any graphing mode.

# Advanced

The following situations involve storing coordinates of a point to variables:

- Graphing an equation
- Tracing an equation or plot
- Moving the cursor on the graph screen
- Using the interactive mode of one of the 2nd DRAW commands
- Using one of DrawF, DrawInv, or Tangent(
- Anything in the 2nd CALC menu.

Naturally, any command like Input or Select( which involves the above, will also store coordinates of a point.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/polargc

The prgm Command

Calls another program from within a program, with program execution moving to that program.

prgm*NAME*

Outside the editor, press:

- PRGM to enter the PRGM menu
- Use arrows to choose program

When editing a program, press:

- PRGM to enter the PRGM menu
- LEFT to enter the EXEC submenu
- select a program

TI-83/84/+/SE

1 byte

The prgm command is used to execute a program from inside another program (at any time while the program is running), with the secondary program acting as a subprogram for that program. Although they are listed in the program menu and can be executed independently like any other program, subprograms are primarily designed to do a particular task for the other program.

You insert the prgm command into the program where you want the subprogram to run, and then type (with the alpha-lock on) the program name. You can also go to the program menu to choose a program, pressing ENTER to paste the program name into your program.

```
PROGRAM:MYPROG
:ClrHome
:Output(3,3,"Hello
:prgmWHATEVER
```

When the subprogram name is encountered during a program, the program will be put on hold and program execution will transfer to the subprogram. Once the subprogram is finished, program execution will go back to the program, continuing right after the subprogram name.

Although subprograms can call themselves or other subprograms, this should be done sparingly because it can cause memory leaks if done too much or if the subprogram doesn't return to the parent program.

Branching is local to each program, so you can’t use Goto in one program to jump to a Lbl in another program. In addition, all variables are global, so changing a variable in one program affects the variable everywhere else.

# Advanced Uses

Each time you call a TI-Basic program, 16 bytes are used to save your place in the original program so you can return to it correctly. This is a small enough amount that you don't have to worry about it, unless you're low on RAM or use a lot of recursion.

# Error Conditions

**ERR:ARCHIVED**if the program is archived.**ERR:SYNTAX**, with no 2:Goto option, if the program is an assembly program.**ERR:UNDEFINED**if the program doesn't exist.

## See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/prgm

The PrintScreen Command

This command doesn't exist. A token for it does, though.

PrintScreen

This command requires a hex editor to access.

TI-83/84/+/SE

1 byte

This command is probably the vestigial remnant of a planned function that wasn't implemented. A token is set aside for it, but the command doesn't actually do anything, and will cause an error if you try to use it. It's not accessible through any menus, though, so that's okay.

The only potential use is to save on memory if you ever need to display "PrintScreen" somewhere - you can display this token instead.

# Error Conditions

**ERR:INVALID**is thrown when trying to use this command.

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/printscreen

The prod( Command

Calculates the product of all or part of a list.

prod(*list*[,*start*,[*end*]])

Press:

- 2nd LIST to access the list menu.
- LEFT to access the MATH submenu.
- 6 to select prod(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The prod( command calculates the product of all or part of a list.

When you use it with only one argument, the list, it multiplies all the elements of the list. You can also give it a bound of *start* and *end* and it will only multiply the elements starting and ending at those indices (inclusive).

```
prod({1,2,3,4,5})
120
prod({1,2,3,4,5},2,4)
24
prod({1,2,3,4,5},3)
60
```

# Optimization

If the value of *end* is the last element of the list, it can be omitted:

```
prod({1,2,3,4,5},3,5)
can be
prod({1,2,3,4,5},3)
```

# Error Conditions

**ERR:DOMAIN**if the starting or ending value aren't positive integers.**ERR:INVALID DIM**if the starting or ending value exceed the size of the list, or are in the wrong order.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/prod

The Prompt Command

Prompts the user to enter values for variables and then stores those values to the variables.

Prompt *variableA*[,*variableB*,…]

While editing a program press:

- PRGM to enter the PRGM menu
- RIGHT to enter the I/O menu
- 2 to choose Prompt, or use arrows

TI-83/84/+/SE

1 byte

The `Prompt` command is the simplest way of getting user input on the home screen (getting user input on the graph screen is only possible with the `getKey` command). Prompt displays variables one per line, with an equal sign and question mark (=?) displayed to the right of each variable. After the user enters a value or expression for the variables and presses ENTER, the values will be stored to the variables and program execution will resume.

`Prompt` can be used with every variable, but some of the variables have to be entered in a certain way. If the variable is a string or equation, the user must put quotes ("") around the value; the user must also put curly braces ({}) around lists and square brackets ([]) around matrices. Of course, ending quotes, braces, and brackets can be left off as usual.

When you use `Prompt` to input a named list, the `∟` in front of the name is dropped (so `Prompt ∟NAME` will display NAME=?). This can be confusing with single-letter names: `Prompt ∟X` and `Prompt X` both display X=?. Further enhancing the confusion, if the user enters a list for `Prompt X`, the list will be stored to ∟X instead.

During the Prompt, the user can press [2nd][MODE] to quit the program immediately.

# Advanced Uses

Because simply displaying what variable the value will be stored to does not really tell the user what the variable will be used for, you can put a `Disp` command before `Prompt` to give the user some more insight into what an appropriate value for the variable would be. The `Prompt` command will be displayed one line lower, though, because the `Disp` command automatically creates a new line after itself. (Of course, you could also just use the `Input` command.)

```
:Disp "Enter the Score
:Prompt A
```

# Optimizations

When you have a list of `Prompt` commands (and each one has its own variable), you can just use the first `Prompt` command and combine the rest of the other `Prompt` commands with it. You remove the `Prompt` commands and combine the arguments, separating each argument with a comma. The arguments can be composed of whatever combination of variables is desired.

The advantages of combining `Prompt` commands are that it makes scrolling through code faster, and it is more compact (i.e. smaller) and easier to write than using the individual `Prompt` commands. The primary disadvantage is that it is easier to accidentally erase a `Prompt` command with multiple arguments.

```
:Prompt A
:Prompt Str1
Combine the Prompts
:Prompt A,Str1
```

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/prompt

The P►Rx( Command

P►Rx( calculates the x-value (in Cartesian coordinates) given Polar coordinates.

P►Rx(r,θ)

Press:

- 2nd ANGLE to access the angle menu.
- 7 to select P►Rx(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

P►Rx( (polar►rectangular x-coordinate) calculates the x-coordinate of a polar point. Polar coordinates are of the form (r,θ), where θ is the counterclockwise angle made with the positive x-axis, and r is the distance away from the origin (the point (0,0)). The conversion identity x=r*cos(θ) is used to calculate P►Rx(.

The value returned depends on whether the calculator is in radian or degree mode. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion from radians to degrees is angle*180/π and from degrees to radians is angle*π/180. The P►Rx( command also accepts a list of points.

```
P►Rx(5,π/4)
3.535533906
5*cos(π/4)
3.535533906
P►Rx({1,2},{π/4,π/3})
{.7071067812 1}
```

# Advanced Uses

You can bypass the mode setting by using the ° (degree) and ^{r} (radian) symbols. This next command will return the same values no matter if your calculator is in degrees or radians:

```
P►Rx(1,{π/4^^r,60°})
{.7071067812 .5}
```

# Optimization

In most cases P►Rx(r,θ) can be replaced by r*cos(θ) to save a byte:

```
:P►Rx(5,π/12)
can be
:5cos(π/12)
```

Conversely, complicated expressions multiplied by a cosine factor can be simplified by using P►Rx(r,θ) instead.

```
:(A+BX)cos(π/5)
can be
:P►Rx(A+BX,π/5)
```

# Error Conditions

**ERR:DIM MISMATCH**is thrown if two list arguments have different dimensions.**ERR:DATA TYPE**is thrown if you input a complex argument.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/p-rx

The P►Ry( Command

P►Ry( calculates the y-value (in Cartesian coordinates) given Polar coordinates.

P►Ry(r,θ)

Press:

- 2nd ANGLE to access the angle menu.
- 8 to select P►Ry(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

P►Ry( (polar to rectangular y-coordinate) calculates the y-coordinate of a polar point. Polar coordinates are of the form (r,θ), where θ is the counterclockwise angle made with the positive x-axis, and r is the distance away from the origin (the point (0,0)). The conversion identity y=r*sin(θ) is used to calculate P►Ry(.

The value returned depends on whether the calculator is in radian or degree mode. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion from radians to degrees is angle*180/π and from degrees to radians is angle*π/180. The P►Ry( command also accepts a list of points.

```
P►Ry(5,π/4)
3.535533906
5*sin(π/4)
3.535533906
P►Ry({1,2},{π/4,π/3})
{.7071067812 1.732050808}
```

# Advanced Uses

You can bypass the mode setting by using the ° (degree) and ^{r} (radian) symbols. This next command will return the same values no matter if your calculator is in degrees or radians:

```
P►Ry(1,{π/4^^r,60°})
{.7071067812 .8660254038}
```

# Optimization

In most cases P►Ry(r,θ) can be replaced by r*sin(θ) to save a byte:

```
:P►Ry(5,π/12)
can be
:5sin(π/12)
```

Conversely, complicated expressions multiplied by a sine factor can be simplified by using P►Ry(r,θ) instead.

```
:(A+BX)sin(π/5)
can be
:P►Ry(A+BX,π/5)
```

# Error Conditions

**ERR:DIM MISMATCH**is thrown if two list arguments have different dimensions.**ERR:DATA TYPE**is thrown if you input a complex argument.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/p-ry

The Pt-Change( Command

Toggles a point on the graph screen.

Pt-Change(X,Y)

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 3 to choose Pt-Change

TI-83/84/+/SE

1 byte

The Pt-Change( command is used to toggle a point (a pixel on the screen) on the graph screen at the given (X,Y) coordinates. If the point is on, it will be turned off and vice versa. Pt-Change( is affected by the window settings, which means you have to change the window settings accordingly, otherwise the point won't show up correctly on the screen.

Pt-Change( can be an interactive command: when on the graph screen, you can select it from the draw menu, and rather than have to input coordinates, be able to draw directly on the screen. Since you can both draw and erase points easily with Pt-Change(, this use of it is often more convenient than the Pen tool.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pt-change

The PtChg Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:ptchg

The PtOff Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:ptoff

The Pt-Off( Command

Turns off a point on the graph screen.

Pt-Off(X,Y[,*mark*])

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 2 to choose Pt-Off(

TI-83/84/+/SE

1 byte

The Pt-Off( command is used to turn off a point (a pixel on the screen) on the graph screen at the given (X,Y) coordinates. Pt-Off( is affected by the window settings, which means you have to change the window settings accordingly, otherwise the point won't show up correctly on the screen.

# Advanced Uses

The Pt-Off( command has an optional third argument that determines the shape of the point (its mark). The mark can be 1 (dot), 2 (3x3 box), 3 (3x3 cross), 6 (3x3 box), or 7 (3x3 cross). Note that by using the 3x3 shapes the X,Y coördinates will be the center of the shape and not the upperleft corner of the shape. You don't need to specify the mark when using the first mark because it is the default; also, any value that isn't 2, 3, 6, or 7 will be treated as the default of 1.

```
:Pt-Off(5,5,1
Remove Mark
:Pt-Off(5,5
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pt-off

The PtOn Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:pton

The Pt-On( Command

Turns on a point on the graph screen.

Pt-On(X,Y[,*mark*])

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 1 to choose Pt-On(

TI-83/84/+/SE

1 byte

The Pt-On( command is used to draw a point on the graph screen at the given (X,Y) coordinates. Pt-On( is affected by the window settings Xmin, Xmax, Ymin, and Ymax. Make sure to change these accordingly when using it in a program, otherwise, you don't know where the point will show up.

# Advanced Uses

The Pt-On( command has an optional third argument that determines the shape of the point (its mark). The mark can be 1 (dot), 2 (3x3 box), 3 (3x3 cross), 6 (3x3 box), or 7 (3x3 cross). Note that by using the 3x3 shapes the X,Y coordinates will be the center of the shape and not the upperleft corner of the shape. You don't need to specify the mark when using the first mark because it is the default; also, any value that isn't 2, 3, 6, or 7 will be treated as the default of 1. Remember to use the same mark when turning a point off as you used to turn it on.

If you need to convert coordinates in pixel format into point coordinate format, it can easily be done with the following formula:

(X pixel coordinate*ΔX)-absolute value(Xmax)=X point

(Y pixel coordinate*ΔY)-absolute value(Ymax)=Y point

The ΔX and ΔY variables are available under "VARS", "Window", options 8 and 9. These two variables represent the number of points per pixel on the graph screen, so multiplying the pixel value by the ratio of points to pixels will give you the point value, you then subtract the Xmax/Ymax from this value to calibrate it to the center of the screen. This formula is useful in programs that use the pixel commands for their speed advantage, but need a point value for commands such as Circle( or Line(.

```
:Pt-On(5,5,1
should be
:Pt-On(5,5
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pt-on

The PwrReg Command

Calculates the best fit power curve through a set of points.

PwrReg [*x-list*, *y-list*, [*frequency*], [*equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- ALPHA A to select PwrReg, or use arrows

TI-83/84/+/SE

1 byte

PwrReg tries to fit a power curve (y=a*x^{b}) through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points.

The calculator does this regression by taking the natural log ln( of the x- and of the y-coordinates (this isn't stored anywhere) and then doing a linear regression. The result, ln(y)=b*ln(x)+ln(a), is transformed into y=e^{ln(a)}*x^{b}, which is a power curve. This algorithm shows that if any coordinates are negative or 0, the calculator will instantly quit with ERR:DOMAIN.

In its simplest form, PwrReg takes no arguments, and fits a power curve through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LnReg
```

On the home screen, or as the last line of a program, this will display the equation of the curve: you'll be shown the format, y=a*x^b, and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, r, and r² will be set as well. These latter two variables will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:PwrReg ∟FAT,∟CALS
```

Finally, you can enter an equation variable (such as Y₁) after the command, so that the curve's equation is stored to this variable automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the equation will be in terms of X anyway, this doesn't make much sense.

An example of PwrReg with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:PwrReg ∟FAT,∟CALS,∟FREQ,Y1
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pwrreg

The Pxl-Change( Command

Toggles a pixel on the graph screen.

Pxl-Change(*row*,*column*)

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 6 to choose Pxl-Change(, or use arrows

TI-83/84/+/SE

1 byte

The Pxl-Change( command is used to toggle the pixel at the given (Y,X) coordinates. If the pixel is on, it will be turned off and vice versa. Please note that the coordinates are switched around so that the row comes first and then the column — it's (Y,X) instead of (X,Y) like the Pt-Change( command. Also note that the row decreases as you go *up* which can confuse users.

In addition to being easier to use because it is not affected by the window settings (meaning you don't have to set them when using the command), Pxl-Change( is faster than its equivalent Pt-Change( command, so it should generally be used instead whenever possible.

# Error Conditions

**ERR:DOMAIN**is triggered if the coordinates are not whole numbers or not in the right range ([0..62] for row, [0..94] for column). These bounds are also affected by split screen mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pxl-change

The PxlChg Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:pxlchg

The PxlOff Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:pxloff

The Pxl-Off( Command

Turns off a pixel on the graph screen.

Pxl-Off(*row*,*column*)

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 5 to choose Pxl-Off(, or use arrows

TI-83/84/+/SE

1 byte

The Pxl-Off( command is used to turn off the pixel at the given (Y,X) coordinates. Please note that the coordinates are switched around so that the row comes first and then the column — it's (Y,X) instead of (X,Y) like the Pt-Off( command. Also note that the (0,0) point is the upper left corner of the Graph screen.

In addition to being easier to use because it is not affected by the window settings (meaning you don't have to set them when using the command), Pxl-Off( is faster than its equivalent Pt-Off( command, so it should generally be used instead whenever possible.

# Error Conditions

**ERR:DOMAIN**is triggered if the coordinates are not whole numbers or not in the right range ([0..62] for row, [0..94] for column). These bounds are also affected by split screen mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pxl-off

The PxlOn Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:pxlon

The Pxl-On( Command

Turns on a pixel on the graph screen.

Pxl-On(*row*,*column*)

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 4 to choose Pxl-On(, or use arrows

TI-83/84/+/SE

1 byte

The Pxl-On( command is used to turn on the pixel at the given (Y,X) coordinates. Please note that the coordinates are switched around so that the row comes first and then the column — it's (Y,X) unlike the (X,Y) of the Pt-On( command. Also note that the (0,0) point is the upper left corner of the Graph screen.

In addition to being easier to use because it is not affected by the window settings (meaning you don't have to set them when using the command), Pxl-On( is faster than its equivalent Pt-On( command, so it should generally be used instead whenever possible.

# Error Conditions

**ERR:DOMAIN**is triggered if the coordinates are not whole numbers or not in the right range ([0..62] for row, [0..94] for column). These bounds are also affected by split screen mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pxl-on

The pxl-Test( Command

Tests a pixel on the graph screen to see if it is on or off.

pxl-Test(Y,X)

While editing a program press:

- 2nd PRGM to enter the DRAW menu
- RIGHT to enter the POINTS menu
- 7 to choose pxl-Test(, or use arrows

TI-83/84/+/SE

1 byte

The pxl-Test( command is used to test a pixel at the given (Y,X) coordinates of the graph screen, to see whether it is on or off. One is returned if the pixel is on and zero is returned if the pixel is off. Please note that the coordinates are switched around so that the row comes first and then the column — it's (Y,X) instead of (X,Y). This command's coordinates are independent of the window settings.

You can store the result of pxl-Test( to a variable for later use, or use the command in a conditional or loop.

```
:Pxl-On(25,25
:If pxl-Test(25,25
:Disp "Pixel turned on!
```

# Error Conditions

**ERR:DOMAIN**is triggered if the coordinates are not whole numbers or not in the right range ([0..62] for row, [0..94] for column). These bounds are also affected by split screen mode (Horiz)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pxl-test

The QuadReg Command

Calculates the best fit quadratic through a set of points.

QuadReg [*x-list*, *y-list*, [*frequency list*], [*equation variable*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 5 to select QuadReg, or use arrows

TI-83/84/+/SE

1 byte

The QuadReg command can calculate the best fit quadratic through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points. You must have at least 3 points, because there are infinitely many quadratics that can go through 2 points or 1 point.

In its simplest form, QuadReg takes no arguments, and calculates a quadratic through the points in L₁ and L₂:

```
:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:QuadReg
```

On the home screen, or as the last line of a program, this will display the equation of the quadratic: you'll be shown the format, y=ax²+bx+c, and the values of a, b, and c. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, c, and R² will be set as well. This latter variable will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:QuadReg ∟FAT,∟CALS
```

Finally, you can enter an equation variable (such as Y₁) after the command, so that the quadratic is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the quadratic will be in terms of X anyway, this doesn't make much sense.

An example of QuadReg with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:QuadReg ∟FAT,∟CALS,∟FREQ,Y₁
```

# Advanced

Note that even if a relationship is actually linear, since a quadratic regression has all the freedom of a linear regression and more, it will produce a better R² value, especially if the number of terms is small, and may lead you to (falsely) believe that a relationship is quadratic when it actually isn't. Take the correlation constant with a grain of salt, and consider if the fit is really that much better at the expense of added complexity, and if there's any reason to believe the relationship between the variables may be quadratic.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/quadreg

The QuartReg Command

Calculates the best fit quartic equation through a set of points.

QuartReg [*x-list*, *y-list*, [*frequency list*], [*equation variable*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- 7 to select QuartReg, or use arrows

TI-83/84/+/SE

1 byte

The QuartReg command can calculate the best fit quartic equation through a set of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the Nth element of one list matches up with the Nth element of the other list. L1 and L2 are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points. You must have at least 5 points, because there's infinitely many quadratics that can go through 4 points or less

In its simplest form, QuartReg takes no arguments, and calculates a quartic through the points in L1 and L2:

```
:{9,13,21,30,31,31,34→L1
:{260,320,420,530,560,550,590→L2
:QuartReg
```

On the home screen, or as the last line of a program, this will display the equation of the quartic: you'll be shown the format, y=ax^{4}+bx^{3}+cx^{2}+dx+e, and the values of a, b, c, d, and e. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, c, d, e, and R^{2} will be set as well. This latter variable will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

You don't have to do the regression on L1 and L2, but if you don't you'll have to enter the names of the lists after the command. For example:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:QuartReg ∟FAT,∟CALS
```

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they're L1 and L2.

Finally, you can enter an equation variable (such as Y_{1}) after the command, so that the quartic equation is stored to this variable automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the quadratic will be in terms of X anyway, this doesn't make much sense.

An example of QuartReg with all the optional arguments:

```
:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:QuartReg ∟FAT,∟CALS,∟FREQ,Y1
```

# Advanced

Note that even if a relationship is actually linear, since a quartic regression has all the freedom of a linear regression and much more, it will produce a better R^{2} value, especially if the number of points is small, and may lead you to (falsely) believe that a relationship is quartic when it actually isn't. An extreme example is the case of 5 points which are close to being on a line. The linear regression will be very good, but the quartic will seem even better - it will go through all 5 points and have an R^{2} value of 1. However, this doesn't make the 5 points special - any 5 (that don't have repeating x-values) will do! Take the correlation constant with a grain of salt, and consider if the fit is really that much better at the expense of much added complexity, and if there's any reason to believe the relationship between the variables may be quartic.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/quartreg

The r Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:radian

The r (Radian Symbol) Command

If the calculator is in degree mode, the ^{r} (radian) symbol converts a radian angle to degrees.

*angle*^{r}

Press:

- 2nd ANGLE to access the angle menu.
- 3 to select
^{r}, or use arrows and ENTER.

TI-83/84/+/SE

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.

Normally, when the calculator is in degree mode, the trigonometric functions only return values calculated in degrees. With the ` ^{r}` symbol you can have the angle evaluated as if in radian mode because it converts the angle into degrees.

One full rotation around a circle is 2π radians, which is equal to 360°. To convert an angle in radians to degrees you multiply by 180/π, and to convert from degrees to radians multiply by π/180.

In degree mode:

```
sin(π) \\sine of Pi degrees
.0548036651
sin(π^^r)
0
```

In radian mode:

```
sin(π)
0
sin(π^^r)
0 \\There's no difference when in radians
```

# Optimization

When you only call the trig function once in a program and want it calculated in radians, instead of changing the mode you can just use `°` to save one-byte (the newline from using the command `Radian`)

```
:Radian
:sin(X)
can be
:sin(X^^r)
```

# Related Commands

`°`(degree symbol)

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/radian-symbol

The Radian Command

Puts the calculator in Radian mode.

Radian

While editing a program, press:

- MODE to access the mode menu.
- Use arrows and ENTER to select Radian.

TI-83/84/+/SE

1 byte

The Radian command puts the calculator into Radian mode, where the inputs and/or outputs to trig functions are assumed to be radian angles.

Angles measured in radians range from 0 to 2π. They are defined as the arc length of the arc, on a unit circle (circle with radius 1), that corresponds to the angle when it is placed in the center. This definition actually only differs from degree measurements by a constant factor.

To convert from a degree angle to a radian angle, multiply by 180/π. To go the other way, and get a radian angle from a degree angle, multiply by π/180.

The following commands are affected by whether the calculator is in Radian or Degree mode:

The input is differently interpreted:

The output is differently expressed:

However, some commands are notably unaffected by angle mode, even though they involve angles, and this may cause confusion. This happens with the SinReg command, which assumes that the calculator is in Radian mode even when it's not. As a result, the regression model it generates will graph incorrectly in Degree mode.

Also, complex numbers in polar form are an endless source of confusion. The angle( command, as well as the polar display format, are affected by angle mode. However, complex exponentials (see the e^( command), defined as $\definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} e^{i\theta}=\cos\theta+i\sin\theta$, are evaluated as though in Radian mode, regardless of the angle mode. This gives mysterious results like the following:

```
Degree:re^θi
Done
e^(πi)
1e^(180i)
Ans=e^(180i)
0 (false)
```

Overall, it's better to put your calculator in Radian mode when dealing with polar form of complex numbers, especially since no mathematician would ever use degrees for the purpose anyway.

# Optimization

It's sometimes beneficial to use the ^{r} command instead of switching to Radian mode. The ^{r} symbol will make sure a number is interpreted as a radian angle, even in degree mode, so that, for example:

Degree

………………Done

sin(π)

……………….0548036651

sin(π^{r})

………………0

This is smaller when only one trig calculation needs to be done. Also, it doesn't change the user's settings, which are good to preserve whenever possible.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/radian-mode

The rand Command

Generates a random number between 0 and 1, or a list of such numbers. Can also be used to set the random number seed.

rand

rand(*# of numbers*)

*seed*→rand

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- ENTER to select rand.

TI-83/84/+/SE

1 byte

rand generates a uniformly-distributed pseudorandom number (this page and others will sometimes drop the pseudo- prefix for simplicity) between 0 and 1. rand(*n*) generates a list of *n* uniformly-distributed pseudorandom numbers between 0 and 1. *seed*→rand seeds (initializes) the built-in pseudorandom number generator. The factory default seed is 0.

L'Ecuyer's algorithm is used by TI calculators to generate pseudorandom numbers.

```
0→rand
0
rand
.9435974025
rand(2)
{.908318861 .1466878292}
```

**Note:** Due to specifics of the random number generating algorithm, the smallest number possible to generate is slightly greater than 0. The largest number possible *is* actually 1, but since returning a result of 1 would mess up the output of randBin( and randNorm(, the actual value returned in such cases is 1-1.11e-12 (which is displayed as 1, and is "equal" to 1 for the purposes of the = command). To see 1, store 196164532 to rand and then run the random number generator.

# Advanced Uses

To seed the random number generator, store a positive integer to rand (the command will ignore any decimals, and the sign of the number). Seeding the random number generator has several uses:

When writing a program that uses random numbers, you may add a 0→rand instruction to the beginning of the program — this ensures that the program's actions will be repeatable, making it easier to fix a bug. Just don't forget to take it out when you've finished writing the program.

Seeding the random number generator can also be used to create fairly secure (unbreakable without a computer) encryption. Pick a secret key, and store it to rand as a seed. Then, perform some randomly generated manipulations on the data you want to encode — for example, shifting each character of a string by a random number. Decoding the message is simple: store the secret key to rand and perform the opposite of those random operations. However, this is impossible to do if you don't know the secret key.

When seeding the random number generator, as above, you make every random number generated afterwards predictable. This may be problematic even if your program doesn't need random numbers, because other programs might. To prevent this, use the following code to save and restore "randomness":

:randInt(1,E9)→N

(code that involves seeding the RNG here)

:N→rand

Since generating random numbers is a fairly time-consuming operation, the rand(*# of numbers*) syntax is very effective at generating a delay in your program — just add the line:

`:rand(N)`

The bigger N is, the longer the delay. In relation to the commonly used For( loop delay, the number used in the rand( delay is about 10 times smaller. However, this code has a side effect of storing a list of random numbers to Ans, which may be undesirable. To avoid this, use this somewhat longer line:

`:If dim(rand(N))`

Despite the presence of an If statement, you don't have to worry about the next line being skipped, since dim(rand(N)) will always be true.

# Error Conditions

**ERR:DOMAIN**if you try to generate a list of random numbers and the list length isn't an integer 1-999.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rand

The rand() Command

Generates a random number.

rand() or rand(*n*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 4 to paste rand(.

This command works on all calculators.

2 bytes

The rand() command generates a random number. It can be used in one of two ways:

- rand() gives a random real number between 0 and 1.
- rand(
*n*) gives a random integer between 1 and*n*.

By adding or multiplying appropriately, you can change these bounds. For example, 10rand() gives a random real number between 0 and 10, and rand(9)-5 gives a random number between -4 and 4.

L'Ecuyer's algorithm is used by TI calculators to generate pseudorandom numbers.

```
:RandSeed 0
:rand()
.943597402492
:rand()
.908318860975
:rand(10)
2
```

# Advanced Uses

Using the RandSeed command makes the random numbers entirely predictable: after setting the random seed to some value, the same random numbers will be returned every time.

# Error Conditions

**260 - Domain error** happens when the maximum number is 10^{14} or greater.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:rand

The randBin( Command

Generates a random number with the binomial distribution.

randBin(*n*,*p*,*# simulations*)

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 7 to select randBin(, or use arrows.

TI-83/84/+/SE

2 bytes

randBin(*n*,*p*) generates a pseudorandom integer between 0 and *n* inclusive according to the binomial distribution B(*n*,*p*) - that is, *n* trials of an event with probability of success *p* are performed, and the number of successes is returned. randBin(*n*,*p*,*simulations*) performs the above calculation *simulations* times, and returns a list of the results. The expected (average) result is *n***p*.

*n* should be an integer greater than or equal to 1, while *p* should be a real number between 0 and 1 inclusive.

*seed*→rand affects the output of randBin(

```
0→rand
0
randBin(5,1/2
2
randBin(5,1/2,10
{3 3 2 4 3 2 2 2 4 3}
```

# Formulas

The value of randBin( for a given seed can be expressed in terms of rand:

`randBin(N,P)=sum(P>rand(N`

This is identical to the output of randBin( in the sense that for the same seed, both expressions will generate the same random numbers.

# Error Conditions

**ERR:DOMAIN**is triggered if the probability is not on the interval from 0 to 1.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/randbin

The randInt( Command

Generates a random integer between *min* and *max*, inclusive, or a list of such numbers.

randInt(*min*,*max*[,*# of numbers*])

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 5 to select randInt(, or use arrows.

TI-83/84/+/SE

2 bytes

randInt(*min*,*max*) generates a uniformly-distributed pseudorandom integer between *min* and *max* inclusive. randInt(*min*,*max*,*n*) generates a list of *n* uniformly-distributed pseudorandom integers between *min* and *max*.

*seed*→rand affects the output of randInt(.

```
0→rand
0
randInt(1,10)
10
randInt(1,10,5)
{10 2 6 5 8}
```

# Optimization

When the lower bound of randInt( is 0, you can replace it with int(#rand to save space. For example:

```
:randInt(0,12
can be
:int(13rand
```

Similarly, if you don't want to include zero in the range, you can use a variant of 1-#int(#rand:

`:1-2int(2rand`

In this particular example, the only values that you will ever get are -1 or 1.

# Formulas

The value of randInt( for a given seed can be expressed in terms of rand:

randInt(A,B)=

- when A<B, A+int((B-A+1)rand
- otherwise, B+int((A-B+1)rand

This is identical to the output of randInt( in the sense that for the same seed, both expressions will generate the same random numbers.

# Error Conditions

**ERR:DOMAIN**is thrown if any of the arguments is a decimal.**ERR: DATA TYPE**is given if you use imaginary numbers like 6i or something like Matrices or Lists. This error is used instead of ERR:DOMAIN for "i".

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/randint

The randIntNoRep( Command

Used to create random lists

randIntNoRep(start,end)

[Math][left][8]

OS 2.53MP and TI-84+/SE

2 bytes (EF35h)

randIntNoRep( is used when you need to create a list of numbers in random order in which no integer is repeated. This command is useful for things such as simulating decks of cards. Commonly, before this command was introduced, the following code would shuffle a deck:

```
rand(52→L₂
seq(X,X,0,51→L₁
SortA(L₂,L₁
```

This result can now be achieved with the following code:

`randIntNoRep(0,51→L₁`

# Advanced Uses

*seed*→rand affects the output of randIntNoRep(

What this does is quite simple. When you seed rand, then the next time you use randIntNoRep(, you will get a result that will be fairly random, but the same on all calculators. This allows several things to be possible, including password protection and encryption. For example, if you were to use the following code, you could encrypt and decrypt messages only if you use the same encryption value. In this example, Str1 contains the message:

Decode:

```
"ABCDEFGHIJKLMNOPQRSTUVWXYZ .!,0123456789→Str2
Input "CODE:",A
A→rand
randIntNoRep(1,length(Str2→L1
length(Str1→B
".
For(A,1,B
Ans+sub(Str2,sum(cumSum(L1=inString(Str2,sub(Str1,A,1)))),1
End
sub(Ans,2,B
```

Encode:

```
"ABCDEFGHIJKLMNOPQRSTUVWXYZ .!,0123456789→Str2
Input "CODE:",A
A→rand
length(Str2→C
randIntNoRep(1,Ans→L1
length(Str1→B
".
For(A,1,B
Ans+sub(Str2,L1(C+1-inString(Str2,sub(Str1,A,1))),1
End
sub(Ans,2,B
```

The output strings are in Ans

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/randintnorep

The randM( Command

Creates a matrix of specified size with the entries random integers from -9 to 9.

randM(*# rows*, *# columns*)

Press:

- MATRX (TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu
- RIGHT to access the MATH submenu.
- 6 to select randM(, or use arrows.

TI-83/84/+/SE

1 byte

randM(*M*, *N*) generates an M by N matrix whose entries are pseudorandom integers between -9 and 9 inclusive.

*seed*→rand affects the output of randM(.

```
0→rand
0
randM(3,3)
[[9 -3 -9]
[4 -2 0 ]
[-7 8 8 ]]
```

If you actually cared about the bounds of the random numbers, this command would not be very useful, since it's hard to manipulate the matrix to yield uniformly spread random numbers in a different range.

# Formulas

The entries of randM( are actually the outputs of successive calls to randInt(-9,9), filled in starting at the bottom right and moving left across each row from the last row to the first.

# Error Conditions

**ERR:INVALID DIM**is thrown if the number of rows or columns of the matrix isn't an integer 1-99.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/randm

The randMat() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:randmat

The randNorm( Command

Generates a random normally-distributed number with specified mean and standard deviation.

randNorm(*µ*,*σ*,[*n*])

Press:

- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 6 to select randNorm(, or use arrows.

TI-83/84/+/SE

2 bytes

randNorm(*µ*,*σ*) generates a normally-distributed pseudorandom number with mean *µ* and standard deviation *σ*. The result returned will most probably be within the range *µ*±3*σ*. randNorm(*µ*,*σ*,*n*) generates a list of *n* normally-distributed pseudorandom numbers with mean *µ* and standard deviation *σ*.

*seed*→rand affects the output of randNorm(.

```
0→rand
0
randNorm(0,1)
-1.585709623
randNorm(0,1,3)
{-1.330473604 1.05074514 -.0368606663}
```

Although a theoretical normally distributed variable could take on any real value, numbers on a calculator have a limited precision, which leads to a maximum range of approximately *µ*±7.02*σ* for values of randNorm(.

# Optimization

When the mean is 0 and the standard deviation 1, invNorm(rand) and invNorm(rand(N)) save space over randNorm(0,1) and randNorm(0,1,N) respectively.

# Formulas

The value of randNorm( for a given seed can be expressed in terms of rand:

`randNorm(µ,σ)=µ-σinvNorm(rand`

This is identical to the output of randNorm( in the sense that for the same seed, both expressions will generate the same random numbers.

The following formula can be used to get a target interval where A and B are two real intervals.

```
µ=(A+B)/2
σ=(-A+B)/6
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/randnorm

The randNorm() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:randnorm

The randPoly() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:randpoly

The RandSeed Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:randseed

The RclPic command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:rclpic

The real( Command

Returns the real part of a complex value.

real(*value*)

Press:

- MATH to access the math menu.
- RIGHT, RIGHT to access the CPX (complex) submenu.
- 2 to select real(, or use arrows.

TI-83/84/+/SE

2 bytes

real(*z*) returns the real part of the complex number *z*. If *z* is represented as *x*+i*y* where *x* and *y* are both real, real(*z*) returns *x*. Also works on a list of complex numbers.

```
real(3+4i)
3
```

# Advanced Uses

The real( command is expanded by several assembly libraries (such as xLIB and Omnicalc) to call their own routines. If xLib is installed, then real( will no longer work as intended even in programs that want to use it for its intended purpose.

If you actually want to take the real part of a complex number, and want the program to work with one of these assembly libraries, you could use the imag( command instead - real(Z) is equivalent to imag(Z*i*). Alternatively, you could tell people using your program to uninstall xLIB or Omnicalc first.

If a program you downloaded has an error and 2:Goto takes you to a line with real( and a bunch of arguments, this is probably because the program uses Omnicalc or xLIB which you don't have installed.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/real-func

The Real Command

Enables real number only mode.

Real

While editing a program, press:

- MODE to access the mode menu.
- Use arrows and ENTER to select Real.

TI-83/84/+/SE

1 byte

The Real command puts the calculator in real number-only mode. This shouldn't be taken quite literally, as you can still type in *i* to get complex numbers, and do operations with them (they will be displayed as in a+bi mode, in that case). However, any operation done with **real** numbers that comes out to a complex result, such as taking the square root of a negative number, will throw a ERR:NONREAL ANS error.

There is no real advantage to using Real mode over a+bi mode — it just adds another error condition that wouldn't be triggered otherwise. However, it is the default setting, and so there's a good chance that the calculator will be in Real mode when someone runs your program. Thus, when using complex numbers implicitly (such as in a quadratic equation solver) you should do something about this.

# Advanced Uses

Rather than switch to a+bi mode, you might want to force the calculations to use complex numbers by making the original argument complex. The general way to do this is by adding +0i to the number. However, there may be an optimization in any particular case. See the quadratic formula routine for a good example of this.

```
Real
Done
√(-1)
(causes an error)
√(-1+0i)
i
```

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/real-mode

The RecallGDB Command

Recalls graph settings from a GDB (Graph DataBase) variable

RecallGDB *number*

Press:

- 2nd DRAW to access the draw menu.
- LEFT to access the STO menu.
- 4 to select RecallGDB, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The RecallGDB command recalls graph settings a GDB (Graph DataBase) variable, one of GDB1, GDB2, …, GDB0 (as indicated by the argument). These settings can be stored to a GDB using the StoreGDB command.

The settings stored in a GDB include:

- The graphing mode currently enabled.
- All equations in the current graphing mode, but NOT other graphing modes.
- All window variables applicable to the current graphing mode. This does not include zoom variables, table settings, or irrelevant variables such as Tmin when in function mode.
- The menu settings relevant to graphing (everything in the 2nd FORMAT menu, as well as Connected/Dot and Sequential/Simul settings in the MODE menu)

The number passed to RecallGDB must be one of 0 through 9. It has to be a number: RecallGDB X will not work, even if X contains a value 0 through 9.

# Advanced Uses

The StoreGDB and RecallGDB variables are useful in cleaning up after a program finishes running, preserving the user's settings. If your program heavily relies on the graph screen, it may end up editing window size or other graph settings, which the user might want to be saved. This is easily done:

Add StoreGDB 1 (or any other number) to the beginning of your program.

Then, feel free to edit any graph settings you like.

At the end of your program, add RecallGDB 1, followed by DelVar GDB1, to recall the graph settings stored at the beginning.

GDBs can also be useful in adding extra string storage. You can store strings to the Yn variables, and back them up in a GDB; to retrieve them later, recall the GDB and use Equ►String( to store the equations to the strings again.

# Error Conditions

**ERR:DATA TYPE**is thrown if the argument is not a*number*0 through 9.**ERR:UNDEFINED**is thrown if the requested GDB does not exist.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/recallgdb

The RecallPic Command

Recalls a saved picture (one of Pic1, Pic2, …, Pic0) to the graph screen.

RecallPic *number*

Press:

- 2nd DRAW to access the draw menu.
- LEFT to access the STO submenu.
- 2 to select RecallPic, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

`RecallPic` draws a saved picture to the graph screen (to save a picture, draw it on the graph screen, then save it with `StorePic`). If something is already drawn on the graph screen, `RecallPic` will draw new pixels where needed, but it will not erase anything. As a result, you often want to `ClrDraw` before recalling a picture.

The number passed to `RecallPic` must be one of 0 through 9. It has to be a number: `RecallPic X` will not work, even if X contains a value 0 through 9.

# Advanced Uses

A combination of `StorePic` and `RecallPic` can be used to maintain a background over which another sprite moves:

- Draw the background, and save it to a picture file with
`StorePic`. - Next, draw the sprite to the screen.
- When you want to move the sprite, erase it, then use
`RecallPic`to draw the background again. - Then draw the sprite to its new location on the screen again (this can be done before or after using
`RecallPic`).

Also, if a screen in your program takes more than a second to draw, and is displayed several times, you might want to consider storing it to a picture the first time it's drawn, and then recalling it every next time you want to draw it.

# Error Conditions

**ERR:DATA TYPE**is thrown if the argument is not a**number**0 through 9.**ERR:UNDEFINED**is thrown if the requested picture does not exist.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/recallpic

The ►Rect Command

Formats a complex value in rectangular form when displaying it.

*value*►Rect

Press:

- MATH to access the math menu.
- RIGHT RIGHT to access the CPX submenu.
- 6 to select ►Rect, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The ►Rect command can be used when displaying a complex number on the home screen, or with the Disp and Pause commands. It will then format the number as though a+bi mode were enabled, even when it's not. It also works with lists.

```
i►Polar
1e^(1.570796327i)
Ans►Rect
i
```

It will also work when displaying a number by putting it on the last line of a program by itself. It does **not** work with Output(, Text(, or any other more complicated display commands.

To actually separate a number into the components of rectangular form, use real( and imag(.

# Error Conditions

**ERR:SYNTAX**is thrown if the command is used somewhere other than the allowed display commands.**ERR:DATA TYPE**is thrown if the value is real.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rect

The RectGC Command

Sets the calculator to display point coordinates using rectangular (Cartesian) coordinates.

RectGC

Press:

- 2nd FORMAT to access the graph format screen
- Use arrows and ENTER to select RectGC.

TI-83/84/+/SE

2 bytes

The RectGC ("Rectangular Grid Coordinates") command (like its opposite, the PolarGC) command, affects how the coordinates of a point on the graph screen are displayed. When RectGC is enabled, the coordinates of a point are displayed as (X,Y).

The X and Y coordinates of a point are interpreted as the horizontal and vertical distance from the origin (the point (0,0)) Up and right are positive directions, while down and left are negative. For example, the point (1,-2) — that is, the point with x-coordinate 1 and y-coordinate -2 — is one horizontal unit right and two horizontal units down from (0,0).

Of course, coordinates are only displayed with the CoordOn setting; however, with CoordOff, RectGC and PolarGC are still useful, because in a variety of cases, the coordinates of a point are also stored to variables. With RectGC enabled, they are stored to X and Y.

# Advanced

The following situations involve storing coordinates of a point to variables:

- Graphing an equation
- Tracing an equation or plot
- Moving the cursor on the graph screen
- Using the interactive mode of one of the 2nd DRAW commands
- Using one of DrawF, DrawInv, or Tangent(
- Anything in the 2nd CALC menu.

Naturally, any command like Input or Select( which involves the above, will also store coordinates of a point.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rectgc

The ref( Command

Puts a matrix into row-echelon form.

ref(*matrix*)

Press:

- MATRX (on the TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the MATH submenu.
- ALPHA A to select ref(, or use arrows.

TI-83/84/+/SE

2 bytes

Given a matrix with at least as many columns as it has rows, the ref( command uses a technique called Gaussian elimination to put the matrix into row-echelon form.

This means that the leftmost N columns (if the matrix has N rows) of the matrix are upper triangular - all entries below the main diagonal are zero. What's more, every entry on the main diagonal is either 0 or 1.

```
[[1,2,5,0][2,2,1,2][3,4,6,2]]
[[1 2 5 0]
[2 2 1 2]
[3 4 6 2]
ref(Ans)►Frac
[[1 4/3 2 2/3]
[0 1 9/2 -1 ]
[0 0 0 0 ]]
```

# Advanced Uses

In theory, a system of linear equations in N variables can be solved using the ref( command - an equation of the form $a_1x_1+\dots + a_nx_n = b$ becomes a row $a_1, \dots, a_n, b$, and is put into the matrix. If there is a sufficient number of conditions, the last row of the reduced matrix will give you the value of the last variable, and back-substitution will give you the others.

In practice, it's easier to use rref( instead for the same purpose.

# Error Conditions

**ERR:INVALID DIM**is thrown if the matrix has more rows than columns.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/ref

The remain() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:remain

The Repeat Command

Loops through a block of code until the condition is true. Always loops at least once.

Repeat *condition*

*statement(s)*

End

While editing a program press:

- PRGM to enter the PRGM menu
- 6 to choose Repeat, or use arrows
- 7 to choose End, or use arrows

TI-83/84/+/SE

1 byte

A Repeat loop executes a block of commands between the Repeat and End commands until the specified condition is true. The condition is tested at the end of the loop (when the End command is encountered), so the loop will always be executed at least once. This means that you sometimes don't have to declare or initialize the variables in the condition before the loop.

After each time the Repeat loop is executed, the condition is checked to see if it is true. If it is true, then the loop is exited and program execution continues after the End command. If the condition is false, the loop is executed again.

# Advanced Uses

When using Repeat loops, you have to provide the code to break out of the loop (it isn't built into the loop). If there is no code that ends the loop, then you will have an infinite loop. An infinite loop just keeps executing, until you have to manually exit the loop (by pressing the ON key). In the case that you actually want an infinite loop, you can just use 0 as the condition. Because 0 is always false (based on Boolean Logic), the loop will never end.

```
:Repeat 0
:statement(s)
:End
```

Each time the program enters a Repeat block, the calculator uses 35+(size of the condition) bytes of memory to keep track of this. This memory is given back to you as soon as the program reaches End. This isn't really a problem unless you're low on RAM, or have a lot of nested Repeat statements. However, if you use Goto to jump out of a Repeat block, you lose those bytes for as long as the program is running — and if you keep doing this, you might easily run out of memory, resulting in ERR:MEMORY.

# Optimization

The Ans variable (last answer) is a temporary variable that can hold any variable. Ans is changed when there is an expression or variable storage or when pausing with the Pause command. It is mostly useful when you are just manipulating one variable. To use Ans just put an expression on a line by itself; it will automatically be stored to Ans. You can then change the expressions on the next line where the variable was called and put Ans there instead.

Because Repeat loops are executed at least once, you can sometimes put Ans in the condition instead of the variable.

```
:Repeat A
:getKey→A
:End
can be
:Repeat Ans
:getKey→A
:End
```

# Command Timings

When deciding whether to use a Repeat loop, as opposed to a For or While loop, it's good to know how Repeat loops stack up against them. This comparison comes from the Code Timings page showing the speeds of the three different kinds of loops:

Format | Bars | Pixels |
---|---|---|

For(A,0,2000 End |
4 bars + 4 pixels | 36 |

Delvar A While A≤2000 A+1→A End |
23 bars | 184 |

Delvar A Repeat A>2000 A+1→A End |
22 bars + 7 pixels | 183 |

The general conclusion you can take away from this table is that For( loops should be used when speed is a priority, and then you should use Repeat or While loops when the appropriate circumstance comes up. Each kind of loop has its own place, so it's still good to know how to use all three of them.

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/repeat

The Return Command

Stops the program and returns the user to the home screen. If the program is a subprogram, however, it just stops the subprogram and returns program execution to the parent program.

Return

Press:

- PRGM to enter the PRGM menu
- ALPHA SIN to choose Return, or use arrows

TI-83/84/+/SE

1 byte

When the Return command is used in a program it exits the program (terminating the program execution) and returns the user to the home screen. If it is encountered within loops, the loops will be stopped.

There is some distinction when using Return with subprograms: the Return command will stop the program execution of the subprogram, and program execution will go back to the calling program, continuing right after the subprogram call. If this functionality is not desired, then you should use the Stop command instead. Generally, though, you should use Return instead of Stop.

```
:ClrHome
:Input "Guess:",A
:Stop
Replace Stop with Return
:ClrHome
:Input "Guess:",A
:Return
```

# Optimization

You don't have to put a Return command at the end of a program or subprogram if you can organize the program so that it just naturally quits. When the calculator reaches the end of a program, it will automatically stop executing as if it had encountered a Return command (the Return is implied).

```
:ClrHome
:Input "Guess:",A
:Return
Remove the Return
:ClrHome
:Input "Guess:",A
```

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/return

The re^θi Command

Puts the calculator into re^θ*i* mode.

re^θ*i*

Press:

- MODE to access the mode menu.
- Use the arrow keys and ENTER to select re^θ
*i*

TI-83/84/+/SE

1 byte

The re^θ*i* command puts the calculator into polar complex number mode. This means that:

- Taking square roots of negative numbers, and similar operations, no longer returns an error.
- Complex results are displayed in the form re^(θ
*i*) (hence the name of the command)

The mathematical underpinning of this complex number format is due to the fact that if (x,y) is a point in the plane using the normal coordinates, it can also be represented using coordinates (r,θ) where r is the distance from the origin and θ is the angle that the line segment to the point from the origin makes to the positive x-axis (see Polar and PolarGC for more information on polar coordinates and graphing). What does this have to do with complex numbers? Simple: if x+y*i* is a complex number in normal (rectangular) form, and re^(θ*i*) is the same number in polar form, then (x,y) and (r,θ) represent the same point in the plane.

Of course, that has a lot to do with how you define imaginary exponents, which isn't that obvious.

An equivalent form to polar form is the form r[cos(θ)+*i*sin(θ)].

Unfortunately, the calculator seems to have some confusion about the use of degree and radian angle measures for θ in this mode (the answer is: you can only use radians — degrees make no sense with complex exponents). When calculating a value re^(θ*i*) by using the e^( command and plugging in numbers, the calculator assumes θ is a radian angle, whether it's in Degree or Radian mode. However, when *displaying* a complex number as re^(θ*i*), the calculator will display θ in radian or degree measure, whichever is enabled. This may lead to such pathological output as:

```
Degree:re^θi
Done
e^(πi)
1e^(180i)
Ans=e^(180i)
0 (false)
```

It's recommended, then, to use Radian mode whenever you're in re^θ*i* mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/re-thetai

The right() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:right

The root() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:root

The rotate() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:rotate

The round() command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:round

The round( Command

Truncates a number to a specified number of decimal places.

round(*value*[,*#decimals*])

Press:

- MATH to select the math menu.
- RIGHT to select the NUM submenu.
- 2 to select round(, or use arrows.

TI-83/84/+/SE

1 byte

round(*value*[,*#decimals*]) returns *value* rounded to *#decimals* decimal places. *#decimals* must be < 10. The default value for *#decimals* is 9. Also works on complex numbers, lists and matrices.

```
round(5.45,0)
5
round(5.65,0)
6
round(‾5.65,0)
‾6
round(π)-π
4.102e-10
round(π,4)
3.1416
round({1.5,2.4,3.8},0)
{2,2,4}
round([[1.8,3.5,120.3][3,‾1,0.2]],0)
[[2 4 120]
[3 ‾1 0 ]]
```

# Advanced Uses

Sometimes, round-off error will cause the result of an expression to be slightly off of the correct integer value — for example, a result may be 5.0000000013 instead of 5. If the error is small enough, it will not even be visible if you recall the variable on the home screen. However, this is enough to cause a ERR:DOMAIN error with commands such as sub( and Output(, which require their arguments to be integers.

The easiest way to fix this problem is by wrapping the different arguments in a round( instruction. For example, you may replace Output(X,1,">") with Output(round(X),1,">"). The int( command will not work here because the round-off error may be negative, such as 4.9999999986 instead of 5, in which case the number will be rounded down to 4.

# Error Conditions

**ERR:DOMAIN**if the number of places to round to is not an integer 0 through 9.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/round

The *row( Command

Multiplies a row by a scalar.

*row(*factor*,*matrix*,*row*)

Press:

- MATRX (on a TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the MATH submenu.
- ALPHA E to select *row(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The *row( command multiplies a row of a matrix by a scalar factor and returns the result. It is an elementary row operation used in Gaussian Elimination.

```
[[1,2][3,4]]
[[1 2]
[3 4]]
*row(10,Ans,1)
[[10 20]
[3 4 ]]
```

# Advanced Uses

You can multiply columns instead of rows with the aid of the ^{T} (transpose) command.

# Error Conditions

**ERR:INVALID DIM**is thrown if the row argument isn't a valid row (is larger than the size of the matrix, or otherwise bad)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/timesrow

The *row+( Command

Adds a multiple of one row of a matrix to another.

*row+(*factor*,*matrix*,*row1*,*row2*)

Press:

- MATRX (on a TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the MATH submenu.
- ALPHA F to select *row+(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The *row+( adds a multiple of one row to another row and returns the result. It is an elementary row operation used in Gaussian Elimination.

```
[[1,2][3,4]]
[[1 2]
[3 4]]
*row+(10,Ans,1,2)
[[3 4 ]
[31 42]]
```

# Advanced Uses

You can add columns instead of rows with the aid of the ^{T} (transpose) command.

# Error Conditions

**ERR:INVALID DIM**is thrown if one of the row arguments isn't a valid row (larger than the matrix size, or otherwise bad)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/timesrowplus

The row+( Command

Adds one row of a matrix to another.

row+(*matrix*,*row1*,*row2*)

Press:

- MATRX (on a TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the MATH submenu.
- ALPHA D to select row+(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The row+( command adds one row of a matrix to the second, and returns the result. It is an elementary row operation used in Gaussian Elimination.

```
[[1,2][3,4]]
[[1 2]
[3 4]]
row+(Ans,1,2)
[[1 2]
[4 6]]
```

# Advanced Uses

You can add columns instead of rows with the aid of the ^{T} (transpose) command.

# Error Conditions

**ERR:INVALID DIM**is thrown if one of the row arguments isn't a valid row (larger than the matrix size, or otherwise bad)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rowplus

The rowSwap( Command

Swaps two rows of a matrix.

rowSwap(*matrix*,*row1*,*row2*)

Press:

- MATRX (on a TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the MATH submenu.
- ALPHA C to select rowSwap(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The rowSwap( command swaps two rows of a matrix and returns the result. It is an elementary row operation used in Gaussian Elimination.

```
[[1,2][3,4]]
[[1 2]
[3 4]]
rowSwap(Ans,1,2)
[[3 4]
[1 2]]
```

# Advanced Uses

You can swap columns instead of rows with the aid of the ^{T} (transpose) command.

# Error Conditions

**ERR:INVALID DIM**is thrown if one of the row arguments isn't a valid row (larger than the matrix size, or otherwise bad)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rowswap

The RplcPic command

Replaces whatever is on the graphscreen with a picture variable at *[row][, column]*

RplcPic *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 replaces whatever is on the screen at a specific spot (*[row][,column]*). If no row or column is specified, the default is the upper left corner (0,0). If the picture is less than the full screen, only the spot at which the picture is placed will be removed. If you do not want anything replaced, use RclPic instead…

# 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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:rplcpic

The R►Pr( Command

R►Pr( calculates the radius component (in polar coordinates) given the Cartesian coordinates.

R►Pr(*x*,*y*)

Press:

- 2nd ANGLE to access the angle menu.
- 5 to select R►Pr(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

R►Pr( (Rectangular to polar radius) takes the (*x*,*y*) (Cartesian) coordinates, and gives the radius coordinate *r* of the same point in (*r*,*θ*) (polar) mode. The identity used for this conversion is *r*² = *x*²+*y*²

```
R►Pr(3,4)
5
√(3²+4²)
5
R►Pr({6,5},{8,12})
{10 13}
```

The function works even when the equivalent √(*x*²+*y*²) fails due to overflow:

```
R►Pr(3e99,4e99)
5e99
```

# Optimization

R►Pr( is the smallest way to implement the distance formula $d=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$. Just give the values x_{1}-x_{2} and y_{1} - y_{2} as arguments:

```
:√((5-2)²+(4-0)²)
can be
:R►Pr(5-2,4-0)
```

# Error Conditions

**ERR:DATA TYPE**is thrown if you input a complex argument.**ERR:DIM MISMATCH**is thrown if two list arguments have different dimensions.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/r-pr

The R►Pθ( Command

R►Pθ( calculates the angle coordinate (in polar coordinates) given the Cartesian coordinates.

R►Pθ(*x*,*y*)

Press:

- 2nd ANGLE to access the angle menu.
- 6 to select R►Pθ(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

R►Pθ( (Rectangular to polar θ) takes the (*x*,*y*) (Cartesian) coordinate, and returns the angle that the ray from (0,0) to (*x*,*y*) makes with the positive x-axis. This is the θ-coordinate of the same point in (*r*,*θ*) (polar) mode. The identity used for this conversion is tan(*θ*)=*y**/x*, with the correct inverse being chosen depending on the quadrant that the point is in. The range of the angle returned is -π<*θ*≤π. R►Pθ( can also be used on lists.

R►Pθ( is equivalent to the atan2() instruction seen in C/++ and FORTRAN.

```
R►Pθ(3,4)
.927295218
tanֿ¹(4/3)
.927295218
R►Pθ(0,{1,-1})
{1.570796327, -1.57096327}
```

R►Pθ( is affected by Degree and Radian mode in its output, which is an angle measured in degrees or radians respectively.

# Advanced Uses

If you want the result to always be a radian angle, regardless of mode settings, you can divide the result by 1^{r}:

`R►Pθ(x,y)/1^^r`

If you want the result to always be a degree angle, regardless of mode settings, you can divide the result by 1°:

`R►Pθ(x,y)/1°`

# Error Conditions

**ERR:DATA TYPE**is thrown if you input a complex argument.**ERR:DIM MISMATCH**is thrown if two list arguments have different dimensions.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/r-ptheta

The rref( Command

Puts a matrix into reduced row-echelon form.

rref(*matrix*)

Press:

- MATRX (on the TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
- RIGHT to access the math menu.
- ALPHA B to select rref(, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

Given a matrix with at least as many columns as rows, the rref( command puts a matrix into reduced row-echelon form using Gaussian elimination.

This means that as many columns of the result as possible will contain a pivot entry of 1, with all entries in the same column, or to the left of the pivot, being 0.

```
[[1,2,5,0][2,2,1,2][3,4,6,2]]
[[1 2 5 0]
[2 2 1 2]
[3 4 7 3]]
rref(Ans)
[[1 0 0 6 ]
[0 1 0 -5.5]
[0 0 1 1 ]]
```

# Advanced Uses

The rref( command can be used to solve a system of linear equations. First, take each equation, in the standard form of $a_1x_1+\dots + a_nx_n = b$, and put the coefficients into a row of the matrix.

Then, use rref( on the matrix. There are three possibilities now:

- If the system is solvable, the left part of the result will look like the identity matrix. Then, the final column of the matrix will contain the values of the variables.
- If the system is inconsistent, and has no solution, then it will end with rows that are all 0 except for the last entry.
- If the system has infinitely many solutions, it will end with rows that are all 0, including the last entry.

This process can be done by a program fairly easily. However, unless you're certain that the system will always have a unique solution, you should check that the result is in the correct form, before taking the values in the last column as your solution. The Matr►list( command can be used to store this column to a list.

# Error Conditions

**ERR:INVALID DIM**is thrown if the matrix has more rows than columns.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/rref

The Sci Command

Puts the calculator in scientific notation mode.

Sci

While editing a program, press:

- MODE to access the mode menu.
- Use arrows and ENTER to select Sci.

TI-83/84/+/SE

1 byte

The Sci command puts the calculator in scientific notation mode, so that all results are displayed in scientific notation: as a (possibly fractional) number between 1 and 10 (not including 10) multiplied by a power of 10.

```
Sci
Done
1000
1e3
{1,2,3}
{1e0 2e0 3e0}
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sci

The sec() Command

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(.

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 `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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:sec

The sech() Command

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(.

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 `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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:sech

The Select( Command

Allows the user to select a subinterval of any enabled Scatter or xyLine plots.

Select(*x-list name*, *y-list name*)

Press:

- 2nd LIST to access the list menu.
- RIGHT to access the OPS submenu.
- 8 to select Select(, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

When Select( is called, if it has any Scatter or xyLine plots to work with, it displays the graph screen and allows the user to pick a left bound and then a right bound on one of the plots (the left and right keys move from point to point, while the up and down keys switch plots). Then, it stores all the points between those bounds to *x-list name* and *y-list name*. Finally, it sets the chosen plot to use *x-list name* and *y-list name* as its X and Y lists.

# Optimization

It isn't necessary to add the ∟ symbol before list names:

```
:Select(∟X,∟Y)
can be
:Select(X,Y)
```

# Error Conditions

**ERR:INVALID**is thrown if there are no enabled Scatter or xyLine plots for the command to work with.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/select

The Send( Command

Sends data or a variable to a connected CBL device.

Send(*variable*)

While editing a program, press:

- PRGM to access the program menu.
- RIGHT to access the I/O submenu.
- ALPHA B to select Send(.

TI-83/84/+/SE/CSE/CE(5.1.5+)

1 byte

The Send( command is used for sending data to a CBL (Calculator Based Laboratory) device (or another compatible device) via a link cable. With some exceptions, Send('s argument must be a variable: a real number, list, matrix, string, equation, picture, or GDB. An expression or a number will not work — Send(5) or Send([A][B]) is invalid.

The exceptions are list or matrix elements (that is, you can do Send([A](1,1)) or Send(L1(2)) without an error) and non-variable lists typed out with { } brackets and commas.

# Norland Robot

You can use Send( with a Get( for a Norland calculator robot. The format called CLR format. C stands for command number, L stands for left axle, and R stands for right axle. If the command number is 1, it makes the robot moves in a direction for the time specified later in the command. If it is 2, the robot moves until the bumper hits a wall. If it is 3, it moves for a specified amount of time and stops when the robot when the bumper hits a wall. For example, send({122,100}) will make the robot move forward for 100 centiseconds, send({222}) makes it go forward until the bumper hits the wall, and send({322,100}) makes the robot move forward for 100 centiseconds and stops it when the bumper is pressed. The last two axle control numbers are like this:

0=backwards

1=stop

2=forwards

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/send

The seq( Command

Creates a list by evaluating a formula with one variable taking on a range of values, optionally skipping by a specified step.

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

While editing a program, press:

- 2nd LIST to enter the LIST menu
- RIGHT to enter the OPS submenu
- 5 to choose seq(, or use arrows.

TI-83/84/+/SE/CSE/CE

1 byte

The `seq(` command is very powerful, as it is (almost) the only command that can create a whole list as output. This means that you will need make use of it almost every time that you use lists. The `seq(` command creates a list by evaluating a formula with one variable taking on a range of several values.

It is similar in this to the `For(` command, but unlike `For(`, instead of running a block of commands, it only evaluates a formula. Like the For( command, there is an optional "step" that you can use to get every 3rd, every 5th, etc. value in the range.

Some sample uses of the command:

`:seq(I,I,3,7`

- evaluates the expression 'I' with I taking on the values 3..7
- returns {3,4,5,6,7}

`:seq(AX²,X,1,7`

- evaluates the expression
`AX²`with X taking on the values 1..7 - returns
`{A,4A,9A,16A,25A,36A,49A}`, depending on the value of A

`:seq(Y1(T),T,1,9,2`

- evaluates the expression
`Y₁(T)`with T taking on every 2nd value 1..9 - returns
`{Y₁(1),Y₁(3),Y₁(5),Y₁(7),Y₁(9)}`depending on Y₁

Note: the value of the variable used in the expression does not change. If X has some value stored to it, and you do a `seq(` command using X, X will still hold that original value. However, if X was undefined before the command, after the command, it will be defined and have a value of 0.

# Advanced Uses

The step argument supplied can be negative. If it is, and if the starting value is greater than the ending value, then the sequence will "go backward", evaluating the expression in the opposite order. For example:

```
:seq(I,I,1,7
{1,2,3,4,5,6,7}
:seq(I,I,7,1,-1
{7,6,5,4,3,2,1}
```

You can use `seq(` to get a "sublist", that is, to get a list that is only a section of another list. This is pretty much the only effective way to extract a sublist. For example, to get the 2nd through 10th elements of L₁, do the following:

`:seq(L1(I),I,2,10`

While using `seq(`, the calculator can still interpret keypresses and store them to `getKey`. One possible way you can use this feature is to make a password function that asks the user to enter in the correct password before time expires.

# Optimizations

It's faster to do an operation on an entire list, than to do the same operation inside a seq( command. For example, take the following:

```
:seq(Y1(T),T,1,9
can be
:Y1(seq(T,T,1,9
```

However, not all commands that work for numbers will work for lists. A notable example is getting an element from a list: L₁({1,2,3 will not return the first, second, and third elements of L₁, so you will have to put the L₁ inside the `seq(` command.

For this same reason, you shouldn't use a `seq(` command when you're really performing an operation on each element of a list. For example, if L₁ has 10 elements:

```
:seq(L1(I)²,I,1,dim(L1
can be
:L1²
```

When generating a list of values incremented by a number i from i to a number N, `seq(` is not recommended as the amount of overhead on the command considerably slows the generation of the list.

In cases where such a list is to be generated, it is beneficial to generate a list of a specific length, fill that list with the incrementer, and cumulatively sum each value in the list. For example, if a list of all the numbers between 1 and 500 were desired:

```
:500→dim(L1
:Fill(1,L1
:cumSum(L1→L1
```

This operation can be sped up even more using `binomcdf(` or `binompdf(`.

A `seq(` command can replace a `For(` command, if all you're doing inside the `For(` command is storing to an element of a list. This will improve on both speed and size of your program. For example:

```
:For(I,1,10
:I²→L1(I
:End
can be
:seq(I²,I,1,10→L1
```

The `seq(` command itself can often be replaced with an unusual use of the `binomcdf(` or `binompdf(` commands, improving speed and sometimes size as well. However, this optimization is fairly advanced; read the pages for those commands to learn about it.

# Error Conditions

**ERR:ILLEGAL NEST**is thrown if you try to use seq( inside of another seq( command.**ERR:DATA TYPE**occurs when any of the inputted arguments are imaginary or complex.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/seq-list

The seq() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:seq

The Seq Command

Enables sequence graphing mode.

Seq

While editing a program, press:

- MODE to access the mode menu.
- Use arrows to select Seq.

TI-83/84/+/SE

1 byte

The Seq command enables sequence graphing mode.

Sequential mode is used for graphing sequences, which can be thought of as functions from the positive (or non-negative) integers. The TI-83 calculators let *n* be the independent variable in this situation, and the three sequences, instead of using subscripts, use the letters u, v, and w.

One of the main advantages of sequential mode is that it allows recursive definitions: u(*n*) can be defined in terms of u(*n*-1) and u(*n*-2). For recursive definitions to work, an initial case must be defined: this is done using the variables u(*n*Min), v(*n*Min), and w(*n*Min). The constant *n*Min is the initial case, for which the calculator will use a specific value rather than the formula.

For example, say a bunny population starts out at 100 and doubles each year. We can describe this situation using the recursive definition u(*n*)=2u(*n*-1) (this just says that the *n*th year population is twice the population of the previous year); then we set u(*n*Min)=100. Note that without u(*n*Min), the equation would be meaningless - without the initial population, we have no way to calculate any other population.

When you're using more than one previous value — both u(*n*-1) and u(*n*-2)) — you need more than one initial value, and then u(*n*Min) becomes a list.

# Advanced Uses

Sequence graphing mode has several submodes that can be selected from the 2nd FORMAT screen. They are Time, Web, uvAxes, uwAxes, and vwAxes. Sequences are still defined in the same way, but these modes control the way that they're graphed.

The window variables that apply to sequence mode are:

— Determines the minimum*n*Min*n*-value calculated for equations.— Determines the maximum*n*Max*n*-value calculated for equations.**PlotStart**— Determines the first value of*n*that is actually graphed.**PlotStep**— Determines the difference between consecutive*graphed*values of*n*.**Xmin**— Determines the minimum X-value shown on the screen.**Xmax**— Determines the maximum X-value shown on the screen.**Xscl**— Determines the horizontal space between marks on the X-axis in AxesOn mode or dots in GridOn mode.**Ymin**— Determines the minimum Y-value shown on the screen.**Ymax**— Determines the maximum Y-value shown on the screen.**Yscl**— Determines the vertical space between marks on the Y-axis in AxesOn mode or dots in GridOn mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/seq-mode

The Sequential Command

Puts the calculator into sequential graphing mode.

Sequential

While editing a program, press:

- MODE to access the mode menu.
- Use arrows and ENTER to select Sequential.

TI-83/84/+/SE

2 bytes

Puts the calculator into sequential graphing mode (the default). When multiple equations are enabled at the same time, sequential graphing mode means that they will be graphed one after the other (as opposed to Simul mode, in which they will be graphed simultaneously)

If you use a list in an equation, as with Y1={1,2,3}X, this will graph several equations that will always graph separately, regardless of this setting, which only affects multiple functions in different equation variables.

Make sure not to confuse this with Seq mode, which is referred to in this guide as sequence graphing mode.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sequential

The setDate( Command

Sets the date of the clock on the TI-84+/SE.

setDate(*year*,*month*,*day*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- s to skip to commands starting with S
- Scroll down to setDate( and select it

TI-84+/SE

2 bytes

The setDate( command sets the date of the clock on the TI-84+/SE calculators. It takes three arguments: the year, the month, and the day. All three of these must be integers; in particular, year must be four digits, and month and day can be one or two digits. They represent the associated value that goes with a respective date. For example, this would set the date to January 1, 2008:

`:setDate(2008,1,1`

Once you have set the date, you can display it in three different formats on the mode screen using the setDtFmt( command: Month/Day/Year, Day/Month/Year, or Year/Month/Day. Of course, the date will only show up if the clock is on; if you need to turn the clock on, use the ClockOn command or select 'TURN CLOCK ON' , displayed in place of the clock on the mode screen.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/setdate

The SetDate command

setDate(*year, month, day*)

**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)

This command sets the calculator's date to whatever is specified in the command. The year must fall in the range 1997 to 2132 for this command to work.

```
:setDate(2001, 10, 31)
: {2001, 11, 1}
```

The above example has set the calculator's date to October 31^{st}, 2001, and the date it was set at originally was November 1^{st}, 2001.

# Error Conditions

**40 - Domain error** happens when the year is outside of the range of 1997 to 2132, or the month is above or below 0 to 12, or the date is above or below 0 to 31.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:setdate

The setDtFmt( Command

Sets the date format of the clock on the TI-84+/SE.

setDtFmt(*value*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- s to skip to commands starting with S
- Scroll down to setDtFmt( and select it

TI-84+/SE

2 bytes

The setDtFmt( command sets the date format of the clock on the TI-84+/SE calculators when displaying the date on the mode screen. There are three different formats available, and you simply use the respective value (can be either a literal number or a variable) to display the desired one: 1 (M/D/Y), 2 (D/M/Y), or 3 (Y/M/D). For example, this would set the date format to Month/Day/Year:

`:setDtFmt(1`

In order for the date format to work, you need to set the date using either the setDate( command, or by going into the set clock menu (accessible by pressing ENTER on the 'SET CLOCK' message that is displayed at the bottom of the mode screen). Of course, the date will only show up if the clock is on; if you need to turn the clock on, use the ClockOn command, or scroll down to the 'TURN CLOCK ON' message that is displayed in place of the clock on the mode screen and press ENTER twice.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/setdtfmt

The setDtFmt() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:setdtfmt

The setGraph() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:setgraph

The setMode() Command

Changes one or more mode settings.

- setMode(
*setting*,*value*) - setMode({
*set1*,*val1*,…})

**Menu Location**

Starting in the program editor:

- Press F6 to enter the Mode menu.
- Select the desired setting to enter its submenu.
- Select the desired value to paste setMode("setting", "value")

This command works on all calculators.

3 bytes

The setMode() command is used, mainly by programmers, to change mode settings (outside a program, of course, you can just select the settings in the MODE menu). When a setting is changed, it returns the old value of the setting. There are two ways to use the command:

- setMode(
*setting*,*value*) will change*setting*to*value*, and return the old value of*setting*. - setMode({
*set1*,*val1*,…}) will change*set1*to*val1*,*set2*to*val2*, and so on, for any number of settings, and return a list in the same format of settings and their old values.

The first format is used to change only one setting, and the second to change several settings.

Both settings and values are identified by strings (not case-sensitive). All the strings involved are given in the Table of Mode Settings.

An example of setMode():

```
setMode("Angle","DEGREE")
"RADIAN"
setMode({"Angle","RADIAN","Split Screen","FULL"})
{"Split Screen" "FULL" "Angle" "DEGREE"}
```

# Advanced Uses

Unfortunately, the strings depend on language localization. For compatibility with other languages, there is an alternate identification for the settings and values: you can use a string containing a number identifying the setting or value (see the Table of Mode Settings). This is also shorter.

As an example, the numerical version of the sample code above would be:

```
setMode("3","2")
"1"
setMode({"3","1",8","1"})
{"8" "1" "3" "2"}
```

Use the output of the list version of setMode() to restore settings to what they were previously:

```
:setMode({"Angle","RADIAN"})→oldmode
...
:setMode(oldmode)
```

This works with the numerical or the verbose versions of the command; the output of the command will be in the same format as the input.

# 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 "Split 2 App" if "Split Screen" is "FULL").

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

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:setmode

The setTime( Command

Sets the time of the clock on the TI-84+/SE.

setTime(*hour*,*minute*,*second*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- s to skip to commands starting with S
- Scroll down to setTime( and select it

TI-84+/SE

2 bytes

The setTime( command sets the time of the clock on the TI-84+/SE calculators. It takes three arguments: the hour, the minute, and the second. The hour must be in 24 hour format — where 13 is equal to 1 P.M. — and the minute and second need to be a valid number within the appropriate range (1-60). For example, this would set the time to 12:30:30:

`:setTime(12,30,30`

Once you have set the time, you can display it in two different formats on the mode screen using the setTmFmt( command: 12 (12 hour) or 24 (24 hour). Of course, the time will only show up if the clock is on; if you need to turn the clock on, use the ClockOn command, or scroll down to the 'TURN CLOCK ON' message that is displayed in place of the clock on the mode screen and press ENTER twice.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/settime

The setTime() Command

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.

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:settime

The setTmFmt( Command

Sets the time format of the clock on the TI-84+/SE.

setTmFmt(*value*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- s to skip to commands starting with S
- Scroll down to setTmFmt( and select it

TI-84+/SE

2 bytes

The setTmFmt( command sets the time format of the clock on the TI-84+/SE calculators when displaying the time on the mode screen. There are two different formats available, and you simply use the respective value (can be either a literal number or a variable) to display the desired one: 12 (12 hour) or 24 (24 hour). For example, this would set the time format to 24 hour:

`:setTmFmt(24`

In order for the time format to work, you need to set the time using either the setTime( command, or by going into the set clock menu (accessible by pressing ENTER on the 'SET CLOCK' message that is displayed at the bottom of the mode screen). Of course, the time will only show up if the clock is on; if you need to turn the clock on, use the ClockOn command, or scroll down to the 'TURN CLOCK ON' message that is displayed in place of the clock on the mode screen and press ENTER twice.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/settmfmt

The SetUpEditor Command

Sets which lists are shown in the List Editor. As a side effect, unarchives the lists, and creates them if they don't exist.

By default, works with L1-L6.

SetUpEditor [*list*, *list*,…]

Press:

- STAT to enter the STAT menu.
- 5 to choose SetUpEditor, or use arrows.

TI-83/84/+/SE

2 bytes

The SetUpEditor command is meant as an auxiliary for the List Editor (which can be accessed by pressing STAT ENTER (Edit…)). The list editor provides a convenient interface for looking at the elements in lists, or editing those elements (especially when the elements of two lists are connected to each other, such as a list for X-coordinates and one for Y-coordinates, since they will be shown in the same row).

The SetUpEditor command sets which lists are shown in this list editor. By default, it selects the lists L1, L2, L3, L4, L5, and L6. To do this, just use the command with no arguments:

`:SetUpEditor`

However, you can use it to select any lists that you have defined, or even lists that you haven't defined yet. To do this, simply put the lists you want as arguments to the command. For example, if you want to edit the lists FOO and BAR, do:

`:SetUpEditor FOO,BAR`

The List Editor doesn't do anything when you are running a program, so it may seem as though SetUpEditor is nearly useless in programs. This is not the case, however, because of SetUpEditor's powerful side effect: if the lists it is given as arguments are archived, it will unarchive them. If they don't exist, it will create them with size 0.

# Advanced Uses

Due to this side effect, SetUpEditor can be used for lists with external data such as saved games or high scores. When the user first runs the program, the assumption is you don't know anything about the state of those lists: they may be archived, or they may not even exist. You can deal with both of those individually: storing to the dimension will create the list if it didn't exist, and the UnArchive command will move the list to RAM if it wasn't there.

However, if you're wrong about the list, both of these commands will cause an error. If the list exists but is archived, storing to its dimension will cause an ERR:ARCHIVE error. If the list doesn't exist, unarchiving it will cause an ERR:UNDEFINED error. Sounds like a vicious circle.

The SetUpEditor command allows you to deal with both of these problems at once. Say the program saves its data in LSAVE. Use the SetUpEditor command on it, and from then on you know that the list exists AND that it is unarchived.

`:SetUpEditor SAVE`

At the end of the program, you should clean up after yourself, though. You don't want the user to see the list SAVE in the editor (he might be tempted to edit it and give himself a huge high score, for one thing). So you should use the SetUpEditor command again, this time without arguments, to reset the editor to its default state.

For more information about using SetUpEditor in the context of saving data, see the page on saving.

# Similar Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/setupeditor

The Shade( Command

Graphs two functions and shades the area between them.

Shade(*lower func*, *upper func*, [*xmin*, *xmax*, *pattern #*, *resolution*])

Press:

- 2nd DRAW to access the draw menu.
- 7 to select Shade(, or use arrows.

TI-83/84/+/SE

1 byte

The Shade( command draws two functions and shades the area between them.

Shade(*lower func*, *upper func*, [*xmin*, *xmax*, *pattern #*, *resolution*])

*lowerfunc*and*upperfunc*are the two functions (whenever*lowerfunc*<*upperfunc*, the area between them will be shaded)*xmin*and*xmax*(optional) are left and right boundaries on where to shade.*pattern #*(optional) is an integer 1-4 determining which pattern to use:- 1 — vertical shading (default)
- 2 — horizontal shading
- 3 — diagonal shading (negative slope)
- 4 — diagonal shading (positive slope)

*resolution*(optional) is an integer 1-8 determining the spacing between shading lines. When it's 1 (default), everything is shaded, when it's 2, one pixel is skipped between lines, and so on - when it's 8, seven pixels are skipped.

Note that if you don't supply the *resolution* argument, it defaults to 1 and everything gets shaded regardless of the pattern.

# Advanced Uses

Shade(Ymin,Ymax) is the smallest (though not the fastest) way to shade the entire screen.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/shade

The ShadeF( Command

Finds the probability of an interval of the *F*-distribution, and graphs the distribution with the interval's area shaded.

ShadeF(*lower*, *upper*, *numerator df*, *denominator df*)

Press:

- 2ND DISTR to access the distribution menu
- RIGHT to select the DRAW submenu
- 4 to select ShadeF(, or use arrows

TI-83/84/+/SE

2 bytes

ShadeF( is equivalent to Fcdf( in terms of the probability it calculates: if a random variable follows the *F*-distribution, you can use it to calculate the probability that the variable's value falls in a certain interval. However, in addition to calculating the probability, this command also draws the distribution, and shades the interval whose area represents the probability you want.

Note that this command does not actually return the value it calculates in Ans or anywhere else: it's merely displayed on the graph. If you're going to use the value in further calculations, you'll have to use Fcdf( as well.

Like Fcdf(, ShadeF( takes four arguments: the lower bound, the upper bound, and the numerator and denominator degrees of freedom.

# Advanced

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound. For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use E99 to get a very large number that will work equally well in this case (E is the decimal exponent obtained by pressing [2nd] [EE]). Use E99 for positive infinity, and -E99 for negative infinity.

The ShadeF( command's output is affected by the graphing window, and on many windows you won't be able to get a good idea of what the graph looks like. The entire graph is in the first quadrant, so unless you want to see bits of the axes, Ymin and Xmin should be 0. Ymax should probably be around .5 - this would depend on the specific *F*-distribution of course, as would Xmax.

Keep in mind that ShadeF( is a drawing command and not the graph of an equation, so changing graph settings, the ClrDraw command, and a great deal of other things will erase its output.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/shadef

The ShadeNorm( Command

Finds the probability of an interval of the normal curve, and graphs the normal curve with the interval's area shaded.

ShadeNorm(*lower*, *upper*, [*μ*, *σ*])

Press:

- 2ND DISTR to access the distribution menu
- RIGHT to select the DRAW submenu
- ENTER to select ShadeNorm(

TI-83/84/+/SE

2 bytes

ShadeNorm( is equivalent to normalcdf( in terms of the probability it calculates: if a random variable follows the normal distribution, you can use it to calculate the probability that the variable's value falls in a certain interval. However, in addition to calculating the probability, this command also draws the normal curve, and shades the interval whose area represents the probability you want.

Note that this command does not actually return the value it calculates in Ans or anywhere else: it's merely displayed on the graph. If you're going to use the value in further calculations, you'll have to use normalcdf( as well.

There are two ways to use ShadeNorm(. With two arguments (lower bound and upper bound), the calculator will assume you mean the standard normal distribution, and use that to find the probability corresponding to the interval between "lower bound" and "upper bound". You can also supply two additional arguments to use the normal distribution with a specified mean and standard deviation. For example:

```
for the standard normal distribution
:ShadeNorm(-1,1
for the normal distribution with mean 10 and std. dev. 2.5
:ShadeNorm(5,15,10,2.5
```

# Advanced

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound. For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use E99 to get a very large number that will work equally well in this case (E is the decimal exponent obtained by pressing [2nd] [EE]). Use E99 for positive infinity, and -E99 for negative infinity.

It can be hard to find the best window for ShadeNorm( to work in, since it doesn't automatically zoom for you. For the standard curve, the graph doesn't go above y=.5 (a good value for Ymax); Ymin should probably be something small. Xmin and Xmax could be -3 to 3 (3 deviations out); change this around to see more or less of the graph.

For nonstandard curves, increasing the standard deviation stretches and flattens the curve; by dividing Ymax and multiplying Xmin and Xmax by the standard deviation, you'll account for this effect. To account for the mean, add it to both Xmin and Xmax. You may also choose to standardize the lower and upper values instead by applying the formula (z-μ)/σ.

Keep in mind that ShadeNorm is just a drawing command and not an actual graphed function, so resizing the window, ClrDraw, and a bunch of other things will simply get rid of it.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/shadenorm

The Shade_t( Command

Finds the probability of an interval of the Student's *t* distribution, and graphs the distribution with the interval's area shaded.

Shade_t(*lower*, *upper*, *df*)

Press:

- 2ND DISTR to access the distribution menu
- RIGHT to select the DRAW submenu
- 2 to select Shade_t(, or use arrows

TI-83/84/+/SE

2 bytes

Shade_t( is equivalent to tcdf( in terms of the probability it calculates: if a random variable follows the Student's *t* distribution, you can use it to calculate the probability that the variable's value falls in a certain interval. However, in addition to calculating the probability, this command also draws the distribution, and shades the interval whose area represents the probability you want.

Note that this command does not actually return the value it calculates in Ans or anywhere else: it's merely displayed on the graph. If you're going to use the value in further calculations, you'll have to use tcdf( as well.

Like tcdf(, Shade_t( takes three arguments: the lower bound, the upper bound, and the degrees of freedom.

# Advanced

The Shade_t( command's output is affected by the graphing window, and on many windows you won't be able to get a good idea of what the graph looks like. For best results, Ymin should be either 0 or a small negative number, and Ymax should be 0.5 or less. Xmin and Xmax should be opposites of each other (so the middle of the graph is 0), but how large they are depends on the degrees of freedom and on how much of the graph you want to see: -4 and 4 are good starting places.

Keep in mind that Shade_t( is a drawing command and not the graph of an equation, so changing graph settings, the ClrDraw command, and a great deal of other things will erase its output.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/shade-t

The Shadeχ²( Command

Finds the probability of an interval of the χ² distribution, and graphs this distribution with the interval's area shaded.

Shadeχ²(*lower*, *upper*, *df*)

Press:

- 2ND DISTR to access the distribution menu
- RIGHT to select the DRAW submenu
- 3 to select Shadeχ²(, or use arrows

TI-83/84/+/SE

2 bytes

`Shadeχ²(` is equivalent to `χ²cdf(` in terms of the probability it calculates: if a random variable follows the χ² distribution, you can use it to calculate the probability that the variable's value falls in a certain interval. However, in addition to calculating the probability, this command also draws the χ² curve, and shades the interval whose area represents the probability you want.

Note that this command does not actually return the value it calculates in Ans or anywhere else: it's merely displayed on the graph. If you're going to use the value in further calculations, you'll have to use `χ²cdf(` as well.

The `Shadeχ²(` command takes three arguments. *lower* and *upper* identify the interval you're interested in. *df* specifies the degrees of freedom (selecting from an infinite family of χ² distributions).

Thus, the following code would find the probability of χ² between 0 and 1 on a χ² distribution with 2 degrees of freedom, and shade this interval:

`:Shadeχ²(0,1,2`

# Advanced

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound. For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use `E99` to get a very large number that will work equally well in this case (`E` is the decimal exponent obtained by pressing [2nd] [EE]). Use `E99` for positive infinity, and `-E99` for negative infinity.

It can be hard to find the best window for `Shadeχ²(` to work in, since it doesn't automatically zoom for you. For any number of degrees of freedom (except for 1), the graph doesn't go above y=.5 (a good value for `Ymax`); `Ymin` should probably be something small and negative. `Xmin` should be around 0 (possibly slightly less if you like seeing axes), while `Xmax` probably shouldn't go above 5.

Keep in mind that `Shadeχ²(` is just a drawing command and not an actual graphed function, so resizing the window, `ClrDraw`, and other commands that refresh the graphscreen will remove it.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/shadechisquare

The shift() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:shift

The ShowStat Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:showstat

The Simul Command

Puts the calculator into simultaneous graphing mode.

Simul

While editing a program, press:

- MODE to access the mode menu.
- Use arrows and ENTER to select Simul.

TI-83/84/+/SE

2 bytes

Simul puts the calculator into simultaneous graphing mode. When multiple equations are enabled at the same time, simultaneous graphing mode graphs them at the same time (as opposed to Sequential mode, in which they will be graphed one after the other)

If you use a list in an equation, as with Y1={1,2,3}X, this will graph several equations that will always graph separately, regardless of this setting, which only affects multiple functions in different equation variables.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/simul

The sin( Command

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.

sin(θ) returns the sine of θ, which is defined as the y-value of the point of intersection of the unit circle and a line containing the origin that makes an angle θ with the positive x-axis

The value returned depends on whether the calculator is in Radian or Degree mode. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion from radians to degrees is angle*180/π and from degrees to radians is angle*π/180. The sin( command also works on a list of real numbers.

In radians:

```
sin(π/6)
.5
```

In degrees:

```
sin(30)
.5
```

# Advanced Uses

You can bypass the mode setting by using the ° (degree) and ^{r} (radian) symbols. These next two commands will return the same values no matter if your calculator is in degrees or radians:

```
sin(30°)
.5
```

```
sin(π/6^^r)
.5
```

# Error Conditions

**ERR:DATA TYPE**is thrown if you supply a matrix or a complex argument.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sin

The sin() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:sin

The sinֿ¹( Command

Returns the inverse sine (also called arcsine)

sinֿ¹(*number*)

Press:

- [2nd]
- [sinֿ¹]

TI-83/84/+/SE

1 byte

sinֿ¹( returns the arcsine of its argument. It is the inverse of sin(, which means that sinֿ¹(z) produces an angle θ such that sin(θ)=z.

Like sin(, the result of sinֿ¹( depends on whether the calculator is in Radian or Degree mode. However, unlike sine, the result is in degrees or radians, not the argument. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion of θ=sinֿ¹(n) from radians to degrees is θ*180/π and from degrees to radians is θ*π/180. The sinֿ¹( command also works on lists.

The sinֿ¹( function can be defined for all real and complex numbers; however, the function assumes real values only in the closed interval [-1,1]. Because the trigonometric functions and their inverses in the Z80 calculators are restricted only to real values, the calculator will throw ERR:DOMAIN if the argument is outside of this interval, no matter what the mode setting may be.

In radians:

```
:sinֿ¹(1)
1.570796327
```

In degrees:

```
:sinֿ¹(1)
90
```

# Advanced Uses

Since the function sine itself doesn't have the restrictions that arcsine does, and since arcsine is the inverse of sine, you can use sinֿ¹(sin( to keep a variable within a certain range (most useful on the graph screen). Here is an example for a game like pong. The ball travels between -6 and 6.

You could use a flag like this:

```
:If 6=abs(X \\ X is the position
:-D→D \\ D is the direction
:X+D→X \\ new position
:Pt-On(-54,X,"=")
```

An easier way to do this, without needing a flag or even an If statement, is using sinֿ¹(sin(

```
:X+1→X \\ Note: the calculator is in degree mode
:Pt-On(-54,sinֿ¹(sin(15X))/15,"=") \\ 15 is used because sinֿ¹ ranges from [-90,90]
and X from [-6,6], so 90/6=15
```

# Error Conditions

**ERR:DATA TYPE**is thrown if you input a complex value or a matrix.**ERR:DOMAIN**is thrown if you supplied an argument outside the interval [-1,1]

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/arcsin

The sinh( Command

Calculates the hyperbolic sine of a value.

sinh(*value*)

The sinh( command is only found in the Catalog. Press:

- 2nd CATALOG to access the command catalog.
- S to skip to commands starting with S.
- Scroll down and select sinh(.

TI-83/84/+/SE

1 byte

Calculates the hyperbolic sine of a value. The hyperbolic trig functions sinh(, cosh(, and tanh( are an analog of normal trig functions, but for a hyperbola, rather than a circle. They can be expressed in terms of real powers of e, and don't depend on the Degree or Radian mode setting.

```
sinh(0)
0
sinh(1)
1.175201194
```

Like normal trig commands, sinh( works on lists as well, but not on complex numbers, even though the function is often extended to the complex numbers in mathematics.

# Formulas

The definition of hyperbolic sine is:

(1)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sinh

The sinh() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:sinh

The sinhֿ¹( Command

Calculates the inverse hyperbolic sine of a value.

sinhֿ¹(*value*)

The sinhֿ¹( command is only found in the catalog. Press:

- 2nd CATALOG to access the command catalog.
- S to skip to commands starting with S.
- Scroll down and select sinhֿ¹(

TI-83/84/+/SE

1 byte

The sinhֿ¹( command calculates the inverse hyperbolic sine of a value. sinhֿ¹(x) is the number y such that x = sinh(y). Unlike for the standard trig functions, this uniquely determines the inverse hyperbolic sine of any real number.

The sinhֿ¹( command also works for lists.

```
sinhֿ¹(0)
0
sinhֿ¹({1,2,3})
{.881373587 1.443635475 1.818446459}
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/arsinh

The SinReg Command

Calculates the least-squares best fit sinusoidal curve through a set of points.

SinReg [*iterations*, *x-list*, *y-list*, *period*, *equation*]

Press:

- STAT to access the statistics menu
- LEFT to access the CALC submenu
- ALPHA C to select SinReg, or use arrows

TI-83/84/+/SE

1 byte

SinReg tries to fit a sine wave to a given list of points. To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the *i*th element of one list matches up with the *i*th element of the other list (i.e. the first element of the x-list and the first element of the y-list make up an ordered pair). L₁ and L₂ are the default lists used, and the List Editor (STAT > Edit…) is a useful window for entering the points.

SinReg requires that the lists contain at least 4 points. Also, if you do not provide two data points per cycle, the calculator may return a wrong answer. These conditions are an absolute minimum, and the command may fail to work even when they are met, and throw a ERR:SINGULAR MAT error. This is also likely to happen if the data are not actually periodic in nature.

In addition, to use SinReg in its simplest form, the x-coordinates must be sorted in increasing order, and the difference between consecutive x-coordinates must be the same throughout (i.e., *x*_{i+1}-*x*_{i} should be the same for all i). You can then call SinReg with no arguments, and it will attempt to fit a sine wave to the data in L₁ and L₂:

```
:{1,2,3,4,5,6,7,8,9,10,11,12→L₁
:{21,24,34,46,58,67,72,70,61,50,40,27→L₂
:SinReg
```

On the home screen, or as the last line of a program, this will display the equation of the curve: you'll be shown the format, *y*=*a**sin(*b**x*+*c*)+*d*, and the values of *a*, *b*, *c* and *d*. It will also be stored in the RegEQ variable, but you will not be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables *a*, *b*, *c*, and *d* will be set to the values computed as well. There are no correlation statistics available for SinReg even if Diagnostic Mode is turned on (see DiagnosticOn and DiagnosticOff).

A word of caution: the calculator assumes that Radian mode is enabled. If the calculator is set to Degree mode, the equation will still be in terms of radians: it will be correct, but values plugged in will give wrong answers. You will have to either switch to Radian mode, or multiply the values of *b* and *c* by 180/π.

You do not have to do the regression on L₁ and L₂, in which case you'll have to enter the names of the lists after the command. For example:

```
:{1,2,3,4,5,6,7,8,9,10,11,12→MONTH
:{21,24,34,46,58,67,72,70,61,50,40,27→TEMP
:SinReg ∟MONTH,∟TEMP
```

Unlike the other regression commands, SinReg does not allow you to use a frequency list for data. You can get around this by adding repeating coordinates multiple times.

The optional argument *iterations* should come before the data lists, and if provided will change the amount of time and effort the calculator spends on the problem. The value should be an integer 1 to 16; larger numbers mean greater precision, but a longer calculation time. The default value is 3, and for good reason: with a high precision value, the calculation may take a minute to complete, or longer, depending on the complexity of the problem.

The optional argument *period* should be given after the data lists - this is the length of a complete cycle in the data, if known. You might know the exact value of the period, for example, when the calculation involves time - a complete cycle could be a day, a month, or a year. Providing this argument is strongly recommended whenever it is available: this removes conditions on the x-coordinates' order and increment, and makes the calculation much faster and more accurate. If you have previously done a SinReg fit and desire a refined estimate, the value 2π*/b* can be given as the period.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the curve's equation is stored to this variable automatically. This does not require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the equation will be in terms of X anyway, this does not make much sense.

An example of SinReg with all the optional arguments:

```
:{1,2,3,4,5,6,7,8,9,10,11,12→MONTH
:{21,24,34,46,58,67,72,70,61,50,40,27→TEMP
:SinReg 16,∟MONTH,∟TEMP,12,Y₁
```

The Levenberg-Marquardt nonlinear least-squares algorithm is used by SinReg.

# Error Conditions

**ERR:SINGULAR MAT**is thrown if you don't provide the calculator at least 4 points, or two data points per cycle.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sinreg

The solve( Command

Attempts to return a real solution to the equation *expression*=0 for a specified single variable (other variables will be treated as constants), given a guess, and optionally bounds on the values of the variable.

solve(*expression*, *variable*, *guess*, [{*lower*, *upper*}])

While editing a program, press:

- MATH to go to the MATH menu.
- 0 to choose solve(, or use arrows.

(outside the program editor, the interactive Solver will appear instead; use the Catalog to access the function directly)

TI-83/84/+/SE

1 byte

The solve( command attempts to iteratively find a real root of a given equation, given the variable to solve for, and an initial guess; i.e., given *f*(*x*), solve( will attempt to find a value of *x* such that *f*(*x*)=0. solve( can take a list {*lower*,*upper*} as an optional fourth argument, in which case it attempts to find a root between *lower* and *upper* inclusive (by default, *lower* and *upper* are taken to be -E99 and E99 respectively). Brent's method is used for finding the root.

Unfortunately, the solve( command (as with most iterative methods) is not perfect at solving equations. solve( will in general be unable to find "multiple roots", or can only find it to an accuracy less than the usual (an example would be the root *x*=1 of the equation (*x*-1)^*n*=0 for *n* greater than 1). solve( will only return one of many possible roots to your equation if your equation has many roots to begin with. The root returned, in general, depends on the value of the guess given. The root returned is usually the root closest to the guess given for well-behaved equations; bad choices of the guess can cause solve( to either return a faraway root or not converge at all to a root.

If possible, the equation should first be solved by hand - if there is a relatively simple formula for the root, that will (usually) be more efficient than using solve(. Otherwise, ensure that the solve( call actually works in all the expected cases during use.

The Solver… utility (located in the same menu in the same place) is usually much easier and more intuitive to use, and is recommended instead of directly using solve( whenever applicable (e.g. the home screen). The same limitations apply to its efficiency. If you are unable to find roots using the Solver, try graphing the function and scanning for roots manually, then using 2:zero in the 2nd:CALC menu to refine your guess.

**Note**: Solver… changes the value of the variable being solved for to the root found; solve(, on the other hand, finds the root, but does not modify the original value of the variable.

# Advanced Uses

Reformulating an equation may be useful in certain instances. For example, the equations f(x)=0 and *e*^{f(x)}=1 are equivalent. solve((X+1)^{2},X,0 returns ERR:NO SIGN CHG, while solve(*e*^((X+1)^{2})-1,X,0 returns -1.000000616 (pretty close to the root -1). Rearranging the equation may sometimes help as well.

Specifying bounds usually helps solve( to find roots more efficiently. If bounds are readily available, they should be supplied to solve(.

The error condition Bad Guess will occur if you use a string for the equation. There is a way around though. If you store the string into a function and use the function in place of the equation it will work.

```
Str1 → Y1
solve(Y1,X,0
```

# Error Conditions

**ERR:BAD GUESS**will be thrown if guess wasn't within the lower and upper bound, or else the function is undefined at that point, or if a string is used for an equation.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/solve

The SortA( Command

Sorts a list in ascending order.

For more than one list, sorts the first, and reorders other lists accordingly.

SortA(*list1* [,*list2*, …])

Press:

- 2nd LIST to access the list menu.
- RIGHT to access the OPS submenu.
- ENTER to select SortA(.

TI-83/84/+/SE

1 byte

The SortA( command sorts a list in ascending order. It does not return it, but instead edits the original list variable (so it takes only list variables as arguments).

SortA( can also be passed multiple lists. In this case, it will sort the first list, and reorder the others so that elements which had the same indices initially will continue having the same indices. For example, suppose the X and Y coordinates of some points were stored in ∟X and ∟Y, so that the Nth point had coordinates ∟X(N) and ∟Y(N). Then SortA(∟X,∟Y) would sort the points by their x-coordinates, still preserving the same points.

However, SortA( is not stable: if several elements in the first list are equal, then the corresponding elements in the subsequent lists may still end up being in a different order than they were initially.

# Algorithm

The algorithm used by SortA( and SortD( appears to be a modified selection sort. It is still O(n^{2}) on all inputs, but for some reason takes twice as long on a list with all equal elements. It is not stable.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sorta

The SortD( Command

Sorts a list in descending order.

For more than one list, sorts the first, and reorders other lists accordingly.

SortD(*list1* [,*list2*, …])

Press:

- 2nd LIST to access the list menu.
- RIGHT to access the OPS submenu.
- 2 to select SortD(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The SortD( command sorts a list in descending order. It does not return it, but instead edits the original list variable (so it takes only list variables as arguments).

SortD( can also be passed multiple lists. In this case, it will sort the first list, and reorder the others so that elements which had the same indices initially will continue having the same indices. For example, suppose the X and Y coordinates of some points were stored in ∟X and ∟Y, so that the Nth point had coordinates ∟X(N) and ∟Y(N). Then SortD(∟X,∟Y) would sort the points by their x-coordinates, still preserving the same points.

However, SortD( is not stable: if several elements in the first list are equal, then the corresponding elements in the subsequent lists may still end up being in a different order than they were initially.

# Algorithm

The algorithm used by SortD( and SortA( appears to be a modified selection sort. It is still O(n^{2}) on all inputs, but for some reason takes twice as long on a list with all equal elements. It is not stable.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sortd

The startTmr Command

Returns the value of the clock timer on the TI-84+/SE.

startTmr→*Variable*

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- T to skip to command starting with T
- Scroll up to startTmr and select it

TI-84+/SE

2 bytes

The startTmr command is used with the built-in timer that is available on the TI-84+/SE calculators. It is used together with the checkTmr( command to determine how much time has elapsed since the timer was started. An application of these commands is timing different commands or pieces of code, as well as countdowns in games, or a time-based score (such as in Minesweeper).

To use the timer, you first store startTmr to a variable (usually, a real variable) whenever you want the count to start. Now, whenever you want to check the elapsed time, you can use checkTmr( with the variable from above, giving you the number of seconds that have passed. Using checkTmr( doesn't stop the timer, you can do it as many times as you want to.

In the case of Minesweeper, for example, you would store startTmr to, for example, T, after setting up and displaying the board, display the result of checkTmr(T) in the game's key-reading loop, and store checkTmr(T) to the player's score if he wins.

Despite the name of the command, startTmr doesn't start the clock if it's stopped; use ClockOn instead to start the clock.

# Advanced Uses

To time a command or routine using startTmr and checkTmr(, use the following template:

```
:ClockOn
:startTmr→T
:Repeat checkTmr(Ans
:End
:For(n,1,(number) //sequence variable n
(command(s) to be tested)
:End
:checkTmr(T+1)/(number)
```

Making (number) higher increases accuracy, but takes longer. Also, make sure not to modify the variables *n* or T inside the For( loop.

While this method eliminates human error from counting, it's prone to its own faults. For example, startTmr and checkTmr( always return the time rounded down to a whole second. To take this into account, replace the last line:

`:(checkTmr(T+{1,0})/(number)`

When testing code, be aware that many different things affect the time: the strength of the batteries, the amount of free RAM, and including the closing parenthesis on the For( loop. The last one, in particular, has an impact when using a single-line If statement or one of the IS>( and DS<( commands on the first line inside a For( loop.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/starttmr

The startTmr() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:starttmr

The stdDev( Command

Finds the sample standard deviation of a list.

stdDev(*list*,[*freqlist*])

Press:

- 2ND LIST to enter the LIST menu.
- LEFT to enter the MATH submenu.
- 7 to select stdDev(, or use arrows.

TI-83/84/+/SE

1 byte

The stdDev( command finds the sample standard deviation of a list, a measure of the spread of a distribution. It takes a list of real numbers as a parameter. For example:

```
:Prompt L1
:Disp "STD. DEV. OF L1",stdDev(L1
```

Caution: the standard deviation found by this command is the **sample** standard deviation, not the **population** standard deviation, which is the one most commonly used when dealing with a sample rather than the whole population. The formula for population standard deviation is similar, but N-1 is replaced by N. There is no single command that will calculate population standard deviation for you, but 1-Var Stats will return both (sample standard deviation, the one returned by stdDev(), is Sx, while population standard deviation is σx). You can also calculate population standard deviation of L1 with the following code:

`:stdDev(augment(L1,{mean(L1`

# Advanced Uses

Frequency lists don't need to be whole numbers. Amazing as that may sound, your calculator can handle being told that one element of the list occurs 1/3 of a time, and another occurs 22.7 times. It can even handle a frequency of 0 - it will just ignore that element, as though it weren't there. One caveat, though - if all of the elements occur 0 times, there's no elements actually in the list and your calculator will throw an error.

# Formulas

The formula for standard deviation used by this command is:

(1)This is the formula for sample standard deviation. The formula for population standard deviation, which this command does **not** use, varies slightly:

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/stddev

The Stop Command

Completely stops the current program and any parent programs.

Stop

While editing a program, press

- PRGM to enter the program menu
- ALPHA F to choose Stop, or use arrows

TI-83/84/+/SE

1 byte

When the Stop command is used in a program it exits the program (terminating the program execution) and returns you to the home screen. If it is encountered within loops, the loops will be stopped.

There is some distinction when using Stop with subprograms: the Stop command will stop the program execution of the subprogram, as well as the calling program, and return you to the home screen; the program will stop completely. If this functionality is not desired, then you should use the Return command instead.

# Optimization

You don't have to put a Stop command at the end of a program or subprogram if you can organize the program so that it just naturally quits. When the calculator reaches the end of a program, it will automatically stop executing as if it had encountered a Stop command (the Stop is implied).

```
:ClrHome
:Input "Guess:",A
:Stop
Remove the Stop
:ClrHome
:Input "Guess:",A
```

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/stop

The StoPic command

Stores a picture variable at *[PxlRow, PxlColumn]* with *[width, height]*

StoPic *picVar*,*[PxlRow, PxlColumn][,width, height]*

**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 store a picture that is on your calculator's graphscreen. This is useful for sprites in programs, where you can draw a sprite and save it to a picture that you can later redraw on a background. It is also useful for saving a copy of whatever you are drawing, so that it is not accidentally deleted if you graph something… The row and column arguments specify where on the graphscreen should be stored. Also the width and height arguments specify how tall or wide the stored area should be. The default for the row and column is (0,0), which is the top left corner of the graphscreen. The default width and height is the whole screen.

`:StoPic 2a, 2,7,10,10`

The above code would take a 10 x 10 square of the graphscreen with the top corner being at (2,7), ans it would store whatever is there to the picture variable "2a".

# Error Conditions

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

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:stopic

The StoreGDB Command

Stores graph setting to a GDB (Graph DataBase) to be recalled later with RecallGDB.

StoreGDB *GDB#*

StoreGDB *number*

Press:

- 2nd DRAW to access the draw menu.
- LEFT to access the STO menu.
- 3 to select StoreGDB, or use arrows and ENTER.

TI-83/84/+/SE/CSE/CE

1 byte

The StoreGDB command stores all graph settings needed to reconstruct the current graph to a GDB (Graph DataBase) variable, one of GDB1, GDB2, …, GDB0 (as indicated by the argument). These settings can then be recalled using the RecallGDB command.

The settings stored in a GDB include:

- The graphing mode currently enabled.
- All equations in the current graphing mode, but NOT other graphing modes.
- All window variables applicable to the current graphing mode. This does not include zoom variables, table settings, or irrelevant variables such as Tmin when in function mode.
- The menu settings relevant to graphing (everything in the 2nd FORMAT menu, as well as Connected/Dot and Sequential/Simul settings in the MODE menu)

The number passed to StoreGDB must be one of 0 through 9. It has to be a number: StoreGDB X will not work, even if X contains a value 0 through 9.

# Advanced Uses

The StoreGDB and RecallGDB variables are useful in cleaning up after a program finishes running, preserving the user's settings. If your program heavily relies on the graph screen, it may end up editing window size or other graph settings, which the user might want to be saved. This is easily done:

Add StoreGDB 1 (or any other number) to the beginning of your program.

Then, feel free to edit any graph settings you like.

At the end of your program, add RecallGDB 1, followed by DelVar GDB1, to recall the graph settings stored at the beginning.

GDBs can also be useful in adding extra string storage. You can store strings to the Yn variables, and back them up in a GDB; to retrieve them later, recall the GDB and use Equ►String( to store the equations to the strings again.

# Error Conditions

**ERR:DATA TYPE**is thrown if the argument is not a*number*0 through 9.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/storegdb

The StorePic Command

Stores the graph screen to a picture (one of Pic1, Pic2, …, Pic0)

StorePic *number*

Press:

- 2nd DRAW to access the draw menu.
- LEFT to access the STO submenu.
- ENTER to select StorePic

TI-83/84/+/SE

1 byte

`StorePic` saves the graph screen to a picture (to recall it later, use `RecallPic`). Every detail of the graph screen will be stored as it appears, with the sole exception of X and Y labels on the axes (if they are shown).

The number passed to `StorePic` must be one of 0 through 9. It has to be a number: `StorePic X` will not work, even if X contains a value 0 through 9.

# Advanced Uses

A combination of `StorePic` and `RecallPic` can be used to maintain a background over which another sprite moves:

First, draw the background, and save it to a picture file with `StorePic`.

Next, draw the sprite to the screen.

When you want to move the sprite, erase it, then use `RecallPic` to draw the background again.

Then draw the sprite to its new location on the screen again (this can be done before or after using `RecallPic`).

Also, if a screen in your program takes more than a second to draw, and is displayed several times, you might want to consider storing it to a picture the first time it's drawn, and then recalling it every next time you want to draw it.

# Error Conditions

**ERR:DATA TYPE**is thrown if the argument is not a**number**0 through 9.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/storepic

The string() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:string

The String►Equ( Command

Stores the contents of a string to an equation variable.

String►Equ(*string*, *equation*

This command is found only in the catalog. Press:

- 2nd CATALOG to access the catalog
- T to skip to commands starting with T
- Scroll up to String►Equ( and select it.

TI-83/84/+/SE

2 bytes

This command stores the contents of a string to an equation variable (such as Y_{1} or X_{1T}). This command can, in theory, be used whenever you need to set any equation variable.

In practice, however, this command is useless. This is because the → (store) operation can be used for the same purpose:

```
:String►Equ(Str1,Y1
can be
:Str1→Y1
```

This replacement is universal, takes the same time to run (because it actually uses the same routines), is more convenient to type since you don't have to go through the command catalog, and is two bytes smaller.

# Advanced

Unlike any normal use of the → (store) operation, this situation is different because it doesn't modify Ans. For example:

```
:125
:"sin(X→Y1
:Disp Ans
```

Because this use of → does not modify Ans, '125' will be displayed rather than 'sin(X'. However, if we were to replace Y1 with Str1, then the → operation would work normally, and 'sin(X' would be displayed.

It's also important to realize the difference between the String►Equ( command and the related Equ►String(, aside from the fact that the latter is actually useful. The main difference is that while Equ►String('s arguments both have to be **variables**, String►Equ('s first argument can either be a variable (Str0 through Str9), a constant string (e.g., "sin(X)"), or an expression that returns a string (e.g., sub(Str1,1,5)). This applies to the → operation as well.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/string-equ

The sub( Command

Returns a specific part of a given string, or divides by 100.

sub(*string*, *start*, *length*)

sub(*value*)

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- T to skip to command starting with T
- Scroll up to sub( and select it

TI-83/84/+/SE

2 bytes

The sub( command is used to get a substring, or a specific part of a string. It takes three arguments: *string* is the source string to get the substring from, *start* is the index of the token to start from, and *length* is the length of the substring you want. For example:

```
:sub("TI-BASIC",4,5
"BASIC"
:sub("TI-BASIC",5,2
"AS"
```

Keep in mind that you can't have an empty string, so the *length* argument can't be equal to 0.

When the *length* argument is 1, sub(*string*,N,1 returns the Nth token in the string.

# Advanced Uses

If only one argument is given, and it contains an expression that evaluates to a real or complex number or list of numbers, the sub( command will divide the result by 100.

```
:sub(225
2.25
:sub({3+5i,-4i►Frac
{3/100+1/20i,-1/25i}
```

Much like the use of the % symbol, this is an undocumented feature that was introduced in OS version 1.15. Thus, care should be taken when using sub( in this way, as older versions will not support it.

Together with the inString( command, sub( can be used to store a "list of strings" in a string, that you can then get each individual string from. To do this, think of a delimiter, such as a comma, to separate each individual string in the "list" (the delimiter must never occur in an individual string). The code will be simpler if the delimiter also occurs at the end of the string, as in "CAT,DOG,RAT,FISH,".

This routine will display each string in a "list of strings". You can adapt it to your own needs.

```
:1→I
:inString(Str1,",→J
:While Ans
:Disp sub(Str1,I,J-I
:J+1→I
:inString(Str1,",",Ans→J
:End
```

Alternatively, instead of using inString, you can start each individual string at the length of the longest string length, plus 1. If there are smaller strings that are not the same length, use spaces.

For example, if you wanted to display the suits for a card game, do the following:

```
:"SPADES--DIAMONDSHEARTS--CLUB----→Str1
:sub(Str1,1+8A,8
```

(Spaces have been replaced with dashes for visual clarity.)

Broken down, by manipulating A, different portions of the string can be displayed without the hassle of searching for characters. Setting A as 0 would display "SPADES—", but thanks to the spaces, the extra two characters would not be seen. A may be replaced with (A-1) if the 1st name would like to be displayed by setting A to 1.

This method is more preferable when using the Home Screen, as the spaces would wipe the last end characters of any previous strings displayed.

# Error Conditions

**ERR:ARCHIVED**is thrown if you try to take the substring of an archived string.**ERR:DOMAIN**is thrown if the starting and/or length value is less than 1, or if it is not an integer.**ERR:INVALID DIM**is thrown if the starting and/or length value is beyond the length of the string.**ERR:UNDEFINED**is thrown if you try to take the substring of a non-existent string.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sub

The sum( Command

Calculates the sum of all or part of a list.

sum(*list*[,*start*,[*end*]])

Press:

- 2nd LIST to access the list menu.
- LEFT to access the MATH submenu.
- 5 to select sum(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The sum( command calculates the sum of all or part of a list.

When you use it with only one argument, the list, it sums up all the elements of the list. You can also give it a bound of *start* and *end* and it will only sum up the elements starting and ending at those indices (inclusive).

```
sum({1,2,3,4,5})
15
sum({1,2,3,4,5},2,4)
9
sum({1,2,3,4,5},3)
12
```

# Optimization

If the value of *end* is the last element of the list, it can be omitted:

```
sum({1,2,3,4,5},3,5)
can be
sum({1,2,3,4,5},3)
```

# Error Conditions

**ERR:DOMAIN**is thrown if the starting or ending value aren't positive integers.**ERR:INVALID DIM**is thrown if the starting or ending value exceed the size of the list, or are in the wrong order.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sum

The T (Transpose) Command

**Command Summary**

This command calculates the transpose of a matrix.

**Command Syntax**

*matrix*^{T}

**Menu Location**

Press:

- MATRX (on the 83) or 2nd MATRX (83+ or higher) to access the Matrix menu.
- LEFT to access the MATH submenu
- 2 to select
^{T}, or use arrows

**Calculator Compatibility**

TI-83/84/+/SE

**Token Size**

The ^{T} command is used to calculate the transpose of a matrix: it flips a matrix along its main diagonal. This means that the (i,j)th element becomes the (j,i)th element, and vice versa. As a result, the transpose of an M by N matrix is an N by M matrix.

[[1,2,3][4,5,6]]

………… [[1 2 3]

…………. [4 5 6]]

Ans^{T}

………… [[1 4]

…………. [2 5]

…………. [3 6]]

# Advanced Uses

In addition to its many uses in linear algebra, the ^{T} operation is useful to programmers: with operations such as Matr►list( and augment(, which normally deal with columns, ^{T} allows you to use rows instead. See the "Related Commands" section for the commands that this is useful for.

# Related Commands

- augment(
- cumSum(
- Matr►list(
- rowSwap( (and other row operations)

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/transpose

The tan( Command

tan(θ) calculates the tangent of the angle θ, which is defined by $\tan \theta=\frac{\sin \theta}{\cos \theta}$

The value returned depends on whether the calculator is in Radian or Degree mode. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion from radians to degrees is angle*180/π and from degrees to radians is angle*π/180. The tan( command also works on a list of real numbers.

Since tangent is defined as the quotient of sine divided by cosine, it is undefined for any angle such that cos(θ)=0.

In radians:

```
tan(π/4)
1
```

In degrees:

```
tan(45)
1
```

# Advanced Uses

You can bypass the mode setting by using the ° (degree) and ^{r} (radian) symbols. These next two commands will return the same values no matter if your calculator is in degrees or radians:

```
tan(45°)
1
```

```
tan(π/4^^r)
1
```

# Error Conditions

**ERR:DATA TYPE**is thrown if you supply a matrix or a complex argument.**ERR:DOMAIN**is thrown if you supply an angle of π/2±nπ (in radians, where n is an integer) or 90±180n (in degrees, where n is an integer)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tan

The tan() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:tan

The tanֿ¹( Command

Returns the inverse tangent (also called arctangent)

tanֿ¹(*number*)

Press:

- [2nd]
- [tanֿ¹]

TI-83/84/+/SE

1 byte

tanֿ¹( returns the arctangent of its argument. It is the inverse of tan(, which means that tanֿ¹(n) produces an angle θ such that tan(θ)=n.

Like tan(, the result of tanֿ¹( depends on whether the calculator is in Radian or Degree mode. However, unlike tangent, the result is in degrees or radians, not the argument. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion of θ=tanֿ¹(n) from radians to degrees is θ*180/π and from degrees to radians is θ*π/180. The tanֿ¹( command also works on a list.

tanֿ¹( will always return a value between -π/2 and π/2 (or -90° and 90°).

In radians:

```
:tanֿ¹(1)
.7853981634
```

In degrees:

```
:tanֿ¹(1)
45
```

# Optimization

Expressions of the form tanֿ¹(*y**/x*) are usually better recast as R►Pθ(*x*,*y*); the latter will not fail even if *x* should happen to be equal to zero.

# Error Conditions

**ERR:DATA TYPE**is thrown if you input a complex value or a matrix.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/arctan

The Tangent( Command

Draws a line tangent to an expression at the specified value.

Tangent(*expression*,*value*)

Press:

- 2nd PRGM to access the draw menu.
- 5 to select Tangent(, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The Tangent( command draws a graph of an expression and then draws a line tangent to that expression, with the line touching the graph at the point of the specified value. You can either use a equation variable (such as Y_{1}) or an expression in terms of X (such as X²). Though you can use equation variables from any graphing mode, they will be treated as functions in terms of X. Tangent( also ignores the graphing mode currently selected.

Here is a simple example, where we are graphing the parabola X^{2} and then drawing a tangent line at the value X=2.

```
:"X²→Y₁
:Tangent(Y₁,2
```

or

`:Tangent(X²,2`

# Advanced Uses

Whether the graph shows up or not is dependent on the window dimensions of the graph screen, and you should use a friendly window to ensure it shows up as you intended.

Tangent( will update X and Y for each coordinate drawn (like DrawF and DrawInv), and exit with the last coordinate still stored.

When evaluating the expression using Tangent(, the calculator will ignore the following errors: ERR:DATA TYPE, ERR:DIVIDE BY 0, ERR:DOMAIN, ERR:INCREMENT, ERR:NONREAL ANS, ERR:OVERFLOW, and ERR:SINGULAR MAT. If one of these errors occurs, the data point will be omitted. However, the errors will still be thrown if they occur when evaluating the function *at* the point of tangency.

Using Ans as an optimization for storing to an equation will not work. For example, the following code returns ERR:DATA TYPE because Ans is a string, not an equation variable.

```
:"X²
:Tangent(Ans,2
```

Of course, you *can* use Ans in the equation, if it's a real number, but that's usually not as useful.

# Error Conditions

**ERR:INVALID**is thrown if you try to use an equation variable that is undefined.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tangent

The tanh( Command

Calculates the hyperbolic tangent of a value.

tanh(*value*)

The tanh( command is only found in the Catalog. Press:

- 2nd CATALOG to access the command catalog.
- T to skip to commands starting with T.
- Scroll down and select tanh(.

TI-83/84/+/SE

1 byte

Calculates the hyperbolic tangent of a value. The hyperbolic trig functions sinh(, cosh(, and tanh( are an analog of normal trig functions, but for a hyperbola, rather than a circle. They can be expressed in terms of real powers of e, and don't depend on the Degree or Radian mode setting.

```
tanh(0)
0
tanh(1)
.761594156
```

Like normal trig commands, tanh( works on lists as well, but not on complex numbers, even though the function is often extended to the complex numbers in mathematics.

# Advanced Uses

The tanh( command can be used to approximate the sign function:

(1)As the absolute value of the input becomes large, the convergence is achieved at a point closer to zero. For the function to work as intended generally, numbers having lesser orders of magnitude need to be multiplied by a factor large enough for the argument to arrive at ±16.720082053122, which is the smallest input to produce ±1 (respectively) to fourteen digits of accuracy.

```
5/12→X
.4166666667
tanh(E9X)
1
tanh(-E9X)
-1
```

# Formulas

The definition of the hyperbolic tangent is:

(2)# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tanh

The tanh() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:tanh

The tanhֿ¹( Command

Calculates the inverse hyperbolic tangent of a value.

tanhֿ¹(*value*)

The tanhֿ¹( command is only found in the catalog. Press:

- 2nd CATALOG to access the command catalog.
- T to skip to commands starting with T.
- Scroll down and select tanhֿ¹(

TI-83/84/+/SE

1 byte

The tanhֿ¹( command calculates the inverse hyperbolic tangent of a value. tanhֿ¹(x) is the number y such that x = tanh(y).

tanhֿ¹(x), although it can be defined for all real and complex numbers, is real-valued only for x in the open interval (-1,1). Since Z80 calculators have their hyperbolic functions and inverses restricted to real values, ERR:DOMAIN is thrown when x is outside the interval (-1,1).

The tanhֿ¹( command also works for lists.

```
tanhֿ¹(0)
0
tanhֿ¹({-.5,.5})
{-.5493061443 .5493061443}
```

# Error Conditions

**ERR:DOMAIN**when taking the inverse tanh of a number not between -1 and 1.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/artanh

The tcdf( Command

Calculates the Student's *t* probability betwen *lower* and *upper* for degrees of freedom ν.

tcdf(*lower*, *upper*, *ν*)

Press:

- 2ND DISTR to access the distribution menu
- 5 to select tcdf(, or use arrows.

Press 6 instead of 5 on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

tcdf( is the Student's *t* cumulative density function. If some random variable follows this distribution, you can use this command to find the probability that this variable will fall in the interval you supply.

Unlike normalcdf(, this command only works for the standardized distribution with mean 0 and standard deviation 1. To use it for non-standardized values you will have to standardize them by calculating (X-μ)/σ (where μ is the mean and σ the standard deviation). Do this for both *lower* and *upper*.

# Advanced

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound (the form frequently used in one-tailed tests). For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use E99 to get a very large number that will work equally well in this case (E is the decimal exponent obtained by pressing [2nd] [EE]). Use E99 for +∞, and -E99 for -∞.

Alternatively, you can exploit the identity

(1)(similarly for the interval from 0 to ∞)

and thus

(2)For the form used in two-tailed tests, the following identity may be useful:

(3)# Formulas

As with any other continuous distribution, tcdf( can be defined in terms of the probability density function, tpdf(:

(4)The function can also be expressed in terms of an incomplete beta function.

For one degree of freedom (ν=1), tcdf( is expressible in terms of simpler functions:

(5)This is the so-called Cauchy distribution.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tcdf

The Text Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:text

The Text( Command

Displays a number, a string, or several numbers and strings (you may mix and match) at (row, column) on the graph screen, using the small font.

The alternative syntax allows using the large font on the graph screen (TI-83+ and higher only)

Text(*row*, *column*, *value1* [,*value2*, …])

(83+ and higher only)

Text(*-1*, *row*, *column*, *value1* [,*value2*, …])

Press:

- 2ND PRGM to enter the DRAW menu
- 0 to choose Text(, or use arrows

TI-83/84/+/SE/CSE/CE

1 byte

The `Text(` command allows you to display text on the graph screen, using the small font. It takes three arguments: the row, which can range from 0 to the number of pixels tall the screen is (62 on grayscale, 165 on color) at which you want to display something, the column, which can range from 0 to the number of pixels wide the screen is (94 on grayscale, 264 on color), and whatever it is you want to display. Like the `Output(` command, it is limited to numbers and strings. If part of what you want to display goes off the screen, it will not be displayed - the calculator will cut you off at the most characters that will fit on the screen entirely.

Unlike the large text used on the home screen, the small font this command uses varies in width from 2 pixels to as many as 6 (counting the blank space at the end of each character, which is 1 pixel). All characters are 6 pixels tall, but the top row of pixels is used very rarely (only in international characters such as ä). On the TI-84+/SE/CSE/CE, the `Text(` command may also erase a single row of pixels underneath the text: whether this occurs or not depends on whether it was the menu screen or the table that was visited last, of the two.

Without storing them to a special string, the `Text(` command cannot be used to display quotation marks (") and the STO (→) command. However, you can mimic these respectively by using two apostrophes (' ' ), and two subtract signs and a greater than sign (—>).

Like many other drawing commands, if you're outside a program and on the graph screen, you can use this command directly, without going to the home screen. Just select Text( from the draw menu, and you will be able to type text at a cursor you control with arrow keys; press CLEAR or ENTER (among other things) to exit this mode.

# Advanced Uses

On the TI-83/84/+/SE/CSE/CE, `Text(` has an alternate syntax: put a -1 before the row and column to display the text using the large font instead of the small font. With this syntax, `Text(` becomes like an `Output(` for the graph screen, but with more features: you don't have to display text exactly aligned to one of the home screen's rows and columns, and you can display more than one string or number at a time. Also, text still won't wrap like `Output(`'s does.

This feature may be helpful in making programs more appealing, but remember that it does not work on the regular TI-83. If you want to maintain compatibility, don't use this syntax, or make an alternate version of your program without it.

The `Text(` command is also critical to the sprite technique known as text sprites. Although they have limitations, they allow pure Basic programs to have high-quality graphics without taking up lots of space. This effect is not as good on the color calculators.

On the TI-84+ and TI-84+ SE, another compatibility issue occurs with `Text(`. On certain occasions, using Text( to display small text on the graph screen will erase a 1-pixel margin below the text itself. The cause is a system option which is turned on when accessing the new MODE menu, and turned off when accessing the table, matrix editor, or list editor. The 1-pixel margin may not seem like a big deal, but it's enough to stop certain games (such as Bryan Thomas's Contra) from working on the TI-84+/SE.

The situation can be detected quite easily: turn on a pixel, display text 6 rows above it, and test if the pixel is still turned on. Fixing the situation is slightly more difficult:

- The hex code
`AsmPrgmFDCB058EC9`will disable the option (but it requires having an additional subprogram). `DispTable`will also do the trick, but of course it will display the table as well.- Switch the program to
`G-T`while it's on the graphscreen. Before doing this it's useful to have a`FnOff`.- The above two don't work in resetting the flag on OSes 2.53 MP or higher, the hex code is required.

- There's the option of telling users to access a certain screen before playing…

You can also try to get around the situation by storing and recalling pictures, to prevent anything from being erased when you don't want it to be.

# Error Conditions

**ERR:DOMAIN**is thrown if the coordinates of`Text(`are not integers or are out of range. A few comments:**ERR:DATA TYPE**can sometimes occur instead on the TI-83+ or higher because of confusion with the alternate syntax- Similarly,
`Text(-1,0,0)`will cause no error and display nothing whatsoever on the TI-83+ or higher. - With
`Text(-1,…`the upper bound on the row is one less of what it would be normally. - In
`Horiz`mode the upper bound on the row is 25 rather than 57. In`G-T`mode the upper bound on the column is 46.

**ERR:ARGUMENT**is thrown if the number of arguments given to`Text(`is 256 or more or if one of the arguments contains an imaginary part. The latter restriction can be bypassed with clever programming. One such method is displayed here:`<complex number>:Text(x,y,real(Ans),sub(“+-“,1+(imag(Ans)<0)),imag(Ans),”i`

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/text

The Time Command

Sets the way sequence equations are graphed to value vs. time.

Time

While in Seq mode, press:

- 2nd FORMAT to access the format menu.
- ENTER to select Time

TI-83/84/+/SE

2 bytes

NOTE: This article is about the Time setting for sequence graphing. If you're looking for the clock commands on the TI-84 Plus and TI-84 Plus SE, see Time and Date Commands.

The Time command sets equations in sequence mode to graph as the points (*n*, u(*n*)) (for the u equation; (*n*, v(*n*)) and (*n*, w(*n*)) for the other two) - the default setting. In dot mode, only the points themselves will be plotted, but if you change the graphing style to connected line or thick line, the points will be connected.

Essentially, this mode makes sequence graphs a limited version of function graphs, but with the possibility of recursion.

See "Related Commands" for other possibilities of graphing sequences.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/time

The timeCnv( Command

Converts seconds into the equivalent days, hours, minutes, and seconds.

timeCnv(*value*)→*variable*

This command can only be found in the catalog. Press:

- 2nd CATALOG to enter the command catalog
- t to skip to commands starting with T
- Scroll down to timeCnv( and select it

TI-84+/SE

2 bytes

The timeCnv( command converts seconds into the equivalent days, hours, minutes, and seconds. You just specify a number of seconds (should be a whole number, although a decimal number would work too; the calculator will simply use the integer part and discard the decimal) and the calculator will automatically break the seconds up into the standard parts of time, storing them in list format — {*days*,*hours*,*minutes*,*seconds*}. You can store this list to a variable for later use, or manipulate it the same way you do with other lists.

The number of seconds you specify can be as small or large as you want, although the number must be at least zero (in which case, the time list will be all zeroes). At the same time, you will run into the standard number precision problems that plague TI-Basic when specifying an extremely large or small number. Because of this, you should try to use numbers with less than 10 digits. Here is a simple example, where the time is exactly 1 day, 1 hour, 1 minute, and 1 second:

```
:timeCnv(90061→L1
:Disp Ans
```

The time conversion is 60 seconds for a minute, 3600 (60*60) seconds for an hour, and 86400 (60*60*60) seconds for a day. Adding these three together plus the one second gives you the value that you see in the example. This is pretty basic math, so it should be easy to understand.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/timecnv

The TimeCnv command

Converts seconds into a list containing days, hours, minutes, and seconds.

dayOfWk(*seconds*)

**Menu Location**

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

This command converts a number of seconds into a list containing {days, hours, minutes, seconds}.

```
:timeCnv(152442117)
: {1764 9 1 57}
```

The above example has converted 152,442,117 seconds into 1764 days, 9 hours, 1 minute, and 57 seconds.

# Advanced Uses

This command can be used to easily convert the output of the startTmr() or the checkTmr() commands to a more readable and understandable format.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:timecnv

The TInterval Command

Using either already-calculated statistics, or a data set, computes a *t* confidence interval.

TInterval [*list*, [*frequency*]], [*confidence level*]

(data list input)

TInterval *mean*, *std. deviation*, *sample size*, [*confidence level*]

(summary stats input)

When editing a program, press:

- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- 8 to select TInterval, or use arrows

(this key sequence will give you the TInterval… screen outside a program)

TI-83/84/+/SE

2 bytes

The TInterval command calculates a confidence interval for the mean value of a population, at a specific confidence level: for example, if the confidence level is 95%, you are 95% certain that the mean lies within the interval you get. Use TInterval when you have a single variable to analyze, and **don't** know the standard deviation. The TInterval assumes that your distribution is normal, but it will work for other distributions if the sample size is large enough.

There are two ways to call the TInterval command: by supplying it with needed sample statistics (mean, sample standard deviation, and sample size), or by entering a list and letting the calculator work the statistics out.

# Sample Problem

You want to know the average height of a student at your school. You haven't asked everyone, but you took a random sample of 30 people and found out their heights (and stored it to L_{1}). You've decided to use a 95% confidence interval.

Since the syntax for entering a data list is TInterval *list*, *confidence level*, here is your code:

```
:TInterval L1,95
you can also use
:TInterval L1,.95
```

Alternatively, you could calculate the mean, sample size, and standard deviation, and enter those instead. The sample size in this case is 30; let's say the mean was 63 inches and the standard deviation 6.2 inches.

The syntax for entering statistics is TInterval *mean*, *std. deviation*, *sample size*, *confidence level*, so your code would look like:

```
:TInterval 63,6.2,30,95
you can also use
:TInterval 63,6.2,30,.95
```

Of course, the main use of the TInterval command is in a program. While you can enter the TInterval command on the home screen as well (just look in the catalog for it), it would probably be easier to select TInterval… from the STAT>TEST menu (see the sidebar).

# Advanced Uses

As with most other statistical commands, you can enter a second list after the data list, to add frequencies (only with the data list syntax, of course). The frequency list must contain non-negative integers, and can't be all 0.

# Optimization

Using the data list syntax, all the arguments are optional: the calculator will assume you want to use L_{1} for your data unless another list is supplied, and that the confidence level you want is 95% unless you give another one. Using the summary stats syntax, the confidence level is also optional - again, the calculator will assume 95%. This means we can rewrite our code above in a simpler manner:

```
:TInterval L1,95
can be just
:TInterval
```

```
:TInterval 63,6.2,30,95
can be
:TInterval 63,6.2,30
```

# Error Conditions

**ERR:DATA TYPE**occurs if complex numbers are used (in some cases,**ERR:ARGUMENT**is thrown instead).**ERR:DIM MISMATCH**occurs if the data and frequency lists aren't the same size.**ERR:DOMAIN**occurs in any of the following cases:- The confidence level isn't in the range (0 .. 100).
- The standard deviation isn't positive.
- The sample size isn't an integer greater than 1.

**ERR:STAT**occurs if the frequency list's elements aren't integers.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tinterval

The Title Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:title

The ToolBar Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:toolbar

The tpdf( Command

Evaluates the Student's *t* probability density function with degrees of freedom ν.

tpdf(*t*, *ν*)

Press:

- 2ND DISTR to access the distribution menu
- 4 to select tpdf(, or use arrows.

Press 5 instead of 4 on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

tpdf( is the Student's *t* probability density function.

Since the *t* distribution is continuous, the value of tpdf( doesn't represent an actual probability — in fact, one of the few uses for this command is to draw a graph of the bell curve. You could also use it for various calculus purposes, such as finding inflection points.

The command takes two arguments: the first is the value where the PDF is to be evaluated, and the second is the number of degrees of freedom (so the calculator knows which *t* distribution to use). As the degrees of freedom increases without bound, tpdf( approaches normalpdf(; i.e.

# Formulas

The value of tpdf( is given by

(2)(where Γ is the gamma function), or alternatively

(3)(where B is the beta function)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tpdf

The Trace Command

Displays the graph screen and allows the user to trace the currently-graphed equations and plots.

Trace

While editing a program, press the TRACE key.

TI-83/84/+/SE

1 byte

The Trace command displays the graph screen, and allows the user to trace any graphed equations or plots. It works in almost exactly the same way as pressing TRACE does outside a program. When the user presses ENTER, control returns to the program.

When tracing, ExprOn and ExprOff affect how the currently-traced equation is displayed, and CoordOn and CoordOff affect whether the coordinates of the cursor are displayed (RectGC and PolarGC determine the type of coordinates).

Since the ENTER key is already used for exiting, the Trace command lacks some of the functionality of pressing TRACE outside a program, where you can use ENTER to center the graphing window on the cursor. The independent variables X, T, θ, and *n* cannot by directly typed in, either - they can only be selected with the arrow buttons.

# Advanced Uses

As a side effect, the coordinates of the last point traced are stored to X and Y (as well as R and θ, if you're in PolarGC mode, and T, θ and *n* depending on the graphing mode). Also, the window bounds may change if the user traces an equation past the edge of the screen.

# Error Conditions

**ERR:INVALID**is thrown if this command is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/trace

The Try Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:try

The T-Test Command

Performs a Student's *t* significance test.

T-Test *μ _{0}*, //frequency//, //alternative//, //draw?//

(data list input)

T-Test *μ _{0}*,

*sample mean*,

*sample std. dev.*,

*sample size*, //draw?//

(summary stats input)

While editing a program, press:

- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- 2 to select T-Test, or use arrows

(outside the program editor, this will select the T-Test… interactive solver)

TI-83/84/+/SE

2 bytes

T-Test performs a *t* significance test of a null hypothesis you supply. This test is valid for simple random samples from a population with an unknown standard deviation. In addition, either the population must be normally distributed, or the sample size has to be sufficiently large.

The logic behind a T-Test is as follows: we want to test the hypothesis that the true mean of a population is a certain value (*μ _{0}*). To do this, we assume that this "null hypothesis" is true, and calculate the probability that the variation from this mean occurred, under this assumption. If this probability is sufficiently low (usually, 5% is the cutoff point), we conclude that since it's so unlikely that the data could have occurred under the null hypothesis, the null hypothesis must be false, and therefore the true mean

*μ*is not equal to

*μ*. If, on the other hand, the probability is not too low, we conclude that the data may well have occurred under the null hypothesis, and therefore there's no reason to reject it.

_{0}In addition to the null hypothesis, we must have an alternative hypothesis as well - usually this is simply that the true mean is **not** *μ _{0}*. However, in certain cases when we have reason to suspect the true mean is less than or greater than

*μ*, we might use a "one-sided" alternative hypothesis, which will state that the true mean

_{0}*μ*<

*μ*or that

_{0}*μ*>

*μ*.

_{0}As for the T-Test command itself, there are two ways of calling it: you may give it a list of all the sample data, or the necessary statistics about the list - its size, the mean, and the standard deviation. In either case, you can indicate what the alternate hypothesis is, by a value of 0, -1, or 1 for the *alternative* argument. 0 indicates a two-sided hypothesis of *μ*≠*μ _{0}*, -1 indicates

*μ*<

*μ*, and 1 indicates

_{0}*μ*>

*μ*. (in fact, any negative argument will be treated as -1, and any positive argument as 1)

_{0}Although you can access the T-Test command on the home screen, via the catalog, there's no need: the T-Test… interactive solver, found in the statistics menu, is much more intuitive to use - you don't have to memorize the syntax.

In either case, it's important to understand the output of T-Test. Here are the meanings of each line:

- The first line, involving μ, is the alternative hypothesis.
- t is the test statistic, the standardized difference between the sample mean and
*μ*. If the null hypothesis is true, it should be close to 0._{0} - p is the probability that the difference between the sample mean and
*μ*would occur if the null hypothesis is true. When the value is sufficiently small, we reject the null hypothesis and conclude that the alternative hypothesis is true. You should have a cutoff value ready, such as 5% or 1%. If p is lower, you "reject the null hypothesis on a 5% (or 1%) level" in technical terms._{0} - x-bar is the sample mean.
- Sx is the sample standard deviation.
- n is the sample size (not included, but also important, is df, the degrees of freedom, defined as n-1)

# Sample Problem

According to M&M's advertising, each standard-size bag of M&M's contains an average of 10 blue M&M's. You think that this estimate is low, and that the true average is higher. You decide to test this hypothesis by buying thirty bags of M&M's. You count the number of blue M&M's in each, and store this number to L1.

The value of *μ _{0}* is 10, because you want to test the null hypothesis that there are on average 10 blue M&M's per bag. We want to test the values in L1. Because we want to test if there's actually more than 10 blue M&M's per bag, we have a one-sided alternate hypothesis:

*μ*>

*μ*, which corresponds to an argument of 1. To solve the problem, you'd use this code:

_{0}`:T-Test 10,L1,1`

Alternatively, you could calculate the mean, standard deviation, and size of your sample, and put those into the command instead. The sample size is 30; let's suppose that the mean was 11.2 and the standard deviation 1.3. The code you'd use is:

`:T-Test 10,11.2,1.3,30,1`

You will see the following output:

```
T-Test
μ>10
z=5.055900531
p=1.0857768e-5
x=11.2
Sx=1.3
n=30
```

The most important part of this output is "p=1.0857768e-5". This value of p is much smaller than 1% or 0.01; it's in fact around 0.00001. This is significant on the 1% level, so we reject the null hypothesis and conclude that the alternative hypothesis is true: μ>10, that is, the average number of blue M&M's in a bag is more than 10.

# Advanced Uses

The final argument of T-Test, *draw?*, will display the results in a graphical manner if you put in "1" for it. The calculator will draw the Student's *t* distribution with the correct degrees of freedom, and shade the area of the graph beyond the t statistic. In addition, the value of t and the value of p will be displayed (the value of p corresponds to the shaded area). You would make your conclusions in the same way as for the regular output.

As with most other statistical commands, you may use a frequency list in your input (when using the data list syntax).

# Optimization

Most of the arguments of the T-Test command have default values, and the argument can be omitted if this value is accepted.

- The
*draw?*argument can be omitted if you don't want graphical output, although you could put "0" in as well. - If the
*draw?*argument is omitted, you can omit the*alternative*argument to use a two-sided test (*μ*≠*μ*). If you include the_{0}*draw?*argument, you have to include this - otherwise there will be confusion as to what the 5th argument means. - With data list input, you can always omit the frequency list if you won't be using it.
- With data list input, if the
*draw?*and*alternative*arguments are omitted, and your data is in L1, you may omit L1 as well. However, if*alternative*or*draw?*is present, you have to include it, or else the syntax may be confused with the syntax for summary stats input.

The code in the sample problem above can't be optimized, because the *alternative* argument is 1:

`::T-Test 10,L1,1`

However, if we were doing a two-sided test, we could omit the *alternative* and the *list* arguments (since we're testing L1):

```
:T-Test 10,L1,0
can be
:T-Test 10
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/t-test

The tvm_Pmt, tvm_I%, tvm_PV, tvm_N, and tvm_FV Commands

Solves for the specified finance variable.

tvm_Pmt(**N**,I%,PV,FV,P/Y,C/Y)

tvm_I%(**N**,PV,PMT,FV,P/Y,C/Y)

tvm_PV(**N**,I%,PMT,FV,P/Y,C/Y)

tvm_**N**(I%,PV,PMT,FV,P/Y,C/Y)

tvm_FV(**N**,I%,PV,PMT,P/Y,C/Y)

All arguments are optional.

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- 2 through 6 to select tvm_Pmt through tvm_FV respectively.

On the TI-83+ and higher, press:

- APPS to access the applications menu.
- 1 or ENTER to select Finance…
- 2 through 6 to select tvm_Pmt through tvm_FV respectively.

TI-83/84/+/SE

2 bytes

The tvm_*VAR* commands use the TVM (Time Value of Money) solver to solve for the variable *VAR*. They're usually used in programs, since outside a program it's easier to use the interactive solver (the first option in the finance menu).

All five commands can be used by themselves, with no arguments. In that case, they will return the value of *VAR* solved from the current values of the other finance variables.

If you give them arguments, the values you give will replace the values of the finance variables. You can supply as many or as few arguments as needed, and the finance variables will be replaced in the order: **N**, I%, PV, PMT, FV, P/Y, C/Y (skipping the one you're solving for).

# Error Conditions

**ERR:ITERATIONS**is thrown if the maximum amount of iterations was exceeded in computing I% (this usually means there is no solution)**ERR:NO SIGN CHG**is thrown if calculating I% when FV, (N*PMT), and PV all have the same sign.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/tvm

The UnArchive Command

Moves a variable from the archive to RAM.

UnArchive *variable*

Press:

- 2nd MEM to access the memory menu
- 6 to select UnArchive, or use arrows.

TI-83+/84+/SE

(not available on the regular TI-83)

2 bytes

The UnArchive command moves a variable from the archive (also known as ROM) to RAM. A quick synopsis of the difference between the two:

- Data in the archive cannot be accessed, but it's protected from RAM clears (which may occur during battery removal if not done carefully); also, the archive can hold much more data.
- Data in RAM can be accessed for calculations, but it can also be deleted during a RAM clear or accidentally overwritten by another program.

It is, in general, not recommended to place real variables in the archive (since so many programs use them); also, some variables cannot be archived (see the Archive command for details). Although programs can be archived and unarchived, the Archive and UnArchive commands will not archive or unarchive programs from within a program. For the most part, lists are the only type of variable it makes sense to archive and unarchive in a program.

The UnArchive command doesn't do anything if the variable in question is already in RAM. However, there is no way to test if a variable is in RAM or archive, short of trying to access it and potentially getting an error.

# Advanced Uses

The Archive and UnArchive commands can be used in conjunction for saving data as a program exits.

# Optimization

The SetUpEditor command is often used in place of the UnArchive command when dealing with lists, for several reasons:

- using SetUpEditor will not prevent the program from working on a TI-83, like UnArchive will
- SetUpEditor will create a list with length 0 if it doesn't exist; UnArchive will throw an error
- SetUpEditor saves space in the program, since it can unarchive more than one list at a time, and doesn't require the little L in front

# Error Conditions

**ERR:MEMORY**is thrown if there isn't enough memory available in RAM for the variable.**ERR:VARIABLE**is thrown when unarchiving a system variable or a application even if there is enough space.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/unarchive

The uvAxes Command

Sets the u and v sequence equations to be graphed against each other.

uvAxes

When Seq mode is enabled, press:

- 2nd FORMAT to access the format menu.
- Use arrows to select uvAxes.

TI-83/84/+/SE

2 bytes

When uvAxes is enabled, and the calculator is in Seq mode, the equations u and v will be graphed against each other (that is, the points (u(*n*),v(*n*)) are graphed for the values of *n* between *n*Min and *n*Max). With this setting, sequence mode graphs are a bit like parametric mode, except the parameter *n* is always an integer, and recursive definitions are possible.

The equation w is ignored when in uvAxes mode.

See "Related Commands" for other possibilities of graphing sequences.

# Error Conditions

**ERR:INVALID**is thrown if either u or v is undefined.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/uvaxes

The uwAxes Command

Sets the u and w sequence equations to be graphed against each other.

uwAxes

When Seq mode is enabled, press:

- 2nd FORMAT to access the format menu.
- Use arrows to select uwAxes.

TI-83/84/+/SE

2 bytes

When uwAxes is enabled, and the calculator is in Seq mode, the equations u and w will be graphed against each other (that is, the points (u(*n*),w(*n*)) are graphed for the values of *n* between *n*Min and *n*Max). With this setting, sequence mode graphs are a bit like parametric mode, except the parameter *n* is always an integer, and recursive definitions are possible.

The equation v is ignored when in uwAxes mode.

See "Related Commands" for other possibilities of graphing sequences.

# Error Conditions

**ERR:INVALID**is thrown if either u or w is undefined.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/uwaxes

The variance( Command

Finds the sample variance of a list.

variance(*list*,[*freqlist*])

Press:

- 2ND LIST to enter the LIST menu.
- LEFT to enter the MATH submenu.
- 8 to select variance(, or use arrows.

TI-83/84/+/SE

1 byte

The variance( command finds the sample variance of a list, a measure of the spread of a distribution. It takes a list of real numbers as a parameter. For example:

```
:Prompt L1
:Disp "VARIANCE OF L1",variance(L1
```

# Advanced Uses

Frequency lists don't need to be whole numbers. Amazing as that may sound, your calculator can handle being told that one element of the list occurs 1/3 of a time, and another occurs 22.7 times. It can even handle a frequency of 0 - it will just ignore that element, as though it weren't there. One caveat, though - if all of the elements occur 0 times, there's no elements actually in the list and your calculator will throw an error.

# Formulas

The formula for variance used by this command is:

(1)This is the formula for sample variance. The formula for population variance, which this command does **not** use, varies slightly:

If the population variance is required, just multiply the result of variance() by 1-1/N.

With frequencies *w _{i}*, the formula becomes

where $\definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} \overline{x}$ is the mean with frequencies included.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/variance

The Vertical Command

Draws a vertical line on the graph screen.

Vertical *X*

In the program editor:

- 2nd DRAW to enter the draw menu.
- 4 to insert the Vertical command, or use arrows and ENTER.

TI-83/84/+/SE/C/CSE

1 byte

Vertical *X* draws a vertical line from the top of the graph screen to the bottom at *X*. Vertical is usually only used to replace a line that stretches the entire length of the graph screen, along with its counterpart Horizontal.

Vertical is affected by the window settings, unlike the Pxl- commands.

`:Vertical 5`

# Uses on TI 84+C Version Calculators

The Vertical command takes an additional color argument for TI 84+C version calculators, as shown below:

`Vertical 5,BLACK`

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/vertical

The vwAxes Command

Sets the v and w sequence equations to be graphed against each other.

vwAxes

When Seq mode is enabled, press:

- 2nd FORMAT to access the format menu.
- Use arrows to select vwAxes.

TI-83/84/+/SE

2 bytes

When vwAxes is enabled, and the calculator is in Seq mode, the equations v and w will be graphed against each other (that is, the points (v(*n*),w(*n*)) are graphed for the values of *n* between *n*Min and *n*Max). With this setting, sequence mode graphs are a bit like parametric mode, except the parameter *n* is always an integer, and recursive definitions are possible.

The equation u is ignored when in vwAxes mode.

See "Related Commands" for other possibilities of graphing sequences.

# Error Conditions

**ERR:INVALID**is thrown if either v or w is undefined.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/vwaxes

The Web Command

Sets sequence equations to be graphed as web diagrams.

Web

While in Seq mode, press:

- 2nd FORMAT to access the format menu.
- Use arrows and ENTER to select Web.

TI-83/84/+/SE

2 bytes

In Web mode, sequence equations are graphed as web diagrams. This is a way of visualizing iterations of a function (that is, the sequence n, f(n), f(f(n)), f(f(f(n))), … for some function f and starting value n). For this mode to properly work, each sequence equation should be in terms of its previous value only: u(*n*) should be a function of u(*n*-1). Referencing other sequence equations, or u(*n*-2), will yield ERR:INVALID; referencing the value *n* is allowed by the calculator, but makes the result meaningless so you should avoid it.

When you go to the graph screen, the associated function y=f(x) will be graphed. That is, if you define u(*n*) = cos(u(*n*-1)), the function y=cos(x) will be graphed. If you have AxesOn enabled, the line y=x will also be graphed. It's easy to see that the intersection points of the graphs y=f(x) and the line y=x represent the fixed points (points such that f(x)=x) of the function.

The web diagram itself will be drawn if you press TRACE or use the Trace command. First you will choose the equation (u, v, or w) to trace; then, by pressing RIGHT repeatedly, the web will be drawn, starting from the initial value *n*Min. In a web diagram, a point (n, f(n)) on the graph of y=f(x) is connected by a horizontal segment to the point (f(n), f(n)) on the graph of y=x, and then by a vertical segment to the point (f(n), f(f(n))) on the graph of y=f(x) again; this process is repeated. Each pair of a horizontal and vertical segment represents an added iteration of.

Web diagrams can be used to look at the attracting behavior of fixed points. For example:

1. Graph the equation u(*n*)=cos(u(*n*-1)), u(*n*Min)=1 in Web mode, with Xmin=0, Xmax=1, Ymin=0, Ymax=1 in the WINDOW menu. You'll see that it has a single fixed point. If you TRACE the graph, the line segments will spiral around into the fixed point, so appears to be attractive.

2. Graph the equation u(*n*)=π/2cos(u(*n*-1)), u(*n*Min)=1 in Web mode, with Xmin=0, Xmax=π/2, Ymin=0, Ymax=π/2 in the WINDOW menu. This equation looks a lot like the previous one, and also has a single fixed point. However, if you TRACE the graph, the line segments (which start out quite close to the fixed point) will spiral away from it. This intuitively shows that the fixed point of f(x)=π/2cos(x) is not attractive.

See "Related Commands" for other possibilities of graphing sequences.

# Error Conditions

**ERR:INVALID**is thrown if an equation being graphed references other sequence equations or the*n*-2 term.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/web

The when() Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:when

The While Command

Loops through a block of code while the condition is true.

While *condition*

*statement(s)*

End

While editing a program press:

- PRGM to enter the PRGM menu
- 5 to choose While, or use arrows
- 7 to choose End, or use arrows

TI-83/84/+/SE

1 byte

A While loop executes a block of commands between the While and End commands as long as the specified condition is true. The condition is tested at the beginning of the loop (when the End command is encountered), so if the condition is initially false, the block of commands will never get executed. This distinguishes it from the Repeat command.

After each time the While loop is executed, the condition is checked to see if it is still true. If it is, the block of commands is executed again, otherwise the program resumes after the End statement.

# Advanced Uses

When using While loops, you have to provide the code to break out of the loop (it isn't built into the loop). If there is no code that ends the loop, then you will have an infinite loop. An infinite loop just keeps executing, until you have to manually exit the loop (by pressing the ON key). In the case that you actually want an infinite loop, you can just use 1 as the condition. Because 1 is always true (based on Boolean logic), the way the calculator sees it, the condition will always be true, and the loop will never end.

```
:While 1
:statement(s)
:End
```

Each time the program enters an While block, the calculator uses 35+(size of the condition) bytes of memory to keep track of this. This memory is given back to you as soon as the program reaches End. This isn't really a problem unless you're low on RAM, or have a lot of nested While statements. However, if you use Goto to jump out of a While block, you lose those bytes for as long as the program is running — and if you keep doing this, you might easily run out of memory, resulting in ERR:MEMORY.

# Optimization

Because the While and Repeat commands are so similar, either one can be used in the same situation, but using one usually results in simpler code than the other. To decide which to use, answer some simple questions about the purpose of the code.

- Should the code inside the loop be executed at least once? (Alternatively, does the condition use some variable that we first use inside the loop?) If it should, use a Repeat loop. Otherwise, use a While loop.
- (Only if the previous question doesn't help) Think of the condition based on which the loop keeps going. Is this condition best phrased as "run the loop as long as this is true?" If so, use a While loop. Or is it more like "run the loop until this is true?" If so, Repeat is best.

Example: we want the user to pick a number, but it has to be positive, so we'll keep asking until it is.

- Yes, we should run the loop once. Otherwise, where will we get the number from? So, we should use the Repeat loop.

```
:Repeat N>0
:Prompt N
:End
```

Another example: we want to wait for the user to press a key.

- We're not going to have any code in the loop, all that the loop will have is a condition. So the answer to question 1 is irrelevant.
- We can phrase the problem as "run the loop until a key is pressed" or as "run the loop while no key is pressed." However, we have a good way of testing for the former (getKey), while the latter can only be checked with not(getKey). Therefore, it's better to use a Repeat command:

```
:Repeat getKey
:End
```

# Command Timings

While and Repeat loops are identical regarding speed, so that shouldn't be a factor in deciding between them. However, For( loops are much faster at what they do, that is, at going through consecutive values for one variable. You should consider if a For( loop is more appropriate to your situation. If not, choose between a Repeat loop and a While loop.

# Error Conditions

**ERR:INVALID**occurs if this statement is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/while

The While Command

Repeats a block of code as long as a condition is met

:While *condition*

*(block of code)*

:EndWhile

**Menu Location**

Starting in the program editor:

- Press F2 to enter the Control menu.
- Press 5 to paste While..EndWhile.

This command works on all calculators.

2 bytes for While;

4 bytes for EndWhile.

A While..EndWhile block is used to repeat a block of code as long as some true-or-false condition is met. This condition is checked before entering the loop (if it's false to begin with, the loop is skipped), and checked again every time the loop ends. For example:

```
:1→x
:While x<5
: x+1→x
: Disp x
:EndWhile
1
2
3
4
```

The condition is

*not*checked anywhere in the middle of the loop. If the condition becomes temporarily false, but then becomes true again before the end, the loop keeps going.

What kind of conditions are possible? Any command that returns a logical value — true or false — is acceptable. This includes the results of:

- Relational operators: =, ≠, >, ≥, <, and ≤
- Logical operators: and, or, xor, not
- Any advanced test command: pxlTest(), isPrime(), and others.
- A variable that contains one of the values true or false, or a function that returns them.

Of course, these can also be combined: for example, isPrime(x) and x≠2 is a valid condition.

One common use of a While loop is to wait for a key to be pressed:

```
:0→key
:While key=0
: getKey()→key
:EndWhile
```

# Optimization

In most programming languages a loop that always keeps repeating would be created using a While loop with a condition that's always true. You can do this in TI-Basic too, but it's simpler to use Loop..EndLoop which does the same thing.

```
:While true
: © do something
:EndWhile
can be
:Loop
: © do something
:EndLoop
```

# Error Conditions

**20 - A test did not resolve to TRUE or FALSE** happens when the condition is indeterminate, or the wrong data type.

**730 - Missing start or end of block syntax** happens when a While is missing an EndWhile, or vice versa.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:while

The xor Command

Returns the truth value of *value1* or *value2*, but not both, being true.

*value1* xor *value2*

Press:

- 2nd TEST to access the test menu.
- RIGHT to access the LOGIC submenu.
- 3 to select xor, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The third and final binary operator is a little trickier, but it has the coolest name. **xor** takes two numbers of expressions and checks to see if *exactly one* is True. If both are True or both are False, it returns 0.

```
1 xor 0
1
:2 xor (3 xor 0) (after evaluating 3 xor 0, it simplifies into True xor True.)
0
:0 xor (1-1)^2
0
```

## Table of Results

For reference, the following true/false table shows what gets returned when you use different combinations of 1 (true) and 0 (false):

xor | 1 (true) | 0 (false) |
---|---|---|

1 (true) | 0 (false) | 1 (true) |

0 (false) | 1 (true) | 0 (false) |

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/xor

The xor Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:xor

The xorPic command

Logically "xors" 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.

This command logically takes the picture variable specified, and takes the current graph, and it finds the points at which only the graph or only the picture have pixels, but turns off the points at which both 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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:xorpic

The ZBox Command

Zooms in to a smaller graphing window defined by a box drawn by the user.

ZBox

Press:

- ZOOM to access the zoom menu.
- ENTER to select ZBox.

TI-83/84/+/SE

1 byte

The ZBox command allows the user to select a smaller window within the current graphing window to zoom in to. To select the window, use the arrow keys and ENTER to select one corner of the window; then as you use the arrow keys and ENTER to select the other corner, a rectangle of the window's dimensions will be shown.

It's not recommended to use this in most programs, because entering an empty window (with no width or no height) will cause an error and exit the program without letting it clean up.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.**ERR:ZOOM**is thrown if an empty window is selected (with no width or no height)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zbox

The ZDecimal Command

Zooms to a friendly window where all pixels have simple coordinates.

ZDecimal

Press:

- ZOOM to access the zoom menu.
- 4 to select ZDecimal, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The `ZDecimal` command makes the following changes to the window variables:

- Xmin=-4.7
- Xmax=4.7
- Xscl=1
- Ymin=-3.1
- Ymax=3.1
- Yscl=1

If using a TI-84+CSE or CE, the window variables become:

- Xmin=-6.6
- Xmax=6.6
- Xscl=1
- Ymin=-4.1
- Ymax=4.1
- Yscl=1

Because of the dimensions of the graph screen, this has the useful effect that every pixel has round X- and Y-coordinates with at most one decimal digit. Also, the screen has correct proportions: a specific distance in the X direction is the same number of pixels in length as the same distance in the Y direction. This makes the window dimensions created by `ZDecimal` a friendly window (the `ZInteger` and `ZSquare` commands also have this effect, but in slightly different ways)

# Advanced Uses

Using the `ZDecimal` command prevents gaps in certain graphs, and makes sure vertical asymptotes with integer coordinates are graphed correctly. Also, circles will be drawn as actual circles with this graphing window(unlike other windows, with which they might appear stretched).

The values given for `Xmin`, `Xmax`, etc. above are only correct for the `Full` mode setting (which is the default, and the most common setting). In `Horiz` and `G-T` modes, the values will be different, preserving the property that two pixels next to each other differ in coordinates by 0.1:

- Ymin= -1.5 and Ymax= 1.5 in
`Horiz`mode (Xmin and Xmax are the same) - Ymin= -2.5 and Ymax= 2.5 in
`G-T`mode, while Xmin= -2.3 and Xmax= 2.3

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zdecimal

The ZFracX Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zfrac

The ZInteger Command

Zooms to a square window with all-integer coordinates.

ZInteger

Press:

- ZOOM to access the zoom menu.
- 8 to select ZInteger, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

When ZInteger is chosen as a menu option outside a program, it asks for a point on the graph screen. This point's coordinates are rounded to the nearest integer point. Then the window variables are changed so the window is centered at this point, and so that the coordinates of every pixel are integers. ΔX and ΔY, the distances between two pixels next to each other, are both 1.

The above process modifies Xmin, Xmax, Ymin, and Ymax. Xscl and Yscl are also modified: both are set to 10. No other variables are modified (unless you count ΔX and ΔY, which are affected as they are defined).

The ZInteger command (usable in a program only) has a slightly different effect: instead of allowing you to choose a point, it automatically uses the point that is the current center.

# Advanced Uses

A graph window commonly used in programming can be created by using the ZStandard and ZInteger commands:

```
:ZStandard
:ZInteger
```

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zinteger

The ZInterval Command

Using either already-calculated statistics, or a data set, computes a Z confidence interval.

ZInterval *std. deviation*, [*list*, [*frequency*]] [,*confidence level*]

(data list input)

ZInterval *std. deviation*, *mean*, *sample size*, [*confidence level*]

(summary stats input)

When editing a program, press:

- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- 7 to select ZInterval, or use arrows

(this key sequence will give you the ZInterval… screen outside a program)

TI-83/84/+/SE

2 bytes

The ZInterval command calculates a confidence interval for the mean value of a population, at a specific confidence level: for example, if the confidence level is 95%, you are 95% certain that the mean lies within the interval you get. Use ZInterval when you have a single variable to analyze, and you already know the standard deviation. The ZInterval assumes that your distribution is normal, but it will work for other distributions if the sample size is large enough.

There are two ways to call the ZInterval command: by supplying it with needed sample statistics (mean and sample size), or by entering a list and letting the calculator work the statistics out. In either case, you will need to enter the standard deviation and desired confidence level as well.

# Sample Problem

You want to know the average height of a student at your school. You haven't asked everyone, but you took a random sample of 30 people and found out their height (and stored it to L_{1}). You've read in your textbook that the standard deviation of teenagers' heights is usually 6 inches. You've decided to use a 95% confidence interval.

Since the syntax for entering a data list is ZInterval *std. deviation*, *list*, *confidence level*, the code would look like:

```
:ZInterval 6,L1,95
you can also use
:ZInterval 6,L1,.95
```

Alternatively, you could calculate the mean and sample size and enter those instead. The sample size in this case is 30; let's say the mean was 63 inches. The syntax for entering statistics is ZInterval *std. deviation*, *mean*, *sample size*, *confidence level*, so your code would look like:

```
:ZInterval 6,63,30,95
you can also use
:ZInterval 6,63,30,.95
```

Of course, the main use of the ZInterval command is in a program. While you can enter the ZInterval command on the home screen as well (just look in the catalog for it), it would probably be easier to select ZInterval… from the STAT>TEST menu (see the sidebar).

# Advanced Uses

As with most other statistical commands, you can enter a second list after the data list, to add frequencies (only with the data list syntax, of course). The frequency list must contain non-negative real numbers, and can't be all 0.

# Optimization

Using the data list syntax, all items but the standard deviation are optional: the calculator will assume you want to use L1 for your data unless another list is supplied, and that the confidence level you want is 95% unless you give another one. Using the summary stats syntax, the confidence level is also optional - again, the calculator will assume 95%. This means we can rewrite our code above in a simpler manner:

```
:ZInterval 6,L1,95
can be
:ZInterval 6
```

```
:ZInterval 6,63,30,95
can be
:ZInterval 6,63,30
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zinterval

The Zoom In Command

Zooms to a smaller graphing window with the same centre.

Zoom In

Press:

- ZOOM to access the zoom menu.
- 2 to select Zoom In, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

Outside a program, the Zoom In tool allows you to pick a point on the graph screen and change the graphing window to a smaller one centered at that point. The Zoom In command, used in a program, also changes the graphing window to a smaller one, but doesn't let you pick a point — it uses the center of the screen.

The variables XFact and YFact are used to determine how much the graphing window changes: the total width of the screen, Xmax-Xmin, is divided by XFact, and the total height, Ymax-Ymin, is divided by YFact. Because you can't store a value less than 1 to either of these variables, the screen is guaranteed to get no larger.

Aside from Xmin, Xmax, Ymin, and Ymax, no window variables are modified by this command (although ΔX and ΔY change as they are defined).

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.**ERR:WINDOW RANGE**is thrown if the window is zoomed in beyond the level of the calculator's precision.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoom-in

The Zoom Out Command

Zooms to a larger graphing window with the same center.

Zoom Out

Press:

- ZOOM to access the zoom menu.
- 3 to select Zoom Out, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

Outside a program, the Zoom Out tool allows you to pick a point on the graph screen and change the graphing window to a larger one centered at that point. The Zoom Out command, used in a program, also changes the graphing window to a larger one, but doesn't let you pick a point — it uses the center of the screen.

The variables XFact and YFact are used to determine how much the graphing window changes: the total width of the screen, Xmax-Xmin, is multiplied by XFact, and the total height, Ymax-Ymin, is multiplied by YFact. Because you can't store a value less than 1 to either of these variables, the screen is guaranteed to get no smaller.

Aside from Xmin, Xmax, Ymin, and Ymax, no window variables are modified by this command (although ΔX and ΔY change as they are defined).

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.**ERR:ZOOM**is thrown if an overflow occurs calculating the new window dimensions (the window is too big)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoom-out

The ZoomFit Command

Zooms to a graphing window that works for the currently graphed equations.

ZoomFit

Press:

- ZOOM to access the zoom menu.
- 0 to select ZoomFit, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The ZoomFit zooms to the smallest window that contains all points of the currently graphed equations. In Func mode, this means that it calculates the minimum and maximum Y-value for the current Xmin to Xmax range, and sets Ymin and Ymax to those values (Xmin and Xmax remain unchanged). In other graphing modes, this process is done for both X and Y over the range of T, θ, or *n*.

# Optimization

When graphing an equation with ZoomFit, the calculator will first calculate all points to find the minimum and maximum, then calculate all the points again to graph it. This can be time consuming if the equation is very complicated, and in that case doing part of the process manually might be faster if you reuse the points.

# Error Conditions

**ERR:INVALID**is thrown if this command is using outside a program (although the menu option, of course, is fine).**ERR:WINDOW RANGE**is thrown when the window ends up being empty (if the function is constant, for example)

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoomfit

The ZoomRcl Command

Recalls window settings previously saved with ZoomSto.

ZoomRcl

Press:

- ZOOM to access the zoom menu.
- RIGHT to access the MEMORY submenu.
- 3 to select ZoomRcl, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The ZoomRcl command restores a backup of the window settings previously saved by ZoomSto — this backup is stored in special variables found in the VARS>Zoom… menu, which are distinguished by a Z in front of their name. For example, Xmin is restored from ZXmin, PlotStart is restored from ZPlotStart, etc.

Only those settings are restored that apply to the current graphing mode (that is, those that you can see in the window screen). And if no backup had been made, then the default settings are restored to (see ZStandard).

One source of confusion with this command can be the fact that ZoomSto and ZoomRcl only deal with the current graphing mode (and don't touch settings from other graphing modes), but some window variables are shared by graphing modes. So some saved zoom variables only applicable to one mode, such as ZTmin, can be from older saves than those applicable to all modes, such as ZXmin.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program (but not if the menu option is used, of course).

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoomrcl

The ZoomStat Command

Zooms to a graphing window which works for all currently selected plots.

ZoomStat

Press:

- ZOOM to access the zoom menu.
- 9 to select ZoomStat, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The ZoomStat command command zooms to a graphing window that accurately represents all the currently defined stat plots (see the PlotN( commands). You can think of it as ZoomFit, but for plots rather than equations.

The specific function of the command is as follows: first, the minimum and maximum X and Y coordinates that stat plots will be using are calculated. Xmin, Xmax, Ymin, and Ymax are calculated to fit all these coordinates plus a padding on either side. The padding is 10% of the unpadded range on the left and right (for Xmin and Xmax), and 17% of the unpadded range on the top and bottom (for Ymin and Ymax).

Of course, the exact function varies slightly with the type of plot defined. For example, Ymin and Ymax will not be affected by Boxplot and Modboxplot plots, since they ignore Y-coordinates when graphing. Also, Histogram fitting is a bit trickier than others. Xscl and Yscl also are changed for histograms, though not for the other plots.

For all plots except Histogram, ZoomStat will create a window with Xmin=Xmax (or Ymin=Ymax) if the X range (or Y range) of the data is 0. This will throw an ERR:WINDOW RANGE. If a Histogram causes this error, though, ERR:STAT is thrown, and *then* when you access the graphscreen ERR:WINDOW RANGE will occur.

# Error Conditions

**ERR:INVALID**is thrown if this command is using outside a program (although the menu option, of course, is fine).**ERR:STAT**is thrown when trying to ZoomFit to a Histogram with only one distinct number in the data list.**ERR:WINDOW RANGE**is thrown when the window ends up being empty.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoomstat

The ZoomStd Command

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

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/68k:zoomstd

The ZoomSto Command

Saves the current window settings.

ZoomSto

Press:

- ZOOM to access the zoom menu.
- RIGHT to access the MEMORY submenu.
- 2 to select ZoomSto, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The ZoomSto command backs up all window settings applicable to the current graphing mode (those that are shown in the WINDOW menu) to backup variables used specifically for this command. These backup variables are found in the VARS>Zoom… menu, and are distinguished by a Z in front of their name. For example, Xmin is backed up to ZXmin, PlotStart is backed up to ZPlotStart, etc.

Using ZoomRcl, these backup variables can be used to overwrite the current window settings, recalling the saved window.

One source of confusion with this command can be the fact that ZoomSto and ZoomRcl only deal with the current graphing mode (and don't touch settings from other graphing modes), but some window variables are shared by graphing modes. So some saved zoom variables only applicable to one mode, such as ZTmin, can be from older saves than those applicable to all modes, such as ZXmin.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program (but not if the menu option is used, of course).

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zoomsto

The ZPrevious Command

Restores the basic window settings as they were before the last zoom command.

ZPrevious

Press:

- ZOOM to access the zoom menu.
- RIGHT to access the MEMORY submenu.
- ENTER or 1 to select ZPrevious.

TI-83/84/+/SE

1 byte

The ZPrevious command (and menu option) restore the window variables Xmin, Xmax, Xscl, Ymin, Ymax, and Yscl to the values they had before the last zoom command. This means, of course, that using ZPrevious a second time will cancel its effects.

Since no variables that are specific to the current graphing mode are changed, ZPrevious doesn't always achieve the effect of reversing the previous zoom command. For example, in Polar graphing mode, ZStandard will set θmin and θmax to 0 and 2π respectively. However, even if they were different before ZStandard, ZPrevious will not restore these settings. Also, ZPrevious doesn't notice if you change the window settings directly (by storing to the window variables).

Unlike ZoomSto and ZoomRcl, the values that ZPrevious uses aren't made available in any sort of variable.

# Optimization

Using StoreGDB and RecallGDB is an excellent way to back up graph settings so a program doesn't modify them. However, if all you're doing is changing the window variables with one Zoom command, you can simply use ZPrevious at the end of the program instead.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program (but not if the menu option is used, of course).

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zprevious

The ZSquare Command

Zooms to a square window.

ZSquare

Press:

- ZOOM to access the zoom menu.
- 5 to select ZSquare, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The ZSquare command changes the window variables Xmin and Xmax, or Ymin and Ymax, so that ΔX=ΔY, preserving all other settings and the coordinate of the center of the screen. This ensures that a numerical distance on the graphscreen has the same physical length on the calculator display, no matter if it's vertical, horizontal, or diagonal. Probably the most obvious effect of this change is that circles (whether graphed with an equation or drawn with the Circle( command) are actually circles and not ovals.

When determining which of Xmin and Xmax or Ymin and Ymax to change, the command picks the ones that would be increased, and not decreased. This way, the window can never get smaller.

Note that ZDecimal, ZInteger, and to an extent ZTrig already have the same proportions, and don't require a ZSquare command to follow them.

# Advanced Uses

ZSquare can be useful in setting up a friendly window.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zsquare

The ZStandard Command

Restores window settings to the default.

ZStandard

Press:

- ZOOM to access the zoom menu.
- 6 to select ZStandard, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The ZStandard command resets all window variables found in the Window screen to their default values. This means that, unlike the other zoom commands, ZStandard can affect variables other than Xmin, Xmax, Ymin, and Ymax. However, it will only affect variables that have a purpose in the current graphing mode. Here are the default values set by ZStandard:

In all modes:

- Xmin=-10
- Xmax=10
- Xscl=1
- Ymin=-10
- Ymax=10
- Yscl=1

Only in Func mode:

- Xres=1

Only in Param mode:

- Tmin=0
- Tmax=2π (in Radian mode) or 360 (in Degree mode)
- Tstep=π/24 (in Radian mode) or 7.5 (in Degree mode)

Only in Polar mode:

- θmin=0
- θmax=2π (in Radian mode) or 360 (in Degree mode)
- θstep=π/24 (in Radian mode) or 7.5 (in Degree mode)

Only in Seq mode:

*n*Min=1*n*Max=10- PlotStart=1
- PlotStep=1

These settings are often useful as a "lowest common denominator" that will work fairly well for all graphs.

# Advanced Uses

ZStandard is often used before commands such as ZSquare or ZInteger in programs. This serves two purposes: it makes sure that the center of the screen for ZSquare and ZInteger is (0,0), and it ensures that the graph screen is cleared without having to resort to ClrDraw (because with two different zooms in a row, the window settings have to change at least once, which means the graph will have to be regraphed)

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/zstandard

The Z-Test( Command

Performs a *z* significance test.

Z-Test(*μ _{0}*,

*σ*, //frequency//, //alternative//, //draw?//

(data list input)

Z-Test(*μ _{0}*,

*σ*,

*sample mean*,

*sample size*, //draw?//

(summary stats input)

While editing a program, press:

- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- ENTER to select Z-Test(

(outside the program editor, this will select the Z-Test… interactive solver)

TI-83/84/+/SE

2 bytes

Z-Test( performs a *z* significance test of a null hypothesis you supply. This test is valid for simple random samples from a population with a known standard deviation. In addition, either the population must be normally distributed, or the sample size has to be sufficiently large.

The logic behind a Z-Test is as follows: we want to test the hypothesis that the true mean of a population is a certain value (*μ _{0}*). To do this, we assume that this "null hypothesis" is true, and calculate the probability that the variation from this mean occurred, under this assumption. If this probability is sufficiently low (usually, 5% is the cutoff point), we conclude that since it's so unlikely that the data could have occurred under the null hypothesis, the null hypothesis must be false, and therefore the true mean

*μ*is not equal to

*μ*. If, on the other hand, the probability is not too low, we conclude that the data may well have occurred under the null hypothesis, and therefore there's no reason to reject it.

_{0}In addition to the null hypothesis, we must have an alternative hypothesis as well - usually this is simply that the true mean is **not** *μ _{0}*. However, in certain cases when we have reason to suspect the true mean is less than or greater than

*μ*, we might use a "one-sided" alternative hypothesis, which will state that the true mean

_{0}*μ*<

*μ*or that

_{0}*μ*>

*μ*.

_{0}As for the Z-Test( command itself, there are two ways of calling it: you may give it a list of all the sample data, or the necessary statistics about the list - its size, and the mean. In either case, you can indicate what the alternate hypothesis is, by a value of 0, -1, or 1 for the *alternative* argument. 0 indicates a two-sided hypothesis of *μ*≠*μ _{0}*, -1 indicates

*μ*<

*μ*, and 1 indicates

_{0}*μ*>

*μ*.

_{0}Although you can access the Z-Test( command on the home screen, via the catalog, there's no need: the Z-Test… interactive solver, found in the statistics menu, is much more intuitive to use - you don't have to memorize the syntax.

In either case, it's important to understand the output of Z-Test. Here are the meanings of each line:

- The first line, involving μ, is the alternative hypothesis.
- z is the test statistic, the standardized difference between the sample mean and
*μ*. If the null hypothesis is true, it should be close to 0._{0} - p is the probability that the difference between the sample mean and
*μ*would occur if the null hypothesis is true. When the value is sufficiently small, we reject the null hypothesis and conclude that the alternative hypothesis is true. You should have a cutoff value ready, such as 5% or 1%. If p is lower, you "reject the null hypothesis on a 5% (or 1%) level" in technical terms._{0} - x-bar is the sample mean.
- Sx is the sample standard deviation. This isn't actually used in any calculations, and will only be shown for data list input.
- n is the sample size.

# Sample Problem

According to M&M's advertising, each standard-size bag of M&M's contains an average of 10 blue M&M's with a standard deviation of 2 M&M's. You think that this estimate is low, and that the true average is higher. You decide to test this hypothesis by buying thirty bags of M&M's. You count the number of blue M&M's in each, and store this number to L1.

The value of *μ _{0}* is 10, because you want to test the null hypothesis that there are on average 10 blue M&M's per bag. The value of

*σ*is 2. We want to test the values in L1. Because we want to test if there's actually more than 10 blue M&M's per bag, we have a one-sided alternate hypothesis:

*μ*>

*μ*, which corresponds to an argument of 1. To solve the problem, you'd use this code:

_{0}`:Z-Test(10,2,L1,1`

Alternatively, you could calculate the mean and sample size of your sample, and put those into the command instead. The sample size is 30; let's suppose that the mean was 11.2. The code you'd use is:

`:Z-Test(10,2,11.2,30,1`

You will see the following output:

```
Z-Test
μ>10
z=3.286335345
p=5.0755973e-4
x=11.2
n=30
```

The most important part of this output is "p=5.0755973e-4". This value of p is much smaller than 1% or 0.01; it's in fact around 0.0005. This is significant on the 1% level, so we reject the null hypothesis and conclude that the alternative hypothesis is true: μ>10, that is, the average number of blue M&M's in a bag is more than 10.

# Advanced Uses

The final argument of Z-Test(, *draw?*, will display the results in a graphical manner if you put in "1" for it. The calculator will draw the **standard** normal curve, and shade the area of the graph beyound the z statistic. In addition, the value of z and the value of p will be displayed (the value of p corresponds to the shaded area). You would make your conclusions in the same way as for the regular output.

As with most other statistical commands, you may use a frequency list in your input (when using the data list syntax).

# Optimization

Most of the arguments of the Z-Test( command have default values, and the argument can be omitted if this value is accepted.

- The
*draw?*argument can be omitted if you don't want graphical output, although you could put "0" in as well. - If the
*draw?*argument is omitted, you can omit the*alternative*argument to use a two-sided test (*μ*≠*μ*). If you include the_{0}*draw?*argument, you have to include this - otherwise there will be confusion as to what the 5th argument means. - With data list input, you can always omit the frequency list if you won't be using it.
- With data list input, if the
*draw?*and*alternative*arguments are omitted, and your data is in L1, you may omit L1 as well. However, if*alternative*or*draw?*is present, you have to include it, or else the syntax may be confused with the syntax for summary stats input.

The code in the sample problem above can't be optimized, because the *alternative* argument is 1:

`::Z-Test(10,2,L1,1`

However, if we were doing a two-sided test, we could omit the *alternative* and the *list* arguments (since we're testing L1):

```
:Z-Test(10,2,L1,0
can be
:Z-Test(10,2
```

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/z-test

The ZTrig Command

Zooms to a trigonometry-friendly window.

ZTrig

Press:

- ZOOM to access the zoom menu.
- 7 to select ZTrig, or use arrows and ENTER.

TI-83/84/+/SE

1 byte

The `ZTrig` command sets the screen to a special friendly window useful for trigonometric calculations. Unlike the `ZDecimal` and `ZInteger` commands, for which the distance between two pixels is a short decimal or integer, `ZTrig` sets the horizontal distance between two pixels to be π/24 (in `Radian` mode) or 7.5 (in `Degree` mode) . The specific changes `ZTrig` makes are:

- Xmin=-352.5° or -47/24π
^{r} - Xmax=352.5° or 47/24π
^{r} - Xscl=90° or π/2
^{r} - Ymin=-4
- Ymax=4
- Yscl=1

Although this window is not quite square (and therefore, distances in the X and Y direction are not exactly equally proportioned), it is quite close, when in `Radian` mode. In a square window (such as the output of `ZSquare`), Ymax would have to be 31/24π, which is approximately 4.05789. As you can see, the value of 4 that `ZTrig` uses is not too far off.

# Advanced Uses

In theory, `ZTrig` should be quite useful in graphing trigonometric functions, since the calculated points would fall exactly on important angles; for example, it would graph the asymptotes of Y=`tan(`X) correctly. This is actually only true when in `Degree` mode. In `Radian` mode, due to round-off error, the pixels far away from the origin do not *exactly* correspond to rational multiples of π. For example, the pixel which was supposed to correspond to π/2 actually has a value of .5000000001*π, which is enough to make this command mostly useless.

However, in `G-T` mode, the size that the graph takes up on the screen is different, and `ZTrig` uses the same values, unlike `ZDecimal`.

# Error Conditions

**ERR:INVALID**occurs if this command is used outside a program (but not if the menu option is used, of course).

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/ztrig

The ΔList( Command

Calculates the differences between consecutive terms of a list.

ΔList(*list*)

Press:

- 2nd LIST to access the list menu.
- RIGHT to access the OPS submenu.
- 7 to select ΔList(, or use arrows.

TI-83/84/+/SE

2 bytes

ΔList( calculates the differences between consecutive terms of a list, and returns them in a new list.

```
ΔList({0,1,4,9,16,25,36})
{1 3 5 7 9 11}
```

# Advanced Uses

The ΔList( command is very nearly the inverse of the cumSum( command, which calculates the cumulative sums of a list. For any list, ΔList(cumSum(*list*)) will return the same list, but without its first element:

```
ΔList(cumSum({1,2,3,4,5,6,7}))
{2 3 4 5 6 7}
```

Removing the first element would otherwise be a difficult procedure involving the seq( command, so this is a useful trick to know.

If a list is sorted in ascending order, min(ΔList(*list*)) will return 0 (false) if there are repeating values in the list, and a value corresponding to true if they are all distinct.

# Error Conditions

**ERR:INVALID DIM**is thrown if ΔList( is run on a single element list.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/deltalist

The π Command

The π constant on the calculator approximates the mathematical constant π (pi), defined as the ratio of a circle's circumference to its diameter. It's fairly important in many areas of mathematics, but especially trigonometry. Probably the most common use of π on the TI-83 series calculators is for dealing with angles in radian form.

The approximate value of π stored on the calculator is 3.1415926535898.

# Related Commands

*e*^{r}

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/pi

The ΣInt( Command

For an amortization schedule, calculates the interest amount paid over a range of payments.

ΣInt(*paymentt1*, *payment2*, [*roundvalue*])

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- ALPHA A to select ΣInt(, or use arrows and ENTER.

On the TI-83+ or higher, press:

- APPS to access the applications menu.
- 1 or ENTER to select Finance…
- ALPHA A to select ΣInt(, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The ΣInt( command calculates, for an amortization schedule, the interest over a range of payments: the portion of those payments that went toward paying interest. Its two required arguments are *payment1* and *payment2*, which define the range of payments we're interested in. However, it also uses the values of the finance variables PV, PMT, and I% in its calculations.

The optional argument, *roundvalue*, is the number of digits to which the calculator will round all internal calculations. Since this rounding affects further steps, this isn't the same as using round( to round the result of ΣInt( to the same number of digits.

Usually, you will know the values of **N**, PV, and I%, but not PMT. This means you'll have to use the finance solver to solve for PMT before calculating ΣInt(; virtually always, FV will equal 0.

# Sample Problem

*Imagine that you have taken out a 30-year fixed-rate mortgage. The loan amount is $100000, and the annual interest rate (APR) is 8%. Payments will be made monthly. How much of the amount that was paid in the first five years went towards interest?*

We know the values of **N**, I%, and PV, though we still need to convert them to monthly values (since payments are made monthly). **N** is 30*12, and I% is 8/12. PV is just 100000.

Now, we use the finance solver to solve for PMT. Since you intend to pay out the entire loan, FV is 0. Using either the interactive TVM solver, or the tvm_Pmt command, we get a value of about -$733.76 for PMT.

We are ready to use ΣInt(. We are interested in the payments made during the first five years; that is, between the 1^{st} payment and the 5*12=60^{th} payment. ΣInt(1,60) gives us the answer: -$39095.73 (the negative sign simply indicates the direction of cash flow)

# Formulas

ΣInt( is calculated in terms of ΣPrn(, for which a recurrence exists. Since the total amount paid during an interval is known (it's the payment size, multiplied by the number of payments), we can subtract ΣPrn( from this total to get ΣInt(:

(1)# Error Conditions

**ERR:DOMAIN**is thrown if either payment number is negative or a decimal.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sigmaint

The ΣPrn( Command

For an amortization schedule, calculates the principal amount paid over a range of payments.

ΣPrn(*paymentt1*, *payment2*, [*roundvalue*])

On the TI-83, press:

- 2nd FINANCE to access the finance menu.
- 0 to select ΣPrn(, or use arrows and ENTER.

On the TI-83+ or higher, press:

- APPS to access the applications menu.
- 1 or ENTER to select Finance…
- 0 to select ΣPrn(, or use arrows and ENTER.

TI-83/84/+/SE

2 bytes

The ΣPrn( command calculates, for an amortization schedule, the principal amount over a range of payments: the portion of those payments that went toward paying off the principal. Its two required arguments are *payment1* and *payment2*, which define the range of payments we're interested in. However, it also uses the values of the finance variables PV, PMT, and I% in its calculations.

The optional argument, *roundvalue*, is the number of digits to which the calculator will round all internal calculations. Since this rounding affects further steps, this isn't the same as using round( to round the result of ΣPrn( to the same number of digits.

Usually, you will know the values of **N**, PV, and I%, but not PMT. This means you'll have to use the finance solver to solve for PMT before calculating ΣPrn(; virtually always, FV will equal 0.

# Sample Problem

*Imagine that you have taken out a 30-year fixed-rate mortgage. The loan amount is $100000, and the annual interest rate (APR) is 8%. Payments will be made monthly. How much of the principal amount was paid in the first five years?*

We know the values of **N**, I%, and PV, though we still need to convert them to monthly values (since payments are made monthly). **N** is 30*12, and I% is 8/12. PV is just 100000.

Now, we use the finance solver to solve for PMT. Since you intend to pay out the entire loan, FV is 0. Using either the interactive TVM solver, or the tvm_Pmt command, we get a value of about -$733.76 for PMT.

We are ready to use ΣPrn(. We are interested in the payments made during the first five years; that is, between the 1^{st} payment and the 5*12=60^{th} payment. ΣPrn(1,60) gives us the answer: -$4930.14 (the negative sign simply indicates the direction of cash flow)

# Formulas

The formula that the calculator uses for ΣPrn( is in terms of bal(:

(1)When the *roundvalue* argument isn't given, we can substitute the explicit formula for bal( and simplify to get the following formula:

# Error Conditions

**ERR:DOMAIN**is thrown if either payment number is negative or a decimal.

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/sigmaprn

The χ²cdf( Command

Finds the probability for an interval of the χ² distribution.

χ²(*lower*, *upper*, *df*

Press:

- 2ND DISTR to access the distribution menu
- 7 to select χ²cdf(, or use arrows.

Press 8 instead of 7 on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

`χ²cdf(` is the χ² cumulative density function. If some random variable follows a χ² distribution, you can use this command to find the probability that this variable will fall in the interval you supply.

The command takes three arguments. *lower* and *upper* define the interval in which you're interested. *df* specifies the degrees of freedom (choosing one of a family of χ² distributions).

# Advanced Uses

Often, you want to find a "tail probability" - a special case for which the interval has no lower or no upper bound. For example, "what is the probability x is greater than 2?". The TI-83+ has no special symbol for infinity, but you can use `E99` to get a very large number that will work equally well in this case (`E` is the decimal exponent obtained by pressing [2nd] [EE]). Use `E99` for positive infinity, and `-E99` for negative infinity.

The `χ²cdf(` command is crucial to performing a χ² goodness of fit test, which the early TI-83 series calculators do not have a command for (the `χ²-Test(` command performs the χ² test of independence, which is not the same thing, although the manual always just refers to it as the "χ² Test"). This test is used to test if an observed frequency distribution differs from the expected, and can be used, for example, to tell if a coin or die is fair.

The Goodness-of-Fit Test routine on the routines page will perform a χ² goodness of fit test for you. Or, if you have a TI-84+/SE with OS version 2.30 or higher, you can use the `χ²GOF-Test(` command.

# Formulas

As with other continuous distributions, we can define `χ²cdf(` in forms of the probability density function:

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/chisquarecdf

The χ²GOF-Test( Command

Performs a χ² goodness-of-fit test.

χ²GOF-Test(*observed*,*expected*,*df*)

While editing a program, press:

- STAT to access the statistics menu.
- LEFT to access the tests submenu.
- ALPHA D to select χ²GOF-Test(.

(outside the program editor, this will select the χ²GOF-Test… interactive solver)

TI-84+/SE, OS 2.30 or higher

2 bytes

The `χ²GOF-Test(` command performs a `χ²` goodness-of-fit test. Given an expected ideal distribution of a variable across several categories, and a sample from this variable, it tests the hypothesis that the variable actually fits the ideal distribution. As a special case, you could take the ideal distribution to be evenly divided across all categories. Then, the goodness-of-fit test will test the hypothesis that the variable is independent of the category.

The command takes three arguments:

- An
*observed*list with an element for each category: the element records the number of times this category appeared in the sample. - An
*expected*list with an element for each category: the element records the frequency with which the category was expected to appear. - The
*degrees of freedom*— usually taken to be one less than the number of categories.

The output is two-fold:

- The test statistic,
`χ²`. If the null hypothesis (that the variable fits the distribution) is true, this should be close to 1. - The probability, p, of the observed distribution assuming the null hypothesis. If this value is low (usually, if it's lower than .05, or lower than .01) this is sufficient evidence to reject the null hypothesis, and conclude that the variable fits a different distribution.

# Sample Problem

Working as a sales clerk, you're wondering if the number of customers depends on the day of week. You've taken a count of the number of customers every day for a week: 17 on Monday, 21 on Tuesday, 18 on Wednesday, 10 on Thursday, 24 on Friday, 28 on Saturday, and 24 on Sunday. Store this observed count: {17,21,18,10,24,28,24} to L1.

There were a total of sum(L1)=142 customers. So the expected number of customers on each day was 142/7. Store all the expected counts: {142/7,142/7,142/7,142/7,142/7,142/7,142/7} to L2 (as a shortcut, you can store 142/7{1,1,1,1,1,1,1}).

Since there are 7 days, there are 6 (one less) degrees of freedom. So the resulting command is `χ²GOF-Test(L1,L2,6)`.

The output will give a `χ²` of 10.32394366, and a p value of 0.1116563376. This is higher than 5%, so the test is not significant on a 95 percent level. It's perfectly possible, in other words, that the number of customers is independent of the day of week.

(Note that in this case, if you suspected the number of customers to be higher on weekends, you could use a more sensitive test for only two categories: `2-SampTTest`)

# Advanced Uses

The `χ²GOF-Test(` command is only on TI-84 Plus and newer calculator models. However, it's possible to use the `χ²cdf(` command to simulate it on the other calculators: see the χ² Goodness-of-fit Test routine.

# Formulas

The formula for calculating the test statistic is as follows (O_{i} is the observed count of the i^{th} category, and E_{i} is the expected count):

The p-value, then, is the probability that the `χ²` statistic would be this high, using the `χ²cdf(` command with the appropriate value for degrees of freedom.

# Error Conditions

**ERR:DIM MISMATCH**is thrown if the two lists are of different length.**ERR:DOMAIN**is thrown if they only have one element, or if*df*is not a positive integer.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/chisquaregof-test

The χ²pdf( Command

Evaluates the χ² probability density function at a point.

χ²pdf(*x*, *df*

Press:

- 2ND DISTR to access the distribution menu
- 6 to select χ²pdf(, or use arrows.

Press 7 instead of 6 on a TI-84+/SE with OS 2.30 or higher.

TI-83/84/+/SE

2 bytes

`χ²pdf(` is the χ² probability density function.

Since the χ² distribution is continuous, the value of `χ²pdf(` doesn't represent an actual probability — in fact, one of the only uses for this command is to draw a graph of the χ² curve. You could also use it for various calculus purposes, such as finding inflection points.

The command takes two arguments: the value at which to evaluate the p.d.f., and *df*, the number of 'degrees of freedom'.

# Formulas

The value of `χ²pdf(` is given by

# Related Commands

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/chisquarepdf

The χ²-Test( Command

Performs a χ² test of independence.

χ²-Test(*observed matrix*, *expected matrix*, *draw?*

While editing a program, press:

- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- ALPHA C to select χ²-Test(, or use arrows

(outside the program editor, this will select the χ²-Test… interactive solver)

TI-83/84/+/SE

2 bytes

This command performs a `χ²` test of independence. This test is used to assess the independence of two categorical variables with known frequencies. The test is only valid for a simple random sample from the population, and only if all the frequencies are sufficiently large (greater than 5).

Note: this test is different from the `χ²` goodness of fit test, which the TI-83 calculators don't have a command for. For a program that will perform the `χ²` goodness-of-fit test, see the goodness-of-fit test routine.

To use this test, you need a matrix containing a *contingency table*. This is a table in which every row corresponds to a value of the first variable, and every column to a value of the second. The number in each cell represents the frequency with which the corresponding values of the two variables occur together. For example: suppose that the two variables are sex (male and female) and eye color (blue, brown, and green). The contingency table would have two rows and three columns. The cell in the first row and column would be the number of blue-eyed men in the sample, the cell in the second row and first column would be the number of blue-eyed women, and so on.

The `χ²-Test(` command takes two arguments: the *observed* matrix and *expected* matrix. The first of these should be the contingency table you've already completed, presumably in the Matrix editor. The expected matrix does not need to already exist: the `χ²-Test(` command will calculate and store the expected frequencies (under the assumption that the variables are independent) to this matrix.

The command is primarily for use in a program. Although you can access the `χ²-Test(` command on the home screen, via the catalog, there's no need: you can use the `χ²-Test…` interactive solver found in the menu instead.

In either case, it's important to understand the output of `χ²-Test(`. Here are the meanings of each line:

`χ²`is the test statistic, calculated from the differences between the observed and the expected matrices.- p is the probability associated with the test statistic. We use p to test the null hypothesis that the two variables are independent. If p is low (usually, if it's <0.05) this means there's little chance that two independent variables would have a contingency table so different from the expected, and we reject the null hypothesis (so we'd conclude that the two variables are not independent).
- df is the degrees of freedom, defined as (# of rows - 1)*(# of columns - 1), important for calculating p.

# Sample Problem

You want to compare the effectiveness of three treatments in curing a terminal disease. You have obtained data for 100 patients who had the disease, which contained information on the treatment used, and whether the patient lived or died. You put this information in a contingency table:

Lived | Died | |
---|---|---|

Treatment A | 40 | 10 |

Treatment B | 27 | 6 |

Treatment C | 11 | 6 |

To perform the test, you store this information to a matrix such as [A], either through the matrix editor or by hand:

`:[[40,10],[27,6],[11,6→[A]`

You submit this matrix as the first argument, and some other matrix (such as [B]) for the second:

`:χ²-Test([A],[B]`

The output looks something like this:

```
χ²-Test
χ²=2.14776311
p=.3416796916
df=2
```

The most important part of this output is the line p=.3416796916 - the probability of getting such results under the hypothesis that the treatments and survival rate are independent. This value is greater than .05, so the data is not significant on a 5% level. There is not enough evidence to reject the null hypothesis, so treatment and survival rate may very well be independent. In non-mathematical language, this means that there's no reason to believe the treatments vary in effectiveness.

# Advanced Uses

The final argument of `χ²-Test(`, *draw?*, will display the results in a graphical manner if you put in "1" for it. The calculator will draw the `χ²` distribution with the correct degrees of freedom, and shade the area of the graph beyond the `χ²` statistic. In addition, the same values as usually will be calculated and displayed. You would make your conclusions in the same way as for the regular output.

# Related Commands

# See Also

For the most up-to-date version of this command, see http://tibasicdev.wikidot.com/chisquare-test