Archive for December, 2007


Question: Area of a Koch Snowflake

December 26th, 2007

Question: A Koch Snowflake is a fractal which can be built by starting with an equilateral triangle, removing the inner third of each side, building another equilateral triangle at the location where the side was removed, and then repeating the process indefinitely.

Find the area of a Koch Snowflake when the sides of the starting equilateral triangle has the length x.

Answer: Christmas Counting Problem

December 26th, 2007

Question: If we take the 12 days of Christmas literally, what is the total number of items you will have received at the end of the twelve days? For example, on the first day you have received one item (1 partridge), on the second day you will receive three items (1 partridge, and 2 doves), on the third day you would receive six items (1 partridge, 2 doves, and 3 french hens), etc.

Solution: From my analysis, I have come up with three different ways to count the total number of items you will have received at the end of the twelve days.

1) The first method to solve this problem is to use brute force. On the first day, we will receive 1 item. On the second day, we will receive 1 + 2 items. On the third day, we will receive 1 + 2 + 3 items. Therefore, on nth day, we will receive \sum_{i=1}^n i items. Since we want the number of items received for all 12 days, we need to calculate the following summation: \sum_{n=1}^{12} \sum_{i=1}^n i. We can easily calculate the answer with the following perl script:

$soln = 0;
 
for ($i = 1; $i < 13; $i++) {
   for ($j = 1; $j < $i+1; $j++) {
      $soln = $soln + $j;
   }
}
print $soln;

2) The second method to solve this problem is to use recursion. On the nth day, you are going to get n items plus the number of items you got the day before. Therefore, if S_n is the number of items you receive on the nth day, S_n will follow this recursive pattern:

S_n = S_{n-1} + n
S_0 = 0

In order to calculate the number of items received on all 12 days, we need to calculate the following summation: S = \sum_{n=1}^{12} S_{n-1} + n. The solution can be calculated with the following script:

$soln = 0;
$prevDay = 0;
 
for ($i = 1; $i < 13; $i++) {
   $prevDay = $prevDay + $i;
   $soln = $soln + $prevDay;
}
 
print $soln;

3) The third method to solve this problem is to group items by type instead of days. For example, you will receive 1 partridge for twelve days, 2 doves for eleven days, 3 french hens for ten days, etc. In general, this means that you will receive n items for (13 – n) days. This would mean that the total number items you would receive would be \sum_{n=1}^{12} n (13 &#8211; n). This summation can be calculated by the following script:

$soln = 0;
 
for ($i = 1; $i < 13; $i++) {
   $soln = $soln + $i*(13- $i);
}
print $soln;

In the end, however, we come back to the same solution which is 364.

Question: Christmas Counting Problem

December 21st, 2007

I am finally on Christmas vacation which has gotten me in the Christmas spirit. I thought it would be fun to have a problem related to Christmas. The problem is very easy… which is great because I’m on vacation. In order to solve this problem, you will need to be familiar with the lyrics to the 12 days of Christmas.

Question: If we take the 12 days of Christmas literally, what is the total number of items you will have received at the end of the twelve days? For example, on the first day you have received one item (1 partridge), on the second day you will receive three items (1 partridge, and 2 doves), on the third day you would receive six items (1 partridge, 2 doves, and 3 french hens), etc.

Answer: Fluid leaving a hemispherical vessel

December 20th, 2007

Question: A hemispherical vessel of radius R has a small rounded orifice of area A_0 at the bottom. If A_h \gg A_0, how much time does it require to lower the level from h_1 to h_2?

Answer: First, lets assume fluid is incompressible and has a inviscid, steady, barotropic flow. If this is the case, the rate fluid leaves the vessel will be equal to the rate the fluid drops in the vessel. Therefore,

A_h \frac{\partial h}{\partial t} = A_0 u
\therefore \frac{\partial h}{\partial t} = \frac{A_0}{A_h} u

where \frac{\partial h}{\partial t} is the rate the water level drops and u is the rate the water leaves the orifice.

Now, if we use Bernoulli’s equation, we will get:

\frac{1}{2} (\frac{\partial h}{\partial t})^2 + \frac{P_{atm}}{\rho_0} + gh = \frac{1}{2}u^2 + \frac{P_{atm}}{\rho_0}
\frac{1}{2} (\frac{A_0}{A_h})^2 u^2 + gh = \frac{1}{2}u^2

Since A_h \gg A_0, \therefore (\frac{A_0}{A_h})^2 \approx 0. Using this approximation, we find that

u = \sqrt{2gh}

Next, we will need to find A_h.

According to Pythagoras ,

R^2 = r^2 + (R-h)^2
r = (R^2 -R^2 -h^2 + 2hR)^{\frac{1}{2}} = (2hR -h^2)^{\frac{1}{2}}

Therefore,

A_h = \pi r^2 = \pi (2hR-h^2)

Now using the fact that A_h \frac{\partial h}{\partial t} = A_0 u, we have

\pi(2hR -h^2)\frac{\partial h}{\partial t} = A_0  \sqrt{2gh}
\int_{h_1}^{h_2} \pi (2 h^{\frac{1}{2}}R -h^{\frac{3}{2}})dh = \int_0^t A_0 \sqrt{2g}dt
\pi(\frac{4}{3}Rh^{\frac{3}{2}} -\frac{2}{5}h^{\frac{5}{2}}) \arrowvert_{h_1}^{h_2} = A_0 \sqrt{2g}t
t = \frac{2\pi}{A_0 \sqrt{2g}}(\frac{2}{3}R(h_1^{\frac{3}{2}}-h_2^{\frac{3}{2}}) -\frac{1}{5}(h_1^{\frac{5}{2}} -h_2^{\frac{5}{2}}))

Question: Fluid leaving a hemispherical vessel

December 16th, 2007

Question: A hemispherical vessel of radius R has a small rounded orifice of area A_0 at the bottom. If A_h \gg A_0, how much time does it require to lower the level from h_1 to h_2?