I mentioned another collection earlier here.
Archive for November, 2012
Posted by Ed on November 22, 2012
Posted by Ed on November 22, 2012
If you want to improve your programming skills, I highly recommend Topcoder. Unlike projecteuler which is heavy on number theory Topcoder focuses on algorithm design. In the live competitions you are given three problems that you can try to solve within a time limit. There are two divisions. Division 2 is for beginners whereas Division 1 is for those with a higher ranking.
You do not have to participate in the competitions. You can also just use the archive to practice:
– Go to the problem archive.
– Click on Div2 Success Rate. This will sort the problems from easy to hard. You can then start working on the problems where the difficulty gradually increases.
– After compiling, testing and submitting your solution don’t forget to run the system test. For this, click on Practice Options -> Run System Test.
– Browse through other people’s solution and learn new tricks. This is a nice feature on Topcoder.
After some practice you should compete in one of the live competitions. First, it is very exciting and fun. Second, you learn to write correct code fast. Third, you read other people’s code during the challenge phase.
By the way, Mark Zuckerberg also has a profile on topcoder.
Posted by Ed on November 20, 2012
In this blog post we will derive a formula for the interior angle of an n-sided regular polygon. We will examine how depends on n. This allows us to draw the regular polygon.
A regular polygon is a figure whose sides have the same length (equilateral) and whose interior angles are equal (equiangular). Let’s draw one with 3 sides. We can easily construct it if we know the interior angle . For the triangle it is = 60°.
Let’s do the same for a square, for which the interior angle is = 90°.
Now, can we do the same for a pentagon (5 sides)? What about a 13 sided regular polygon?
Obviously, we could if we knew how to choose . Before you continue reading you may want to ponder how to determine the internal angle. So, spoilers ahead.
We have two equations.
We solve (2) for : (3)
Plug (3) into (1): (4)
Multiply (4) by n: (5)
Substract 2*180° on both sides: (6)
Divide by n: (7)
This is the interior angle for an n-sided regular polygon.
1) Show that the formula is correct for the triangle and the square.
2) What is the interior angle for the pentagon?
3) What is the sum of all interior angles in a 7-sided regular polygon?
4) What is the sum of all interior angles in an n-sided regular polygon?
5) What happens with the interior angle if you make n bigger and bigger?
1) Before we derived the formula we already knew that the interior angles are 60° and 90° respectively for the triangle and square. Let’s check if the formula gives us these values.
For the triangle we set n=3 and get .
For the square we set n=4 and get .
2) For the pentagon we set n=4 and get .
3) and 4) The sum of all interior angles in an n-sided regular polygon is . For a 7-sided regular polygon we set n=7 and get .
5) If we make n bigger and bigger, the value for approaches 180°. We can express this with the limit:
Posted by Ed on November 9, 2012
Recently, I’ve been reading the Wallstreet Journal. I particularly enjoy reading the section on life, health and work at the end. Here are two articles that I like:
Posted by Ed on November 8, 2012
CodingBat offers some nice problems to test your programming skills in Java and Python. They are particularly suited for beginners. Some harder problems deal with recursion.