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:

Sublist_indices Calculator

Sublist_indices

Function: sublist_indices (<L>, <P>) Returns the indices of the elements x of the list <L> for which the predicate maybe(<P>(x)) returns true; this excludes unknown as well as false. <P> may be the name of a function or a lambda expression. <L> must be a literal list.

diffform(vars, expr) ::= block(    [indexofvar],    indexofvar: buildq([vars, y: ?gensym(), z: ?gensym()],        lambda([y],            block([matches: sublist_indices(vars, lambda([z], z = y))],                if length(matches) = 0 then unknown else matches[1]            )        )    ),    buildq([expr, indexofvar, t: ?gensym()],        map(lambda([t], [t[1], map(indexofvar, t[2])]), expr)    ));
macroexpand( diffform([x,y,z], [[2*x, [x,y]], [y, [y,z]]]) );
             diffform([x,y,z], [[2*x, [x,y]], [y, [y,z]]])  ;

Examples:

          (%i1) sublist_indices ([a, b, b, c, 1, 2, b, 3, b],
                                 lambda ([x], x=b));
          (%o1)                     [2, 3, 7, 9]
          (%i2) sublist_indices ([a, b, b, c, 1, 2, b, 3, b], symbolp);
          (%o2)                  [1, 2, 3, 4, 7, 9]
          (%i3) sublist_indices ([1 > 0, 1 < 0, 2 < 1, 2 > 1, 2 > 0],
                                 identity);
          (%o3)                       [1, 4, 5]
          (%i4) assume (x < -1);
          (%o4)                       [x < - 1]
          (%i5) map (maybe, [x > 0, x < 0, x < -2]);
          (%o5)                [false, true, unknown]
          (%i6) sublist_indices ([x > 0, x < 0, x < -2], identity);
          (%o6)                          [2]

(%o1)                                true
(%i2) 

Sublist_indices Example

Related Examples

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(&);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate

indices-load

load(itensor);

ishow(a([i,j],[k,l],...

indices(%);

Calculate