__[^] to represent sets.__

`HashSet<t></t>`

You're right, this won't work for a continuous set. Seems you may have to brew your own

`Range<T>`

class./ravi

Hi!

How could I represent multiple subsets of a set of real numbers?

The problem is that,I want to remove some parts of real numbers in range : [0,2*pi) for example,after removal I will have s.th like this:

Result set = [0,0.1] U [.2,2.65] U [2.66,2.86] U ... U [3.0,3.1]

in fact the result set,consists of several non-overlapping subsets(we don't know the exact count of these subsets.may be they are up to 200).

how could I implement "union" and "subtraction" and "overlapping" operations?

How could I represent multiple subsets of a set of real numbers?

The problem is that,I want to remove some parts of real numbers in range : [0,2*pi) for example,after removal I will have s.th like this:

Result set = [0,0.1] U [.2,2.65] U [2.66,2.86] U ... U [3.0,3.1]

in fact the result set,consists of several non-overlapping subsets(we don't know the exact count of these subsets.may be they are up to 200).

how could I implement "union" and "subtraction" and "overlapping" operations?

CyrusT190

Comments

`HashSet<t></t>`

You're right, this won't work for a continuous set. Seems you may have to brew your own

`Range<T>`

class./ravi

v2

Comments

HashSet is used for discrete sets only! :(

I want to represent continuous sets!

I want to represent continuous sets!

You both are not quite right. The situation is more delicate.

First of all, nothing in a computer presents a continuous set. The whole computer is the finite-state machine, like it or not. You should also understand, that there are no real numbers (a set of those would be a continuous set) -- you have only the model approximating that, such as the set of all double of float numbers.

Now, the real problem is how to build a model of real number or other "potentially continues" objects to make some help from the computer. This is the completely different, quite correct problem, but only if strictly formulated.

In other words, the solution of OP's is most likely quite solvable. He only need to provide complete and strict description of required operations. Listing of those set-theory primitives is not enough. I would need to know how the set is used. I assume the use is realistic, and in this case I can almost guarantee the solution. I would recommend to start with explanation of the ultimate purpose.

--SA

First of all, nothing in a computer presents a continuous set. The whole computer is the finite-state machine, like it or not. You should also understand, that there are no real numbers (a set of those would be a continuous set) -- you have only the model approximating that, such as the set of all double of float numbers.

Now, the real problem is how to build a model of real number or other "potentially continues" objects to make some help from the computer. This is the completely different, quite correct problem, but only if strictly formulated.

In other words, the solution of OP's is most likely quite solvable. He only need to provide complete and strict description of required operations. Listing of those set-theory primitives is not enough. I would need to know how the set is used. I assume the use is realistic, and in this case I can almost guarantee the solution. I would recommend to start with explanation of the ultimate purpose.

--SA

> You should also understand, that there are no real numbers

Quite correct. Any usage of Range<decimal> would be an approximation.

> I would recommend to start with explanation of the ultimate purpose.

+5

/ravi

Quite correct. Any usage of Range<decimal> would be an approximation.

> I would recommend to start with explanation of the ultimate purpose.

+5

/ravi

Absolutely. Thank you very much.

--SA

--SA

I did not down-vote this answer even in its original version, because it is not completely wrong (and it was not completely wrong before); the question just needs some more detail and it all needs some analysis based on that.

And the use of the Range is a good idea. The set could be represented by the set of instances of, say, Range<double>.

Depending on expected use of the set class, even the modified use of HashSet could be appropriate. Let's learn about the prospective usage of it.

--SA

And the use of the Range is a good idea. The set could be represented by the set of instances of, say, Range<double>.

Depending on expected use of the set class, even the modified use of HashSet could be appropriate. Let's learn about the prospective usage of it.

--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada
+1 416-849-8900 x 100

In the first question, you made another mistake which I explained in my answer, with a fix.

--SA