Week #1
Topic: Introduction, precision,
quantifiers
I
had some problems understanding the four cases dealing with sets. I am new to
programming in python, so at the beginning it was hard to comprehend how the
code was working. I overcame the problem by using the Python Visualizer. I went
over the code step by step, and I realized that Python was taking one by one
each element of the set1 and comparing these elements to the elements in the
set 2. Once I understood the code, it was easier to figure out the description
of the functions q0, q1, q2 and q3.
1) Understanding
the problem
What
is given? A code in Python. Specifically: return all ({x in s2 for x in s1}), return any({x in s2 for x in s1}), return not any({x in s2 for x in s1}), return not all({x in s2 for x in s1})
2) Devising
a plan
Is
there something similar?
A
similar example was given in class before introducing this problem. The
relationship between mathematical sets and the way we write them in Python, as
well as the meaning of all and any were explained.
Possible
approaches:
1) Try different sets such as A={1,3},
B={1,3}, C={1,5}, D={12,15}
2) Use the Python Visualizer
3) See which sets could prove to be true
for each function. Then, create them. And finally, see the Patterns that these
new sets may have.
3) Carrying
out the plan
I
carried out plan 1 first. I somehow understood the logic of the problem, but I
didn’t feel confident enough. Hence, I carried out plan 2, which proved to be
very useful. At the end, I tried plan three as a way to reaffirm the knowledge.
4) Looking
back
After I understood the logic behind the problem, I
went over the problem again to look for patterns that could help me to solve
similar problems.
This is a very good technique for seeing how math concepts will be implemented in programming languages. Thanks for that, it will be quite useful.
ReplyDelete