Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Some Calculator

Some

Function: some (<f>, <a>)

Function: some (<f>, <L_1>, ..., <L_n>) Returns true if the predicate <f> is true for one or more given arguments.

Given one set as the second argument, some(<f>, <s>) returns true if is(<f>(<a_i>)) returns true for one or more <a_i> in <s>. some may or may not evaluate <f> for all <a_i> in <s>. Since sets are unordered, some may evaluate <f>(<a_i>) in any order.

Given one or more lists as arguments, some(<f>, <L_1>, ..., <L_n>) returns true if is(<f>(<x_1>, ..., <x_n>)) returns true for one or more <x_1>, ..., <x_n> in <L_1>, ..., <L_n>, respectively. some may or may not evaluate <f> for some combinations <x_1>, ..., <x_n>. some evaluates lists in the order of increasing index.

Given an empty set {} or empty lists [] as arguments, some returns false.

When the global flag maperror is true, all lists <L_1>, ..., <L_n> must have equal lengths. When maperror is false, list arguments are effectively truncated to the length of the shortest list.

Return values of the predicate <f> which evaluate (via is) to something other than true or false are governed by the global flag prederror. When prederror is true, such values are treated as false. When prederror is false, such values are treated as unknown.

Examples:

some applied to a single set. The predicate is a function of one argument.

          (%i1) some (integerp, {1, 2, 3, 4, 5, 6});
          (%o1)                         true
          (%i2) some (atom, {1, 2, sin(3), 4, 5 + y, 6});
          (%o2)                         true

some applied to two lists. The predicate is a function of two arguments.

          (%i1) some ("=", [a, b, c], [a, b, c]);
          (%o1)                         true
          (%i2) some ("#", [a, b, c], [a, b, c]);
          (%o2)                         false

Return values of the predicate <f> which evaluate to something other than true or false are governed by the global flag prederror.

          (%i1) prederror : false;
          (%o1)                         false
          (%i2) map (lambda ([a, b], is (a < b)), [x, y, z],
                     [x^2, y^2, z^2]);
          (%o2)              [unknown, unknown, unknown]
          (%i3) some ("<", [x, y, z], [x^2, y^2, z^2]);
          (%o3)                        unknown
          (%i4) some ("<", [x, y, z], [x^2, y^2, z + 1]);
          (%o4)                         true
          (%i5) prederror : true;
          (%o5)                         true
          (%i6) some ("<", [x, y, z], [x^2, y^2, z^2]);
          (%o6)                         false
          (%i7) some ("<", [x, y, z], [x^2, y^2, z + 1]);
          (%o7)                         true

(%o1)                                true
(%i2) 

Some Example

Related Examples