Easy Intersection of waves

Hi,

in my eyes it is way too hard to get the intersection/difference of waves.

I've found http://www.igorexchange.com/node/366 but that is only for too waves and involves a copy of the waves.

I imagine an operation like

CalculateIntersection/FREE/S/TOL/C {wave1, wave2, wave3} result


the flag "/S" denotes if the data should be sorted (which involves a copy) or not. wave1 to waveN can either be all numeric or all text.
/TOL denotes the tolerance for floating point.
/C denotes if it should be done case sensitive or not for text waves.

Thanks for reading,
Thomas

PS: From the top of my head.
PPS: A superset without duplicates is nowadays with Concatenate and FindDuplicates is to do.
A few quick thoughts:

Assuming all waves are real and 1D:

1. The example http://www.igorexchange.com/node/366 applies to integer waves. You would need a slightly different approach for arbitrary combination of data types.

2. I'm not sure how you define the intersection of more than two waves in your example above.

3. You have not defined what happens in the unfortunate case that the waves have completely different wave scaling.

4. why can't you just write a simple function that returns wave1(x)-wave2(x) and pass that to FindRoots?
Igor wrote:
A few quick thoughts:

Assuming all waves are real and 1D:

1. The example http://www.igorexchange.com/node/366 applies to integer waves. You would need a slightly different approach for arbitrary combination of data types.



Yes.

Igor wrote:

2. I'm not sure how you define the intersection of more than two waves in your example above.


My idea is an intersection from set theory. So the intersection of {4, 1, -5, 3}, {Nan, 10, 1}, {7, 1} is {1}. Or is intersection the wrong word?

Igor wrote:

3. You have not defined what happens in the unfortunate case that the waves have completely different wave scaling.
4. why can't you just write a simple function that returns wave1(x)-wave2(x) and pass that to FindRoots?

[/quote]

Wave scaling should not matter, also I don't understand why FindRoots should help.
thomas_braun wrote:

My idea is an intersection from set theory. So the intersection of {4, 1, -5, 3}, {Nan, 10, 1}, {7, 1} is {1}. Or is intersection the wrong word?



This is a completely different type of "intersection". My interpretation of "intersection" is finding the point along the axes where two curves intersect each other hence FindRoots.

I'm assuming you have a reasonably large problem or else you would conduct direct comparison. If you stick to integers you can avoid the full comparison route by finding the min and max for each wave and then the global min and max. You then create a vector representing each wave with entries from global min to global max that are set to NaN outside the actual members of the class. A simple product of all the vectors will give you the "intersection" where values are different than NaN. If you are not dealing with integers the practicality of this approach would depend on the size of the problem and the size of the tolerance value.

Alternatively you could consider this as a geometrical problem (extend each set to 2D) and then use the tolerance with the fast clustering operation.