ⓘ This web page is about the old AlgoSim 2 software. Perhaps you are looking for the new Algosim 3 application?
AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: count

count(S, var, expr) returns the number of elements in the set S which satisfy the boolean expression expr, a string containing a boolean expression in one variable, var, which will iterate over all elements in the set S.

Examples: count({1, 4, 6, 8}, "x", "x>5") = 2
          count({❨1, 0❩, ❨1, 1❩, ❨0, 1❩}, "x", "norm(x) = 1") = 2
          count([1, 100], "n", "isPrime(n)") = 25

count(v, var, expr) returns the number of components in the real or complex vector v that satisfy the boolean expression expr in the variable var.

Examples: count(❨1, 3, 3, 4, 5❩, "x", "x=3") = 2

count(M, var, expr) returns the number of elements in the real or complex matrix M that satisfy the boolean expression expr in the variable var.