Saturday, 25 October 2014

Running time

In this week’s lectures a lot of content was covered. A lot more than how much is usually covered. I spent more time after the lecture reviewing the material covered as a result. One of the more interesting things I learned in the lecture this week was proof by cases. To prove by cases you have to split the argument into different cases, also the conclusion for each case has to be proved. An example would be, for all real numbers n2+n is even. There would be two cases. One would be where n is even and the other would be where n is odd. A surprising thing that I learned was uniqueness: If there are two natural numbers (m, n) and one of them aren’t equal to zero, there is exactly one pair of natural numbers (q, r) where m = qn + r, n > r >= 0. Another interesting concept I learned this week was running time, which is the number of steps taken by an algorithm. Running time is also independent of the hardware itself, meaning that it only depends on the algorithm. For running time, only how the number of steps grow as the size of the input grows matter. This means that 6n2 and 800n2 are no different, hence constant factors don’t matter. Also, we only care about large input sizes which means that n2+2 and n2+n are no different, only the highest term matters.

I also learned O(n2), which is called the asymptotic upper-bound. Which means that the function is growing no faster than n2. Ω(n2) was also covered. Ω(n2) is called the asymptotic lower-bound. Which means that the function is growing no slower than n2. It is also worth noting that asymptotic notation is simplification of real running time.


One thing I found pretty intuitive was that program running time varies with input. There is also a worst case where the running time is the longest for a specific length of input. There is also a best case and average case.

Saturday, 18 October 2014

Test week!

This week I had my first midterm test. I felt pretty prepared for it and I think I did fairly well. I reviewed all the PDFs from the lectures and did all the tutorial questions again. I also did a couple tests from that were from last years winter session website. After Prof. Heap posted a practice test, I did it and I did fairly well, so I felt pretty confident for the real test! In the lecture, I learned the non boolean function floor. The symbolic definition of floor is: ⌊x⌋∈∧⌊x⌋≤x∧∀z∈, z≤x⇒z≤⌊x⌋. Also, when working on a proof with a definition such as ∀x∈ℝ, x≤⌊x⌋+1, it helps to fully understand the definition. When figuring out how to prove it, manipulating expressions into forms that are close to what is in the detention also helps. When working on proofs before writing the body doing rough works is highly recommended because you would know whether or not the statement is true and it would help with the structure. Limit proofs were also introduced in the lectures this week. I find them a bit confusing, but I get them to an extent. Usually in a limit proof you would have to leave delta till you learned more about it. Additionally, to prove it you would have to used a backwards search to find delta.

Saturday, 11 October 2014

More proofs!

This week’s lecture went more into depth proofs, it was pretty interesting. I found how proving a statement true using the reverse direction interesting. Instead of proving an implication straight on, you can prove the negation and in some cases it will be easier. Also, I learned what the floor of x means. It means the largest integer that is smaller or equal or x. For example, if x was 5.5 then the floor of x would be x. I was also amazed about how a statement is deemed false. To prove a statement false, you prove the negation is true. This also amazed Kevin, which he wrote on his blog. Additionally, I learned how to prove by cases. To prove that n2+n is even, you would have two cases where n is even and where n is odd. Proving an existential true was fairly intuitive. All that has to be done is to finding a single example. Another thing I found interesting was that proofs can consists of different structures, there are different ways to prove a single thing.

This week I did the folding problem solving problem. First, I read over the problem and made sure I understood it. The problem asks to find a method of predicting the number of up and down creases a paper has when folded a number of times. Secondly, I came up with a plan to solve the problem. My plan was to fold the paper one time and write down the number of up and down creases and repeating until I have an appropriate sample size. Then using the data to find two functions that finds the number of up creases and down creases. After getting a bit stuck I looked at the hints and one of them states that one pattern is somehow contained in the other. After that I was thinking about the relation and it came to me. When the paper is folded the initial folds remain in the new pattern.

Saturday, 4 October 2014

First taste of proofs

This week’s lectures were fairly interesting. I learned when A bears a relation to B and B bears the same relation to C, then A bears it to C. This means that the relationship is transitive. For example, if ∀x∈X, (P(x)⇒Q(X))∧ (Q(x)⇒R(X)) is true then ∀x∈X, P(x)⇒R(X) is also true. Also, the order of quantifiers matters, ∀x∈X, ∃y∈X means that you choose a y after your enemy chooses a x; on the other hand, ∃y∈X, ∀x∈X means that you choose a y and then your enemy chooses a x. The meaning of statements entirely change when the order of the quantifiers are altered. I was also introduced to the definition of a limit during this week’s lecture. I learned how to find a range for a delta when epsilon is given. For example, when given the ∀e∈ℝ+, ∃d∈ℝ+, ∀x∈ℝ, |x-2|<d⇒|x2-4|<e and e=2 the method for calculating d would be to plug the y values into the antecedent. Which would give the values |20.5-2|=0.586 and|60.5-2|=0.449 so delta must be less than the smallest difference (d<0.449). The outline for a proof is also pretty interesting. You “assume” when the quantifier is ∀ and “let” when the quantifier is ∃. Also, when the statement consists of an implication you assume the antecedent. After the body of the proof is complete you introduce the quantifiers. What surprised me was the way to find proofs. The two ways introduced in the lecture was bubble search and tree search. In bubble search and tree search you try to find the chain of antecedents and consequents.