Texas Instruments TI-Nspire CX CAS TINSPIRE-CX-CAS Leaflet

Product codes
TINSPIRE-CX-CAS
Page of 603
Letting the User Assign the Values to Variables
A program or function can refer to variables created beforehand. This method
requires users to remember the variable names and to assign values to them
before using the object.
1.
Define the program.
Define calculatearea()=
Prgm
area:=w*h
EndPrgm
2.
Supply the variables, and then run the program.
w:=3 : h:=23.64
calculatearea()
:area                           70.92
Letting the User Supply the Values as Arguments
This method lets users pass one or more values as arguments within the
expression that calls the program or function.
The following program,
volcyl
, calculates the volume of a cylinder. It requires
the user to supply two values: height and radius of the cylinder.
1.
Define the
volcyl
program.
Definevolcyl(height,radius) =
Prgm
Disp "Volume =", approx(p ¦ radius
2
¦
height)
EndPrgm
2.
Run the program to display the volume of a cylinder with a height of 34 mm
and a radius of 5 mm.
volcyl(34,5)               Volume = 534.071
Note:
You do not have to use the parameter names when you run the
volcyl
program, but you must supply two arguments (as values, variables,
or expressions). The first must represent the height, and the second must
represent the radius.
Getting Started with the Program Editor
521