Wednesday, October 15, 2014

Week 5

Test #1 was not too bad. The only part I didn't understand was the question where the 2 logic statements were identical, except for the order of quantifiers. I didn't know this mattered. I always assumed ∀x, ∃y was the same as ∃y, ∀x. However, I checked over the Wikipedia page on Quantifiers and it seems of course it does matter.

They used the example ∀x ∈ N, ∃y ∈ N, y = x^2 and ∃y ∈ N, ∀x ∈ N, y = x^2. The first statement is true, but the second is false. Previously, if they were written symbolically, I would have said both are true. When I write them in English, it's of course a lot easier to understand and explain why both are not true. Actually, even if you wrote them as Python/pseudo syntax with proper nesting, it would be better.

all(any(y==x**2 for y in naturalNums) for x in naturalNums)

any(all(y==x**2 for x in naturalNums) for y in naturalNums)

Monday, October 6, 2014

Week 4

I found the assignment to be reasonably easy for the most part. 2d) really tricked me. I saw it was the inverse, but decided to word it as "the converse of the contrapositive" which I thought would be a safe bet. Initially I found number 4 hard, which probably should have been the easiest one, but quickly figured things out once I realized that some of the sections could be empty. It was late and I shouldn't have assumed that. Lastly on number 5, Professor Heap explained in class it could be both, so I assumed there must be one that was both. I couldn't find one that was, but in the answers it appears that, of course, there was. Now it's time to make the aid paper for the test on Wednesday and luckily the notes include a couple handy and comprehensive pages of logic formulas.

Monday, September 29, 2014

Week 3

In Friday's class we had an interactive problem solving session where we had to find the pattern generated when we folder a strip of paper. To solve the problem, my partner and I looked at the sample data we had. I saw the length grew at a rate of 2 times the previous length plus 1. My partner quickly found that it was a recursive operation where the previous folder pattern was not only a subset, but ended with the previous set's pattern. Next we looked at the middle item of each sample pattern, and it was the always the same. Lastly I found that the first part of the pattern was a reverse and inverse of the last segment of the pattern. My partner started to code this in Python using strings, but I advised that maybe we should use True and False to represent up and down because in Python to inverse we can just use the keyword not and we can easily do the reverse and inverse operation with the following lines of code:
previousData = [True, True, False, False]
firstPart = [not x for x in reversed(previousData)]

Thursday, September 18, 2014

Week Two - First Post

Hi! I'm Josh, a transfer student from Queen's. I'm taking CSC165 as part of my computer science degree along with CSC207. Although I've used the all and any built-in functions a number of times in my own Python software, I was still able to learn and benefit from the recap in class these past couple weeks. Some of the experiences in some of the last exercises of "natural language" on Wednesday were tricky, like "Don't knock it unless you've tried it." I'll have to memorize the implication, contrapositive and converse. Other than that, the first couple weeks haven't been too bad. Looking forward to what's in store next.