Combining Sets A and B Using If-Then Clause: AUB with C1 and C2

  • Context: High School 
  • Thread starter Thread starter porums
  • Start date Start date
  • Tags Tags
    Set
Click For Summary
SUMMARY

The discussion focuses on simplifying an if-then-else structure in pseudo-code involving sets A and B, specifically the union operation AUB. The initial structure presented is conditional on two variables, C1 and C2. Participants clarify the interpretation of the nested if statements and suggest creating a truth table to derive a simpler expression that maintains the same logical outcome. The conversation emphasizes the importance of understanding logical structures in programming.

PREREQUISITES
  • Understanding of set theory, specifically union operations.
  • Familiarity with conditional statements in programming languages like C++.
  • Basic knowledge of logical expressions and truth tables.
  • Experience with pseudo-code and its syntax.
NEXT STEPS
  • Learn how to construct truth tables for logical expressions.
  • Study conditional statements in C++ and their execution flow.
  • Explore set operations in programming languages, focusing on union functions.
  • Investigate simplification techniques for logical expressions in programming.
USEFUL FOR

Programmers, computer science students, and anyone interested in optimizing conditional logic in code, particularly those working with set operations and logical expressions.

porums
Messages
27
Reaction score
0
Set A={1,2,3} B={5,6,7}
an if clause is created,
if C1
___then
_______if C2 then
_________AUB
else
___AUB

Someone could please help me simplify the if-then-else in one if-then clause ? :LOL:
Thanks
 
Physics news on Phys.org
First, you'd have to tell us whether you mean
Code:
if C1 then {
    if C2 then {
        AUB
    }
} else {
    AUB 
}
which is implied by your spacing, or
Code:
if C1 then {
    if C2 then {
        AUB
    } else {
        AUB 
    }
}
which is what any C++ like compiler would execute given your (pseudo)code.

It's really not too hard to see, but if you can't figure it out by looking at the expression, you might want to make a "truth table":
Code:
        | C1 false  | C1 false | ...
        |  C2 false | C2 true  | ...
------------------------------------
  do:   |  nothing  |  AUB     | ...
and try to find a simpler expression involving C1 and C2 which gives the same result.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 2 ·
Replies
2
Views
16K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K