How to Efficiently Handle Set Operations Without Inbuilt Functions?

Click For Summary

Homework Help Overview

The discussion revolves around set operations in set theory, specifically focusing on the expression A - (B ∪ C) given sets A, B, and C. Participants explore methods to handle set operations without relying on inbuilt functions.

Discussion Character

  • Exploratory, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the application of DeMorgan's laws and the interpretation of set differences and unions. There are attempts to clarify the steps involved in calculating A - (B ∪ C) and considerations about checking answers independently.

Discussion Status

Some participants have offered insights into the reasoning behind set operations and the importance of verifying answers. There is an ongoing exploration of different perspectives on handling set operations, particularly in coding contexts without inbuilt functions.

Contextual Notes

Participants mention the complexity of handling large collections of sets and the potential challenges in applying set operations in such cases. There is an emphasis on understanding the foundational concepts rather than relying solely on formulas.

chwala
Gold Member
Messages
2,828
Reaction score
425
Homework Statement
This is my original question; Given ##A=[1,2,x,y]## ##B=[2,x,z,m]## ##C=[4,5]##, then find
##A-(BUC)##
Relevant Equations
set theory
ok we shall have ##(A-B)∩(A-C)= [1,y]∩[1,2,x,y]=[1,y]## correct?
 
Physics news on Phys.org
Have you heard of DeMorgan's laws?
 
  • Like
Likes   Reactions: chwala
chwala said:
Homework Statement:: This is my original question; Given ##A=[1,2,x,y]## ##B=[2,x,z,m]## ##C=[4,5]##, then find
##A-(BUC)##
Relevant Equations:: set theory

ok we shall have ##(A-B)∩(A-C)= [1,y]∩[1,2,x,y]=[1,y]## correct?
Correct. But it concerns me that you seem unable to check your answers yourself. That is a skill that is just as important to learn as anything else.
 
  • Like
Likes   Reactions: chwala
WWGD said:
Have you heard of DeMorgan's laws?
Yes that's what I used...##M-(B∪Q)=(M-B)∩(M-Q)##
 
Last edited:
  • Like
Likes   Reactions: WWGD
FactChecker said:
Correct. But it concerns me that you seem unable to check your answers yourself. That is a skill that is just as important to learn as anything else.
I am able to check...I ask because I may want a different perspective from what I know...I am always learning...cheers
 
chwala said:
I am able to check...I ask because I may want a different perspective from what I know...I am always learning...cheers
My perspective would be that if you want a simple answer to this, you do the following:

a) Write down the elements of the set ##A##: ##1, 2, x, y##.

b) Write down the elements of ##B \cup C##: ##2, x, z, m, 4, 5##

c) Go through the set ##B \cup C## one element at a time and delete these elements from the list in set ##A##.

1d) That gives the answer ##A - (B \cup C) = \{1, y\}##

If you want to verify De Morgan's law by using this as an example, then fine. But, don't lose sight of the simple fact that ##A - (B \cup C)## means things that are in ##A## with anything that is in either ##B## or ##C## removed.
 
  • Love
  • Like
Likes   Reactions: Mark44 and chwala
Yes, it's a good think not to rely only on big formulas , but what if you have similar with a large collection of sets? It becomes a nightmare to do a specific example.
 
  • Like
Likes   Reactions: chwala
WWGD said:
Yes, it's a good think not to rely only on big formulas , but what if you have similar with a large collection of sets? It becomes a nightmare to do a specific example.
If I were coding this, without using inbuilt set operations, then I would do it either the way described; or, not bother with the union at all, but just go through ##B## and ##C## separately and delete elements from ##A##. My first step wouldn't be the form the sets ##A - B## and ##A - C##.

For example, pseudocode for ##X = A - (B_1 \cup B_2 \dots \cup B_n)##:

Create set ##X = A##
For ##k = 1## to ##n##:
Remove any element in ##B_k## from ##X##
(or, ##X = X - B_k## for short)
Loop
Print ##X##
 
  • Like
Likes   Reactions: Hall and chwala

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 23 ·
Replies
23
Views
2K
Replies
8
Views
2K
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
2
Views
2K
Replies
18
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K