Sie sind auf Seite 1von 4

Computing and Latex Assignment5

Circles and Rectangles

October 21, 2015

) Circles and Rectangles October 21, 2015 This work is a report on the class activity

This work is a report on the class activity relative to Pascal triangle and my personal observations.

k = 0:

1

k = 1:

1

1

k = 2:

1

2

1

k = 3:

1

3

3

1

k = 4:

1

4

6

4

1

k = 5:

1

5

10

10

5

1

k = 6:

1

6

15

20

15

6

1

k = 7:

1

7

21

35

35

21

7

1

k = 8:

1

8

28

56

70

56

28

8

1

k = 9:

1

9

36

84

126

126

84

36

9

1

k = 10: 1

10

45

120

210

252

210

120

45

10

1

OBSERVATIONS:

i Diagonal Property:

a) the first diagonal from left and right contains all 1

b) the second diagonal from left and from right are set of natural numbers.

1

c) The third diagonal from left and from right contains 1,3,6,10,15,21,

are triangular numbers. Tri-

angular numbers dot representation indicates a pattern that forms a triangle.for each time a row is added, the amount of dot increase.

these

d) the sum of two consecutive numbers in the third diagonal from left and from right is a square number. consider the third diagonal from left that contains the elements; 1,3,6,10,15,21,28,36,45 for this triangle written up to row ten, It can clearly be shown below that consecutive sum is a square number

1

3

6

we can see that they are all square numbers,if we continued with the addition, our sum will all be square numbers.

+ 3 = 4 + 6 = 9 + 10 = 6

ii Horizontal Property:

a) the output of row 2,3,and row 7 are all odd numbers

b) The sum of the elements in each row is 2 n where n the number of row example:

row 0 : 1 = 2 0

row one :

1 + 1 = 2 = 2 1

row two :

1 + 2 + 1 = 4 = 2 2

row three : 1 + 3 + 3 + 1= 8 = 2 3 we can see that powers of two correspond to the row number.

lets prove this observation:

(a + b) k =

k

x=0

n

k

a x b kx

let 2 = 1 + 1, we replace a and b by the two 1s

(1 + 1) k =

k

x=0

n

k

1 x 1 kx

given that x and k are real numbers, then using one as their base, we obtained 1, therefore we have:

(2) k =

k

x=0

n

k

we can see that coefficient of the pascal triangle which is the combination of the given row and the position of the element sum to a power of 2.

c) considering a given row, the corresponding element are result of 11 n , where n is the row number

for instance :

row 3 : 11 3 = 1331 = 1 3 3 1, the elements of row 3.

2

d) The sum of element in the odd position(Boxed) is equal to the sum of elements in the even posi- tion(circle) 1 + 6 + 1 (even position from 0) = 4 + 4 (odd position) = 8

1
1

1

1

1

 

1

2

1

1

3

3

1

 

4

6
6

4

1
1

n:N n:Z a[0, i] is an array of Z if a[i, j] a[0, n) then, M ax : a[i] a[j], i,j a[0, n]

The specification of Average n:N n:Z

s:

n1

a[i]

i=0

The average:

n1

i=0

n

a[i]

Specification for median n:N n:Z a=array[0, n)) of Z M = Median Maximum: n{x a|x m} = n{x a|x m}

Specification for frequency(most appearing number) n:N n:Z Frequency = {a [0, n) |a [i] = x}

Question 2. Design space

i. The pseudo for maximum procedure largest element(s, n) largest:= s{1 rbrace for p:= 2 to n d if s p} ≥ largest then largest:= s[p]

3

return(largest) end largest element

ii. The pseudo for average

a = array of N

= number of elements sum = 0 sum = sum x[i] i = i + 1 average = sum

n

n

end

iii. The pseudo median

a[i] = elements in the array are sorted

if a[i] is odd,

median = text a n+1

else:

2

median = a [ n

2

2

2

] +a [ n+2

]

iv. The pseudo for frequency elements in array must be 0 (nlogn) sorted in the case of merge declare count = 1 max count = 1 max value = array[0] iterating the array and indexing computing the elements with the elements computed before the counts are updated if they are equal else: reset back counts max value return max value

4