2014年9月17日星期三

CSC165 SLOG Week1~2

What’s something new I learned this week?


1. How to Build Sets in Python

  Before the class, I only learned how to build sets in math class like this: S = {1, 3, 5, 7, 9, 11}. Now I know that python doesn’t like this and instead I should write{x for x in S if x > 6} or {x + 2 for x in S if x > 6}.

2. Any and All…

 If all elements of a set S are not False, then all (S) produces True in python.
    If at least one element of a set S is not False, then any(S) produces True in python.
   These two statements are new to me.

3. The steps I should take to solve a problem.

  First,UNDERSTANDING THE PROBLEM
  Second, DEVISING A PLAN.
  Third,CARRYING OUT THE PLAN
  Fourth,Looking Back!!
 And the most impressed me part is the fourth step, which I didn't do well before, and I think I should keep in mind.

4. How to evaluate quantified claims:

  To verify a universal ("for all. . . ") claim, show there is no
counter-example.
  To falsify a universal claim, _nd at least one counter-example.
  To verify an existential ("exists. . . ") claim, show there is at
least one example.
  To falsify an existential claim, show there are no examples.
 And I think these are very useful tips for further learning.

5. What’s implication?

The form “if P, then Q" is called implication.(I certainly saw the sentence"if P, then Q"before, but I don't know it's called implication.) And in implication "If P, then Q", we call P the antecedent and Q the consequent.An implication is false iff the antecedent part is true and the consequent part is false.In particular,
an implication is always true when the antecedent is false.


6. What's contrapositive?

Another symbol,¬ , toggles the truth value of a statement.When we toggle and reverse an implication, we get its contrapositive. And imlication and its contrapositive have exactly the same meaning.



7. Converse of implication and the relation between them

Reverse the direction, and you have the converse of the original
implication.An imlication is like this:∀x∈ E, F(x)⇒ L(x),and its converse is like this:∀x∈ E, L(x)⇒ F(x).
What connection is there between the truth of an implication and the truth of its converse? I think there is not too much relation here, which means the truth of an imlication doesn't affect its converse.


8."Natural" language

Here are some examples of expressing implication, P⇒Q, in English, which I did wrong in class...Here is the correct version. 

You can't stay enrolled in CSC165 without a pulse.
P:can't stay enrolled in CSC165    Q:  without a pulse  

Successful programming requires skill.
P: successful programming    Q:skill

I'll go only if you insist.
P: I'll go      Q:you insist

Don't knock it unless you've tried it.
P: knock it     Q:tried it

And here are the tips for deciding who's P and who's Q: Finding its contrapositive and check it!!


What’s something that frustrated and challenged me this week?


It was a exercise in class,and at first, I cannot figure out the relation between set S1 and S2 as in q3 like who's subset, and after class I discussed with some friends to solve it.
Q0
Description: Some elements of S1 is not an element of S2
picture:


q1
Description: some element of S1 is an element of S2.
Picture:


q2
Description: every element of S1 is an element of S2.
Picture:



q3
description: every element of S1 is not an element of S2.
picture:




How confident do you feel about material covered this week?


At first I think it’s super easy because it’s something I’m familiar with, but then I found I got stuck in some details like the relations between two sets(already talked about above) and drawing venn diagrams to decide which part must be empty or occupied. And I will explain the problem below:)


How does course material relate to other classes or interests?


I think the material has much relations to the math classes as I learned in MAT137,for example, I knowed the universal claims:∀  and existential claims:∃, unions:∪, intersection:∩,subsets:⊆

What was one of your achievements this week?


To get used to mathematical expression in python, and figured out some problems by myself. For example in "implication information"exercise (see the picture), I didn't think the correct answer for 4 is "¬L⊆¬F", but should be "¬F⊆¬L" (still the subset problem). After figuring out that ¬F means male, who could earn less than, equal to or more than 55,000, and ¬L only represents ≥ 55,000, therefore ¬L should be a subset of ¬F :)














How did your tutorial/test/assignment go this week?



When I draw a venn diagram during this week's tutorial, I was always confused about how to decide whether a region must be empty or occupied. For example in the tutorial exercise2 :




for (b)Truth,the correct answer is:


but I drawed like this: 


and for (c)False, the correct answer is :




but I drawed this:

After asking TA for help, I figured out that I misunderstood what is False for a statement, I should put "not" at the beginning of a sentence. For example, for (c)"all three python programs don't pass all three tests", the false statement should be"Not all three python programs don't pass all three tests".


Problem solving:

  1. First step, understanding the problem. It was a quiz question at the end of the tutorial,which said "A friend of you says that all the students in U of T, who take linguistic course, also take programming course." And you should draw a venn diagram to show that this statement is true.A refers to all students, P refers to students who take programming courses, and L refers to students taking linguistic courses.You should also draw "O" if the region must be occupied and "X" for the region must be empty.
  2. Second step, devising a plan :I tried to put the statement into my own words:if a student takes a linguistic course, then he or she also takes programming course.
  3. Third step, carrying out a plan.Therefore I drawed like this and handed in my quiz :
But wait! What if a student doesn't take linguistic course? If the statement is true, he or she shouldn't take programming course at the same time!! So I think the correct diagram is like this:
Unfortunately, this idea came to my mind after the quiz :(

4. Fourth step, looking back: The reason why I did wrong for the first time is that I didn't take another situation into consideration, which I should pay attention to in further study. And I think the statement in question is an implication, so this solution also satisfies the true condition for the similar statement: "If P, then Q".











没有评论:

发表评论