Programming
691
Initialize local variables
All local variables must be assigned an initial value before they are
referenced.
À
1 is stored as the initial value for
m
.
Note (CAS):
Functions and programs cannot use a local variable to
perform symbolic calculations.
CAS: Performing symbolic calculations
If you want a function or program to perform symbolic calculations, you
must use a global variable instead of a local. However, you must be
certain that the global variable does not already exist outside of the
program. The following methods can help.
•
Refer to a global variable name, typically with two or more
characters, that is not likely to exist outside of the function or
program.
•
Include
DelVar
within a program to delete the global variable, if it
exists, before referring to it. (
DelVar
does not delete locked or linked
variables.)
Differences between functions and programs
A function defined in the Program Editor is similar to the functions built
into the TI-Nspire™ Software.
•
Functions must return a result, which can be graphed or entered in a
table. Programs cannot return a result.
•
You can use a function (but not a program) within an expression. For
example:
3
¦
func1(3)
is valid, but not
3
¦
prog1(3)
.
•
You can run programs from Calculator and Notes applications only.
However, you can evaluate functions in Calculator, Notes, Lists &
Spreadsheet, Graphs & Geometry, and Data & Statistics.
Define fact(n)=Func
Local m: 1
&
m
À
While n>1
n
¦
m
&
m: n–1
&
n
EndWhile
Return m
EndFunc
Summary of Contents for TI-Nspire
Page 38: ...26 Setting up the TI Nspire Navigator Teacher Software ...
Page 46: ...34 Getting started with the TI Nspire Navigator Teacher Software ...
Page 84: ...72 Using the Content Workspace ...
Page 180: ...168 Capturing Screens ...
Page 256: ...244 Embedding documents in web pages ...
Page 336: ...324 Polling students ...
Page 374: ...362 Using the Review Workspace ...
Page 436: ...424 Calculator ...
Page 450: ...438 Using Variables ...
Page 602: ...590 Using Lists Spreadsheet ...
Page 676: ...664 Using Notes You can also change the sample size and restart the sampling ...
Page 684: ...672 Libraries ...
Page 714: ...702 Programming ...
Page 828: ...816 Data Collection and Analysis ...
Page 846: ...834 Regulatory Information ...
Page 848: ...836 ...