next up previous contents index
suivant: Nombre d'éléments ayant une monter: La liste ou les précédent: Tester si un élément   Table des matières   Index


Compter les éléments d'une liste ou d'une matrice vérifiant une propriété : count

count a deux ou trois paramètres : Lorsque count a : On tape :
count((x)->x,[2,12,45,3,7,78])
Ou on tape :
count((x)->x,[[2,12,45],[3,7,78]])
On obtient :
147
car on a : 2+12+45+3+7+78=147.
On tape :
count((x)->x,[[2,12,45],[3,7,78]],row)
On obtient :
[59,88]
car on a : 2+12+45=59 et 3+7+78=88.
On tape :
count((x)->x,[[2,12,45],[3,7,78]],col)
On obtient :
[5,19,123]
car on a : 2+3=5,12+7=10,45+78=123.
On tape :
count((x)->x<12,[2,12,45,3,7,78])
On obtient :
3
On tape :
count((x)->x==12,[2,12,45,3,7,78])
Ou on tape :
count((x)->x==12,[[2,12,45],[3,7,78]])
On obtient :
1
On tape :
count((x)->x>12,[2,12,45,3,7,78])
On obtient :
2
On tape :
count(x->x^2,[3,5,1])
On obtient :
35
En effet on a : 32 +52 +11 = 35.
On tape :
count(id,[3,5,1])
On obtient :
9
En effet, id est la fonction identité et on a : 3+5+1=9.
On tape :
count(1,[3,5,1])
On obtient :
3
En effet, 1 est la fonction constante égale à 1 et on a : 1+1+1=3.
next up previous contents index
suivant: Nombre d'éléments ayant une monter: La liste ou les précédent: Tester si un élément   Table des matières   Index
Documentation de giac écrite par Renée De Graeve