Friday, April 5, 2013

Pizza Problem!!! Yum! :p

You are part of a group of friends who choose which to treat to lunch in the following manner:
1. They arrange themselves in an (approximate) circle.
 
2. They begin reciting the positive natural numbers, in order, in a counter-clockwise     direction (viewed from above), starting with the friend at the northern extreme of the circle (who utters "one").
 
3. As a friend utters an even number, he or she is eliminated from the counting (and consideration for lunch). The counting "wraps around" so that those who avoided one of the dreaded even numbers on the first round may be exposed on subsequent rounds.
4. The last person left is treated to lunch.

For example, if there are friends f1, f2, f3, f4, and f5 arranged counter-clockwise, with f1 at the northern extreme, the first round would eliminate f2 and f4. Then f1 and f5 would be eliminated in the next round, leaving f3 to enjoy the free lunch.

If there are n friends, where should you position yourself to get the free lunch? Do you have a technique that will work for any positive natural number n?

This is a problem on Professor Heap's Wiki and it was actually fun trying to come up with a solution :D

                                      ****So this is the pattern that I noticed:*****

There are specific numbers that correspond to a friend who is going to win

(ie.if n = 3, f3 wins)

and these numbers make a pattern where the next number to hold this similarity would be equal to
2(n) +1. This forms a geometric sequence {3,7,15,31...}. Then for the rest of the numbers, n, that don't fit in this sequence the friend who wins is equal to n, subtract the distance from the closest number in the geometric sequence (greater then n).

The Procedure for figuring out who wins:


1. Find the closest number in the geometric sequence {3,7,15,31...} of which have a difference of 2k + 1, where k is the previous number in the series.

2. Take a number, n, and subtract its distance from the closest number greater than it in the above series. That gives you the number of the friend who wins the pizza. If n is within the above sequence, then friend n wins.
Examples:

n = 5, f3 wins

n = 18, f5 wins

n = 15, f15 wins

So remember this game the next time you have only 1 pizza slice left and a bunch of hungry friends!!! Note. You can't have n < 3 because then you don't have a proper "circle".





Wednesday, April 3, 2013

Helpful Hints for Assignment 3!

Hello everyone!! The due date is fast approaching for A3 and here are some helpful hints for anyone who is still completing the assignment.

**For questions 3 and 4:
Remember that l'Hôpital's rule can be used to evaluate limits in the indeterminate form...
Meaning if the numerator and denominator both either tend to ∞ or both attend to 0, then simply find the limit of the individual derivatives. In other words...

  lim  f(x) / g(x) =  lim derivative of f(x) / derivative of g(x)
n->  ∞                 n->

You can even find it for the second derivative and third derivative and so on

** For question 5:
We are assuming that true_that works and has been coded...no need to do that
The halt function returns true if the function we are reducing to returns true and vice versa.
It may be helpful to use another function as well, one that can halt :p

Here is also a link to most of the symbols used in the assignment, except for positive reals
http://en.wikipedia.org/wiki/List_of_mathematical_symbols





Monday, April 1, 2013

Navel Gaze ???

The recent lectures have been a little mind-boggling to understand, and have made my brain
halt a little.hahaha :D .........It's a joke...
Well then, Professor Heap mentioned how a function can be called within another function:
ie.
def f(x):
   def g(x):
      blah....

well I've never seen that ever in past programming classes but it is interesting that we never really
notice it but we actually do use it...I mean to say, that when we use a for loop in our functions that we call we often use the len(x) function and Yah Mon it's another function :)

I'll try talking a little about this week's assignment and more about upper/lower bounds and such in the next post...cheerio!!

Tuesday, March 26, 2013

Bounded below or above or both

It's been a while...sorry for that!
 I have personally found the course quite challanging. The exam for csc165 is on
April 25th and happens to be my final exam for the semester, but don't get your knickers in a knot so fast :)
       Yes, there is some time until that exam...about 1 month to be exact, but it would be benificial to start studying now. What I have found, especially during the first test was that by working on problems only about a week before didn't help. Just like math, or any other course that you might be taking, it requires a lot of practice to fully understand the material. I'm sure everyone wants to do well, and I'd like to share what I think would be important to study/practice...
Basically there are two parts to the course:

The first on the basics of implication, and general "tools" that help in proofs, the second part of the course (Yeah, proofs are important!!).
Some advice...
1. Go through the basics, only then will you be able to harder questions(go and understand, and practice all material before proofs)
2. Do all proofs online without peeking (don't do it) at the solutions
**Proofs- look at pages 23-28 in the online practice questions pdf again no peeking and practice all proofs on lecture notes.
     a) asymptotics, looking at python code.
     b) big-oh, big-omega, big-theta ie. bounding above and below or both.


2. Read the lecture notes, make own personal study sheets (They really help!)

4. Go throught the course notes,

Yes the course notes are quite detailed in explaining the material taught within this course...but I think more attention should be made towards doing practice questions and only resorting to the online tb if you don't understand a certain concept.

Right now we're learning about upper bounds and lower bounds and associated proofs...so stay tuned for further blogs about that :D

Tuesday, January 15, 2013

Hello Everybody!

HEY HEY HEY IT'S COOLIO123!!!!!!!!!!!!!!!!!!!!!!!!!!!! :P

Yah I'm very excited to write blogs for everyone to see!

being my first blog ever, there are thousands of things i want to tell 
you guys all about, but first off let me talk about how the first week
of CSC165H1 went...

1st. I've never seen the upside down 'A' symbol and hope to get familiar
with it in the future

2nd. Venn diagrams are a great way to learn for some people...that
includes me as I am a visual learner

3rd. I'm also happy I've got to know some new people in the class :D

4th. I hope this will be an awesome and productive semester!!