### Set notation confusing

S = { (x,y) E R^2 : a <= x <= b, 0 <= y <= f(x) }

(E = epsilon symbol)

OK, what?

It sort of resembles a list comprehension in Python, but I can't exactly map it 1:1.

S = [ x,y for x,y in ratsqs(): (a <= x <= b) and (0 <= y <= f(x)) ]

def ratsqs():

for r in all_rational_numbers():

yield r,(r*r)

What am I misunderstanding?

E isn't actually epsilon, it is "member of" or "belonging to".

Read it like this:

"S is the set of all pairs of numbers (x,y) belonging to the set of all pairs of real numbers, where a <= x <= b, and 0 <= y <= f(x)"

bon vivant
March 7th, 2007 6:16pm

Maybe "found in" is more apt than "belonging to".

bon vivant
March 7th, 2007 6:22pm

So, erhm..

Other symbols which seem to appear interchangeably inside of curly brackets are the | and : and ,

They're not really defined either.

Programming is so much easier. ;)

: means "such that"

, means "and"

| I don't see anywhere...?

bon vivant
March 7th, 2007 6:30pm

http://en.wikipedia.org/wiki/Set-builder_notation
Note: While Python's list comprehension works similarly to set-builder notation, it does not denote a set but rather creates a mathematical tuple (as opposed to Python's native tuple datatype; the actual returned value's type is list) based on existing tuples. It is possible to use true sets in Python with the set keyword and set class, but this causes additional deviations from set-builder notation:

* set(l for l in L)

* set((k, x) for k in K for x in X if P(x))

strawberry snowflake
March 7th, 2007 6:44pm

Oh neat, this helps a lot. Thank you!

There's no | in that example, but I have seen it in set comprehensions.

e.g.

S = {x E N | x mod 2 = 0}

is supposed to be 'The set S consists of x "found in" all natural numbers "such that" x mod 2 = 0'? End result is S is all even natural numbers.

Is | the same as : ?

Yes, it does seem that | is the same as :.

bon vivant
March 7th, 2007 9:46pm

Such is life. Or "∃ x | x is life".

strawberry snowflake
March 7th, 2007 9:56pm

as an opposite of ∀, i did a really good job finding this sucker to copy/paste..

∀
March 7th, 2007 11:03pm

The forum allows html entities?

Ε

Michael B
March 8th, 2007 1:16am

:(

Michael B
March 8th, 2007 1:17am

> Maybe "found in" is more apt than "belonging to".

"Element of" is how I remember it.

March 8th, 2007 6:03am