TI-Nspire™ Reference Guide 83
remain()
Catalog
>
remain(Va lu e1 , Val u e2 ) ⇒ value
remain(List1, List2) ⇒ list
remain(Matrix1, Matrix2) ⇒ matrix
Returns the remainder of the first argument with respect to the
second argument as defined by the identities:
remain(x,0) x
remain(x,y)
xNy·iPart(x/y)
As a consequence, note that remain(Nx,y) Nremain(x,y). The
result is either zero or it has the same sign as the first argument.
Note: See also mod(), page 64.
Request
Catalog
>
Request promptString, var[, DispFlag [, statusVar]]
Request
promptString, func(arg1, ...argn)
[, DispFlag [, statusVar]]
Programming command: Pauses the program and displays a dialog
box containing the message promptString and an input box for the
user’s response.
When the user types a response and clicks OK, the contents of the
input box are assigned to variable var.
If the user clicks Cancel, the program proceeds without accepting
any input. The program uses the previous value of var if var was
already defined.
The optional DispFlag argument can be any expression.
•If DispFlag is omitted or evaluates to 1, the prompt message
and user’s response are displayed in the Calculator history.
•If DispFlag evaluates to 0, the prompt and response are not
displayed in the history.
Define a program:
Define request_demo()=Prgm
Request “Radius: ”,r
Disp “Area = “,pi*r
2
EndPrgm
Run the program and type a response:
request_demo()
Result after selecting OK:
Radius: 6/2
Area= 28.2743
The optional statusVar argument gives the program a way to
determine how the user dismissed the dialog box. Note that statusVar
requires the DispFlag argument.
• If the user clicked OK or pressed Enter or Ctrl+Enter, variable
statusVar is set to a value of 1.
• Otherwise, variable statusVar is set to a value of 0.
The func() argument allows a program to store the user’s response as
a function definition. This syntax operates as if the user executed the
command:
Define func(arg1, ...argn) = user’s response
The program can then use the defined function func(). The
promptString should guide the user to enter an appropriate
user’s response that completes the function definition.
Note: You can use the Request command within a user-defined
program but not within a function.
To stop a program that contains a Request command inside an
infinite loop:
• Windows®: Hold down the F12 key and press Enter
repeatedly.
• Macintosh®: Hold down the F5 key and press Enter
repeatedly.
• Handheld: Hold down the c key and press ·
repeatedly.
Note: See also RequestStr, page 84.
Define a program:
Define polynomial()=Prgm
Request "Enter a polynomial in x:",p(x)
Disp "Real roots are:",polyRoots(p(x),x)
EndPrgm
Run the program and type a response:
polynomial()
Result after selecting OK:
Enter a polynomial in x: x^3+3x+1
Real roots are: {-0.322185}