Wednesday 3 December 2014

Extra Entry; Comments

Slogs I have commented on:


  • http://vyytancsc165slog.blogspot.ca/2014/11/functions-are-funny.html?showComment=1417660608374#c4065434265191836145
  • http://vladcslog.blogspot.ca/2014/12/week-12final-finallyit-is-all-over.html?showComment=1417660785839#c3217143780510388678
  • http://holakittyxu.blogspot.ca/2014/11/week-9.html?showComment=1417660979023#c3040742420868360153
  • http://hopalongaslog.blogspot.ca/2014/11/week-9.html?showComment=1417661143458#c649603759792557716
  • http://abhinavchawlacsc165.blogspot.ca/2014/11/week-9.html#comment-form
  • http://99bugsbutaglitchaintone.blogspot.ca/2014/11/week-12-one-last-slog.html?showComment=1417661326279#c4269938467694243043

Math Problem Solving Entry: Penny Piles

Well guys, it's a little late but here I am bringing you the problem solving part of my blog, involving the problem that we addressed during the last lecture of week 7. You guys know it by the name Penny Piles. Let me give you the breakdown of How I solved this problem.

Summary
You are sitting in front of two drawers. The left drawer contains 64 pennies, the right drawer contains nothing. Can you arrange things so that one of the drawers has 48 pennies, using the following two operations:
L
If the left pile has an even number of pennies, transfer half of them to the right pile. If the left pile has an odd number of pennies, operation L is disallowed.
R
If the right pile has an even number of pannies, transfer half of them to the left pile. If the right pile has an odd number of pennies, operation R is disallowed.

Choose another number in the range [0, 64]. Starting from the same initial position, can can you arrange things such that one of the drawers has that number of pennies? Are there any numbers in that range that are impossible to achieve?

Understanding the Problem

  • What is given: that the left drawer contains 64 pennies and the right drawer contains no pennies. Also we are given two methods of transfer from left to right (L) and right to left (R). These methods also contain rules that one must abide by.
  • What is needed: We need to find the correct combination of Ls and Rs in order to successfully ensure that one drawer has 48 pennies.
Devising a Plan
  • Plan 1: keep track of the potential penny transfers in a list/tree, starting with the ordered pair (64,0) representing (pennies in left drawer, pennies in right drawer) and start implementing Ls and Rs and keep track of the result. Record the process of reaching the point where one drawer contains 48 pennies
  • Plan 2: Look at the hint page and proceed from there
Carrying out the plan
After carrying out plan one I discovered that there are two ways to achieve having 48 pennies in one drawer. These methods are implementing method L 2 times in order to have the right drawer contain 48 pennies, and implementing the method L and then the method R in order to have the left drawer contain 48 pennies.

Looking Back
Looking back the main problem did not take too long to solve seeing as only 2 steps needed to be taken to achieve the desired result. So one could say you could technically solve this problem just by eyeballing the situation and coming up with the solution in your head rather than writing things down. The result can be checked as we can implement the methods in reverse in order to achieve the original result.

Additional Problem
In terms of the additional problem of attempting to find any number in the range [1, 64] that is impossible to achieve in terms of pennies by using the two methods listed, I find that to be impossible. The methods L and R can be used to achieve any one of those numbers in terms of pennies in a drawer. All even numbers can be achieved because the combination [62, 2] can be reached by using L and R, This means that if 2 can be achieved, then any multiple of 2 can be achieved by using these methods. In terms of odd numbers, since all even numbers can be achieved, the even numbers that can be halved into the same odd number times 2 can be used to both achieve these odd numbers as well as create other odd numbers in the range [1, 64] by using L or R. For example, 34 can be used to achieve 17. 54 can be used achieve 27, etc. [23, 41] can be achieved by going from [64, 0], [32, 32], [48, 16], [56, 8], [28, 36], [46, 18], and finally [23, 41].

Week 12: Computability and Countability Continued

Well the time is here guys, it's the last week of official classes is here. This also means that this is the last weekly report that I will be making. It has been an adventure making all these blogs and even though it is a required part of the CSC 165 curriculum, I will admit that I had fun making some of these entries. So, let's make this last weekly roundup a good one. This is Kyle Mendoza checking in for one last time to bring you guys a weekly report for week 12 of CSC165. During this week we continued our studies on computability and countability, or lack thereof in our case. We focused on identifying non-countable sets and non-computable functions more than anything else this week, starting with explaining why the set of natural numbers and the set of rational numbers are countable while the set of real numbers is not. We also briefly went over proof by induction to wrap up the week and the term. So with all that said, let's get into it.

During the first part of the week, we continued learning about countability and now addressing why certain sets are not countable. We discovered that for a set to be countable it also had to be listable, meaning that each value of the set had a position that would correspond to some element of the set of natural numbers. Cantor, a mathematician, proved that real numbers could not be listable and thus, were not countable. Cantor essentially stated that no matter what you do to try and list the real numbers between 0 to 1, you will always omit an entry if you take '0.' and traverse the diagonal adding 1 to the digit if the digit is less than 5 and subtracting 1 if the digit is 5 or greater. This proved to be true as multiple entries was seen to be omitted. This means that the set of real numbers from 0 to 1 is larger than the set of natural numbers, which is mind blowing. It took me a lot of re-reading and answers to questions provided by my peers in order for me to fully understand this idea. Next we explored diagonalization, an idea that can help identify functions that are not computable. Essentially, list the infinite countable python functions as well as whether they halt or loop when passed into each other as arguments and traverse the diagonal of the result, toggling the values from halts to loops and loops to halts and create a hypothetical function that cannot exist on such list. Finally we wrapped up by exploring proof by induction, another method of proof that we can use in our proof structures. I'm not sure if I will be using this proof in the final exam, simply because I don't completely understand it, but who knows, maybe after studying it prior to the exam I'll find that it makes a lot of proofs a lot easier. With that being said, there's nothing much I can say about induction other than it's just another weapon I can add to my arsenal when tackling proofs once I learn how to use it effectively and efficiently. To end the week we finished with a problem solving session about finding the number of squares that a diagonal can pass through in a rectangular grid.

So, this is it guys, this is the end of this blog entry, and the end of this term. I personally found this last week's concepts to be more on the challenging side, but a lot more manageable than week 11. Comment below on how you guys found this week's concepts, and let me know your solutions for the problem solving session. Let us compare and contrast our answers. As always words are hard, comp-sci is and always will be awesome, and later days. Good luck on your exams everybody. This is Kyle Mendoza signing out.

Week 11: Halting Problem and Computability

Hey guys, how are you all doing? Hope you did better than me during this week 11 because I was confused on many occasions during this week. But there's no use in telling you this week was hard without telling you why is there? So as always this is Kyle checking in to bring u guys a week round up of week 11 of CSC165. With only a week remaining before the end of classes I thought I had all the concepts of this course figured out and that I was ready to do well on the final. Then I got introduced to halting and computability. I think this might have been the hardest week for me personally, just because I've never felt as lost during this course as I did this week. With that being said, let's get into the details.

This week didn't start off that badly, so it wasn't completely overwhelming. We started off by simply identifying that not all problems have an algorithm that can be used to solve them and looked at examples of such problems. This was simple enough because we looked at a python code that when executed would not return control to the user. This was relatively easy to understand because I am familiar with python. We then found that there was no way to implement a function that could return true when another function passed in as a parameter would halt and false otherwise. If this was to be used in another function that used function f as a parameter and would pass if the halt function on function f returned true and return 42 if the halt function returned false the result would be that this function would only halt when it didn't halt, which is a contradiction. To prove the non-computability of a function, proof by contrapositive would have to be used. This proof almost always involved the halt function as part of the implication. Unfortunately to this day I still don't completely understand how to completely prove the non-computability of a function. I had gotten the structure down after looking at the course notes but more studying is needed, possibly looking at sample proofs for non-computability. We wrapped up the week by talking about countability, and how a set of numbers could only be properly counted if the counting was 1-1 and onto, to ensure there was no over counting and under counting, respectively. We also found that two infinite sets of numbers are not always equal, meaning, strangely, that infinity does not equal infinity all the time. the size of two sets can be different even if both containing more elements than any number. I was able to grasp this concept after closely listening to Danny along with rereading the annotated slides when they were posted, though it took quite a while. We also found that some infinite sets like the natural numbers, even natural numbers, and rational numbers were countable because could be counted 1-1 and onto. Finally, we ended the last lecture with an intriguing statement, that not all sets are countable, and that a mathematician named Cantor would show this using diagonalization, But that would be for next week.

Well I think that might have been the one of the longest wrap-ups I have ever done for this course. As you can see, it took a lot for me to even mildly understand these concepts and there is still much work to be done. But with only 2 weeks till the final exam it definitely is crunch time. Of course, just because I personally found this week difficult doesn't mean you all did. Comment below how you felt about this week and if I am over-complicating these concepts and I should just relax when studying computability and countability. Also, let me know how all of you are feeling now that the term is almost over. Its been a crazy week, but that's to be expected. As always, words are hard, comp-sci is awesome, and later days. This is Kyle signing out.

Week 10: Big Omega, Big Theta, General Properties about Bound Proofs, and a Little about Limits

What's up guys, this is Kyle here checking in for a weekly wrap up of week 10 of CSC 165. Finals are drawing near for this course as there are only 2 more weeks of class left. Hope everyone is following along so far. This week we covered quite a bit of new concepts, it was definitely a little bit overwhelming to wrap my head around. We started off covering how to incorporate limit laws and L'Hopital's rule when proving Big O. We then moved on to learning how to prove Big Omega, which in all honesty, wasn't that difficult because of the similarity to the proof structure of Big O. This was followed by learning how to write a new kind of bound proof which was Big Theta, which essentially combined the pieces of Big O statements and Big Omega statements into one statement. Finally, to round up the week we went over some general properties about upper bounds and lower bounds. So, now that I've set up a stimulating intro, let's get into the juicy details.

We started the week off by going over some week 9 things that we did not get to tackle during the actual week 9, which focused on using limits as an option to solve proofs about Big O of certain functions. This technique was mainly used to be able to prove any Big O statements involving exponential functions. This is because there is a statement about limits of the rationalization of the two functions involved in the proof as x (or n) approaches infinity that closely mirrors the statement about Big O in terms of structure. This can be used to help us write a proof on the Big O of these particular functions. This was initially hard to understand at first, but because this concept needed to be used to complete assignment 3, I looked into the course notes as well as the annotated slides in order to fully grasp this idea, and it worked. I now feel completely comfortable with using limits to solve Big O proofs. Next up, we tackled writing proofs about Big Omega and Big Theta, which basically had the same proof structure as Big O except for one difference. In the case of Big Omega, instead of a function f(n) being < (c) g(n), it was now f(n) > (c) g(n). Big Theta essentially combined these two statements to say there was a (c1) g(n) < f(n) < (c2) g(n), essentially saying that g(n) could be bounded above and below f(n). Like I stated before, because this concept was very similar to Big O, it wasn't at all hard for me to understand it right away. Finally, we ended the week by going over general properties about Big O and Big Omega of multiple functions, and how to tell without looking at the actual function whether the statement was true or not. An example of this is that we were able to prove that for all functions f that can be bounded above by g, the square of f can also be bounded above by the square of g. Once again the proofs for these concepts were very straightforward and didn't cause any headaches for me.

To conclude it all, this week was packed full of information, but thankfully all the information was easy for me to understand. If even one of the concepts proved to be difficult for me to grasp it would've definitely be a excruciating week. As it was it was pretty challenging not because of the difficulty of the concepts but simply because of the amount of information we were taking in. But what do you guys think? Did you think we learned a lot this week? Were you all able to follow along or did you lag behind at some parts? Let me know in the comments below the answers to these questions as well as any other things you want to say. Let's start a discussion. Anyways, that about wraps up this report, as always, words are hard, comp-sci is awesome, and later days. This is Kyle signing out

Week 9: Addressing Maximum Slice and Provng Big O of Polynomials

What's up guys this is Kyle checking it to give you guys a weekly report for week 9 of CSC 165, This week we focused on two main concepts. One was a concept we previously learned about that was being applied to a very challenging context, and one was a new concept that would help us in the later weeks. So without further ado let's dive into this.

The first concept we addressed was the finding the sum of steps of a function called max_sum, which returned the maximum sum over slices of a set L. Keep in mind L can be any generic set. Now for this problem we had to take a little bit more time to find the number of steps to execute this function in the worst case simply because there were two nested loops, and step counting gets increasingly difficult when multiple nested loops are introduced because the number of steps increase exponentially when a nested loop is introduced. To solve this problem Danny separated this problem into three different parts in order to address each loop one by one before coming up with a way to produce the summation of all the loops. This process was and still is hard for me to understand, and I think I definitely need to read it over a couple more times and either ask Danny or my other peers to help me understand the solution if I can't understand it after multiple reads. The second concept we learned about was proving if certain polynomials were in big O of other polynomials. We learned about which functions could be bounded above others and how the proof structure would look like. What I found was that in order to prove a function was in big O of another function, some underestimation of the original function needed to be made in order to compare it to the function it was in big O of. We also learned an important rule that a polynomial function cannot be bounded above by a polynomial function with a lower degree than it. Such an occurrence would immediately require a disproof of the statement. This concept I found I understood immediately and I'm glad that I did because I would hate to have added another idea to the list of ideas I needed to look back on and study more closely.

Overall this week was pretty balanced. It started off pretty intense for me but it mellowed out and stayed with something I felt comfortable doing, which was big O proofs with polynomials. Anyways, let me know what all of you guys thought of week 9 of CSC165 we're definitely getting closer to the finish line, time is flying. Be sure to comment your thoughts on this week's topics and anything else you want to discuss. My apologies for this going up super late, I honestly just got behind on doing these SLogs so I'm trying to pump all the ones I have left to do now, thanks for the understanidng. As always, words are hard, comp-sci is awesome, and later days. This is Kyle signing out.

Tuesday 11 November 2014

Week 8: Counting Steps, the Worst Case, and the Big Oh proof

What's up everyone, this is Kyle checking in for a week 8 roundup and discussion. This week, we dived fully into the world of sorting and its applications to the logical and mathematical reasoning of CSC165.

We started out by looking at the number of steps it takes to execute a linear search for any list of length n. Calculating the number of steps it took to execute code was relatively simple at first, but counting steps for nested loops was a bit more complicated and it took me a while to actually understand how it was done. Even now I am not completely comfortable with the method, but through reading through the annotated slides and trying to find my own way of expressing how to calculate the number of steps it takes to execute different searches. I did find, however, that the easiest search method to count the steps of was the linear search, which, compared to many other searches such as binary search, has a rather long run time. After that we learned about the worst case of all these searches, which is the greatest possible number of steps it takes to execute the search for a list with length n. We explored the upper bound and the lower bound of the worst cases, also known as big 'Oh' and big Omega, respectively. Finally to round off the week, we learned how to do proofs involving the Big Oh or upper bound. At first I was confused how we would prove something like that, but after seeing the equivalent statement of a big Oh proof, it became much clearer what we had to do. It took me a while to understand how we were to find a 'B' and a 'c' to satisfy the big Oh for different searching methods, but after a bit of practice with simpler examples of code I was able to understand it.

Well, that's a wrap for this week 8 roundup, let me know if how you guys found this week's lectures, and if it prepared you for the term test that came around in week 9. Also, comment below how you all did in assignment 2, were you able to solve those difficult e, d proofs? (1.1 and 1.2) As always guys, words are hard, computer science is awesome, and later days. This is Kyle signing out.

Friday 31 October 2014

Week 6: Thanksgiving and the Introduction to MORE Proofs!

Hey guys, as promised this is Kyle checking in to bring you the weekly report on week 6 that I should have gave you last week. Once again I deeply apologize for not being able to deliver last week, things got pretty busy and I just couldn't find the time. So, without further ado, let's get started with this week's roundup.

So during week 6 we went over more methods of proving as well as different kinds of proofs. We started off with learning how to write proofs of non-boolean functions, meaning that the function does not return true or false. Instead, the function might return something like a number. We used the floor of x example to illustrate this concept. Since the floor of x function and proofs using that function is something that will come up often in assignment 2, I need to review the key points of the function in order to be able to accurately write the proofs for the statements in assignment 2. Also, learning to write these codes may help me write the proofs faster and more efficiently. So after going over the floor of x function we moved on to learning how to prove something false, which came as no surprise since we only had learned how to prove statements true before. It turns out that proving a statement false is simply negating the statement, and proving the negation true. I had no problem understanding this concept. The only thing of concern was probably figuring out when I needed to prove a statement false. But, as professor Heap said, you only need to concern yourself with proving statement false when you are 100% sure that it isn't true. How to do that is by trying to prove the original statement. After learning about disproving false statements we then wrapped up the week with learning about proof by cases, proof about limits, and being careful about negating statements. Overall, this week was a relatively easy one to understand, except maybe for proof about limits. which I need to review.

So guys, comment below, how did you find this week 6's material? Were the proofs easy to understand? Let me know. Also, keep a look out for my mathematical workings for the penny piles problem covered in week 7. Hope you guys enjoyed this blog, and as always, words are hard, comp-sci is awesome, and later days.

Monday 27 October 2014

Week 7: Inferences and Sorting Strategies

What's up everyone this is Kyle checking in to bring you a week 7 report on the happenings of CSC 165. You may have noticed that there was no blog post for week 6, I deeply apologize for that. That week was quite heavy with work as I had a calculus mid-term as well as an essay to submit so I did not have too much time on my hands. So, to make it up to you guys I'm going to be doing a double header today, posting up a blog for week 6 and week 7. Now that formalities are out of the way, let's get started with the weekly roundup.

This week we started off by reviewing the methods in disproving false statements. However, it did not have to do with how to disprove false statements. Rather, we learned the dangers of proving a claim false. The main risk had to do with incorrectly negating a statement in order to prove the negation of a false claim. After that, we moved on to talking about the allowed inferences of proofs. All the inferences involved concepts we explicitly learned in week 6 such as proof rules for universal and existential claims, implications, and so on and so forth, so it was not hard to wrap my head around. On Wednesday, we started going over sorting strategies, and all the different kinds of sorting strategies. We discussed which strategies were the best in terms of complexity, time to sort, and the number of steps it takes to sort. I was able to understand the examples  Finally, we ended the week with a nice problem solving exercise. I think I'll detail that problem in a separate blog post very soon. Anyways, this week was a relatively easy week in terms of concepts, I was able to solve the first part in a relatively short time while working within a group. The second part I was able to figure out on my own through rigorous testing of all possible values. I have yet to tackle the third part as we had run out of time by the time I reached that problem. In terms of the steps that I took to understand this week's concepts, all I really had to do to fully understand the concepts of proofs and inferences were to just practice them. All this information will definitely help me complete assignment two.

Well that wraps up this week 7 report, I hope you guys enjoyed listening to my weekly story, and I want to hear from you. What approaches did you all have to fully understand the concepts of this week's lectures? Were you able to solve all the problems during our exercise? Let me know in the comments below. As always, words are hard, comp-sci is awesome, and later days. This is Kyle Mendoza signing out.


Tuesday 14 October 2014

CSC165 Week 5: Proof Structures and the Term Test Oh Yes

Hey everybody, this is your man Kyle here checking in to give you guys a week 5 report on what has been happening in the CSC 165 course. Sorry that this is coming up a bit late but with all everything that has been going on I haven't exactly had the time to post. Anyway, this week we started going over proofs, and the differences between the proof structures of a universal claim and an existential claim. For universal claims, I found that we had to assume a lot of aspects of a statement in order to form a proper proof. For example, we had to assume that all elements were part of a particular set, and, if there was an implication involved, that the antecedent was true (otherwise we would get a free proof due to vacuous truth). Also we could be very general and ambiguous with the examples we provided for our proofs since we were trying to prove a statement that applies to all elements of a set. For existential claims I found that we had to be much more specific and precise, explicitly naming a value that would correspond to an element and going through how that value would make the entire claim true. This was necessary since for an existential claim, it is only necessary to verify one example for the claim to be verified. In general this week's concepts was a lot easier for me to digest and learn immediately and I did not find myself needing to have to repeatedly look over the course notes in order to fully understand the concepts. I was able to understand what was being taught in a short amount of time and I was proud of that. In the middle of all of this we had our term test for this class, I found it rather easy and that it involved a lot of common sense, which, thank goodness, I had that day. The time we had to complete the test was adequate and I felt it was a good introduction to test taking at the university level.

Well that's it for this week's report friends, hope you enjoyed reading about my trials and tribulations and stay tuned for more. How was the term test for you guys? Did you find proof structures relatively simple to learn? Comment below what you guys think. Words are hard, comp-sci is awesome, and later days. This is Kyle Mendoza signing out.

Sunday 28 September 2014

CSC165 Week 3-4, Converting Symbols to English and Back Again

What's up everyone, this is just me checking back in to bring you a little weekly round up of week 3-4 of CSC165. This week was heavily based on the contents of chapter 2 in our course notes. Special emphasis was placed on converting specific English operators into symbols and vice versa. Generally, I found this week to have been very challenging compared to last week. It took me a lot longer to grasp the concepts of this week's lectures. Maybe I need more practice converting  from English to symbols and back again but I found that I had difficulty knowing when to use for all, for some, and how to incorporate implications, disjunctions and conjunctions into a symbolic statement. The tutorial definitely helped me a lot though, and I felt pretty confident that I knew what I was doing after it ended. At the end of this week professor Heap presented us with quite a difficult problem. We had to find a recursive pattern that would help us predict the number of up and down creases would be produced by folding a piece of paper left to right over and over again. This definitely made me look back and use the steps to solving a problem more rigorously and with the help of two partners we made decent headway into the problem. Though we haven't been able to come up with a full mathematical solution we essentially have a pattern and all that needs to be done now is just write up a recursive sequence for it.

Well that's it for this week's SLog report. I hope all of you have enjoyed reading about my week and comment below; did you guys have had the same difficulties as I had or  did  you just find this week easy and maybe I'm the one who needs to step it up?  Good luck with everything next week, this is Kyle Mendoza signing out.

Friday 19 September 2014

CSC165 Week 1 and 2

Hey everyone! Welcome to my blog for CSC165. This is going to be the first of many posts to be coming at you so make sure to check my blog out frequently for updates on my experiences in this course. These first few blog posts will mostly outline the material covered during the first weeks of CSC165, including topics that I couldn't understand, concepts that took me longer to understand, and things that I've learned about logic and reasoning that have made me more aware of the importance of word choice.

So for the first two weeks I was introduced to the world of advanced logic and mathematical reasoning. I have to admit that for the first two or three sections I had trouble understanding the terminology that was being taught. However, after a while I was able to catch on to all the lingo and was actually beginning to properly learn. Surprisingly I found the concepts of existential and universal claims relatively easy to understand and I was able to easily distinguish between the two and determine what was needed to either verify/falsify both claims. Also, learning about quantifiers and the way that they help specify certain claims and transform them from open sentences to statements was also very interesting. What I think I had the most difficulty understanding in the first two weeks in this course was knowing the difference between a converse and a contrapositive and knowing whether they were true and false. Also, for some statements, it was extremely challenging trying to find the antecedent and consequent when they were not obviously indicated with an "if/then" statement. To wrap this up, I find it quite unusual that a program such as computer science has a course that has hardly anything to do with technical computer programming but everything to do with the connection between English and programming language and symbols. But at the same time, I can see why I have to take it. To be a successful computer scientist, I have to be able to express myself with clarity and know when precision and ambiguity is needed. That being said, I look forward to everything that I will be learning in this course