Chapter 2: Main Application
55
Primality Test (isPrime)
The “isPrime” function determines whether the number provided as the argument is prime (returns TRUE) or
not (returns FALSE). The syntax of the “isPrime” function is shown below.
isPrime(Exp/List[ ) ]
• Exp or all of the elements of List must be integers.
Problem
Operation
Determine whether the numbers 51 and 17 are
prime.
(isPrime({51, 17})
[isPrime]
{
51
,
17
}
)
w
Equal Symbols and Unequal Symbols (
=
,
≠
,
<
,
>
,
s
,
t
)
You can use these symbols to perform a number of different basic calculations.
Problem
Operation
To add 3 to both sides of
x
= 3.
x
+ 3 = 6
(
X
=
3
)+
3
w
Subtract 2 from both sides of
y
s
5.
y
– 2
s
3
(
Y
;
5
)-
2
w
Tip
• In the “Syntax” explanations of each command under “2-7 Using the Action Menu”, the following operators are indicated
as “Eq/Ineq”: =,
≠
, <, >,
s
,
t
. Whether or not the “Eq/Ineq” operators include the “
≠
” operator is specified for each
command by a separate note.
• An expression that contains multiple equation or inequality operators cannot be input as a single expression. For output
expressions, an expression can be output with multiple operators only in the case of inequality operators that are facing in
the same direction (example: –1 <
x
< 1).
Example:
solve(
x
2
–
1
< 0,
x
)
w
{–1 <
x
< 1}
“with” Operator (
|
)
The “with” ( I ) operator temporarily assigns a value to a variable. You can use the “with” operator in the
following cases.
• To assign the value specified on the right side of | to the variable on the left side of |
• To limit or restrict the range of a variable on the left side of | in accordance with conditions provided on the
right side of
|
The following is the syntax for the “with” ( I ) operator.
Exp/Eq/Ineq/List/Mat|Eq/Ineq/List/(and operator)
You can put plural conditions in a list or connected with the “and” operator on the right side.
“
⫽
” can be used on the left side or the right side of |.
Problem
Operation
Evaluate
x
2
+
x
+ 1 when
x
= 3.
13
X{
2
+
X
+
1
UX
=
3
w
For
x
2
– 1 = 0, determine the value of
x
when
x
> 0.
{
x
= 1}
.X{
2
-
1
=
0
,
X
)
UX
>
0
w
For
x
2
– 1 = 0, determine the value of
x
when −2 <
x
< 2.
{
x
= −1,
x
= 1}
.X{
2
-
1
=
0
,
X
)
U
-
2
<
X
p
and
p
X
<
2
w
Determine the value of abs (
x
) when
x
> 0.
x
4X
e
UX
>
0
w