Application Guide

138 Calculator Application
Creating User-defined Functions and Programs
You can use the Define command to create your own functions and programs. You can
create them in the Calculator application or in the Program Editor and then use them in
other TI-Nspire™ applications.
For more information, see Overview of the Program Editor and Libraries.
Defining a Single-line Function
Suppose you want to define a function named cube() that calculates the cube of a
number or variable.
1. On the Calculator entry line, type Define cube(x)=x^3 and press Enter.
The message “Done” confirms that the function has been defined.
2. Type cube(2) and press Enter to test the function.
Defining a Multiple-line Function Using Templates
You can define a function consisting of multiple statements entered on separate lines.
A multiple-line function may be easier to read than one with multiple statements
separated by colons.
Note: You can create multiple-line functions only by using the Define command. You
cannot use the := or operators to create multiple-line definitions. The
Func...EndFunc template serves as a container for the statements.
As an example, define a function named g(x,y) that compares two arguments x and y.
If argument x > argument y, the function should return the value of x. Otherwise, it
should return the value of y.
1. On the Calculator entry line, type Define g(x,y)=. Do not press Enter yet.
2. Insert the Func...EndFunc template.
From the Functions&Programs menu, select Func...EndFunc.
Calculator inserts the template.