Texas Instruments TINSPIRE Reference Guide - Page 89

Value1, List1, Matrix1, promptString, DispFlag, user's response, remain, Catalog &gt, Request - nspire 84

Page 89 highlights

remain( ) remain(Value1, Value2) ⇒ 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) Catalog > 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. Define a program: Define request_demo()=Prgm Request "Radius: ",r Disp "Area = ",pi*r2 EndPrgm Run the program and type a response: request_demo() 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. 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 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() 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. Result after selecting OK: Enter a polynomial in x: x^3+3x+1 Real roots are: {-0.322185} 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. c · • Handheld: Hold down the key and press repeatedly. Note: See also RequestStr, page 84. TI-Nspire™ Reference Guide 83

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164

TI-Nspire™ Reference Guide
83
remain()
Catalog >
remain(
Value1
,
Value2
)
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)
x
N
y
·
iPart(x/y)
As a consequence, note that
remain(
N
x,y
)
N
remain(
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}