AreEqual and list

Rumburak shared this question 5 years ago
Answered

I want to test if point E AreEqual with many points. I use :

If[AreEqual[E, P] ∨ AreEqual[E, Q] ∨ AreEqual[E, A] ∨ AreEqual[E, B] ∨ AreEqual[E, C] ∨ AreEqual[E, D], false, true]

It is possible to replace points P,Q,R,A,B,C,V with an list ?

Comments (3)

photo
1

You can use E∈{P,Q,R,A,B,C,V} .

photo
1

Yes. This work.

But if I have 30 or more points is easy with an list...


Thank you very much

photo
1

List1=List of your points

List2=sequence[AreEqual[E,Element[List1,k]],k,1,len[List1]]

c=sum[List2]


Shorter: c=sum[sequence[AreEqual[E,Element[List1,k]],k,1,len[List1]] ]


The value of c ist 0 if E is different from all elements of List1,

and c=1 if E is equal to one point from list1.

© 2021 International GeoGebra Institute