Sunday, October 28, 2012

Storage and DrRacket




         As usual, I find the hardware part of this course is harder for me than the operation of DrRacket. The lecture in this week is about hardware architecture. Our professor explained how different hardware saves data in their storage. I took some time to understand the load instruction by recalling the carry-in and carry-out principle in the previous class. However, I didn't really get the storage of hard drive. The only thing I got was the speed of hard drive is a major shortage compared to the other types of hardware. After class, I read over the extra notes online. It is helpful, and explains everything in a detailed way. 

         Regarding DrRacket, it is the second time to use the "cond" command. The first time was when the professor did the animation of clock in class. He used the "cond" command to define different keys of stopping the clock. I checked the file of the clock again in order to have a better understanding about how the "cond" command works. The "cond" command means that I can create some simple rules to let computers work with. So the computers can produce something particular or something else according to the rules.

Sunday, October 21, 2012

Algorithm Questions



Algorithm Questions

         Before this week's lecture, I attempted to solve the problem of folding paper, but I failed. After the lecture, I tried it again, and applied what our professor taught us in lecture. I created a plan, and I was ready to accept that it would be wrong. To my surprise, it works. I checked this way several times to make sure it is correct. However, if you find I am wrong, please leave me a comment to inform me that. Here is my way of solving this problem. (It is a little bit long.)
         First of all, I want to know how many creases the paper contains corresponding to how many times I fold it. I made a table for these numbers.
         #Time #Creases
   1       1
         2       3
         3       8
         4       15
         Then I found that the number of creases is (2^n)-1, where n is the nth time of folding the paper.
         So
         #Time #Creases
   1       2^1-1=1
         2       2^2-1=3
         3       2^3-1=8
         4       2^4-1=15

         Secondly, I want to find the pattern of creases. I made another table.
         #Time #Pattern
         1       D
         2       uDd
         3       uudDudd
         4       uuduuddDuuddudd
         Each row of characters is symmetrically opposite due to the way of folding the paper (Every time you fold the paper from left to right). Each row has a central character which must be D. The last character of each row must be d. Besides that, I discovered that the right side of nth row's D is exactly the entire row of n-1.
         I applied the rules which I discovered to find the 5th row.
         It should be (uuduudduuuddudd D uuduuddduuddudd).
         You don't have to write everything until the fourth row to find the fifth row. As I mentioned, each row of characters is symmetrically opposite. So the right side of each row is also symmetrically opposite. If you want to know the fifth row, you can make a table like the one below.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31















D







D



D

D
d
         After that, you can just plug in all the characters which are opposite to the right side of each D.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31















D
u
u
d
u
u
d
d
D
u
u
d
D
u
D
d
         You will ultimately get the same answer, which is (uuduudduuuddudd D uuduuddduuddudd).
         Please let me know if I made any mistakes, thanks a lot.

Sunday, October 14, 2012

Algorithm and DrRacket



         After the term test, we started learning algorithm, which means a simple sequence of feasible steps to solve a problem. I really like this part of teaching. Our professor used different examples to demonstrate how algorithm works in mathematical world and daily life. The steps of making a peanut butter jam sandwich and folding a piece paper greatly helped me understand that human-beings actually use algorithm to solve problems every moment in their mind. It doesn’t matter whether those problems are math problems or not. Algorithm is just a logical and effective way of thinking.

        As what I mentioned in my last article, DrRacket is easy and interesting for me. Now this situation changed. It is still interesting, but it is not easy anymore. Many new commands appear with their different functions. The process of manipulating images becomes complicated and challenging. I always get stuck when I define something. After I click “run”, the results are not what they should be. Finally I realized the importance of writing a statement and doing the “check-expect” command. I used to skip and ignore them when I was doing the tutorial exercises on my own. I begin to do the statement and the “check-expect” command carefully. Then I am clear about everything I am going to do. So I strongly recommend you to do the statement and the “check-expect” if you skip these things just like me before. To be honest, I sometimes feel good when our professor makes mistakes in class because I can tell myself I am not the only one who occasionally messes up everything in DrRacket.