Online Algebra Calculator
Many of users do not use powerful Maxima computer algebra system for systematic work, but for ad hoc algebraic calculations – equations, functions, matrixes, etc. only. To do this job, it is not useful to download the whole application from a web site.
Function: every (<f>, <s>)
![Every Example every (identity, [true, true]);](http://maxima-online.org//plot.html?g=i2114075557.png&t=img&db=r-606133671)
Function: every (<f>, <L_1>, ..., <L_n>) Returns true if the predicate <f> is true for all given arguments.
Given one set as the second argument, every(<f>, <s>) returns true if is(<f>(<a_i>)) returns true for all <a_i> in <s>. every may or may not evaluate <f> for all <a_i> in <s>. Since sets are unordered, every may evaluate <f>(<a_i>) in any order.
Given one or more lists as arguments, every(<f>, <L_1>, ..., <L_n>) returns true if is(<f>(<x_1>, ..., <x_n>)) returns true for all <x_1>, ..., <x_n> in <L_1>, ..., <L_n>, respectively. every may or may not evaluate <f> for every combination <x_1>, ..., <x_n>. every evaluates lists in the order of increasing index.
Given an empty set {} or empty lists [] as arguments, every 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, and the return value from every is false. When prederror is false, such values are treated as unknown, and the return value from every is unknown.
Examples:
every applied to a single set. The predicate is a function of one argument.
(%i1) every (integerp, {1, 2, 3, 4, 5, 6});
(%o1) true
(%i2) every (atom, {1, 2, sin(3), 4, 5 + y, 6});
(%o2) false every applied to two lists. The predicate is a function of two arguments.
(%i1) every ("=", [a, b, c], [a, b, c]);
(%o1) true
(%i2) every ("#", [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) every ("<", [x, y, z], [x^2, y^2, z^2]);
(%o3) unknown
(%i4) prederror : true;
(%o4) true
(%i5) every ("<", [x, y, z], [x^2, y^2, z^2]);
(%o5) false(%o1) true (%i2)