Define – Texas Instruments PLUS TI-89 User Manual

Page 450

Advertising
background image

Appendix A: Functions and Instructions 433

8992APPA.DOC TI-89 / TI-92 Plus: Appendix A (US English) Susan Gullord Revised: 02/23/01 1:48 PM Printed: 02/23/01 2:21 PM Page 433 of 132

0b

binaryNumber

0h

hexadecimalNumber

Without a prefix,

integer1

is treated as

decimal. The result is displayed in decimal,
regardless of the

Base

mode.

Define

CATALOG

Define

funcName

(

arg1Name, arg2Name, ...

) =

expression

Creates

funcName

as a user-defined function.

You then can use

funcName

()

, just as you use

built-in functions

.

The function evaluates

expression

using the supplied arguments and

returns the result.

funcName

cannot be the name of a system

variable or built-in function.

The argument names are placeholders; you
should not use those same names as
arguments when you use the function.

Note:

This form of

Define

is equivalent to

executing the expression:

expression

!

funcName

(

arg1Name,arg2Name

).

This command also can be used to define
simple variables; for example,

Define a=3

.

Define g(x,y)=2xì 3y ¸

Done

g(1,2) ¸

ë 4

1! a:2! b:g(a,b) ¸

ë 4

Define h(x)=when(x<2,2x

-3,

ë 2x+3) ¸

Done

h(л 3) ¸

л 9

h(4) ¸

ë 5

Define eigenvl(a)=

cZeros(det(identity(dim(a)
[1])

-xù a),x) ¸

Done

eigenvl([л 1,2;4,3]) ¸

{

2ш 3

- 1

11

л (2ш 3 + 1)

11

}

Define

funcName

(

arg1Name, arg2Name, ...

) = Func

block

EndFunc

Is identical to the previous form of

Define

,

except that in this form, the user-defined
function

funcName

()

can execute a block of

multiple statements.

block

can be either a single statement or a

series of statements separated with the “:”
character.

block

also can include expressions

and instructions (such as

If

,

Then

,

Else

, and

For

). This allows the function

funcName

()

to

use the

Return

instruction to return a specific

result.

Note:

It is usually easier to author and edit

this form of Function in the program editor
rather than on the entry line.

Define g(x,y)=Func:If x>y Then
:Return x:Else:Return y:EndIf
:EndFunc
¸

Done

g(3,ë 7) ¸

3

A binary number can have up to
32 digits. A hexadecimal number
can have up to 8.

Zero, not the letter O, followed by b or h.

Advertising
This manual is related to the following products: