Pages

Friday, April 29, 2011

From the people who brought you this video, watch this video!



So good! In so many ways! I love it! The moustaches! The rhetoric! The people in suits dancing like rappers (which I suppose they are, by the strictest legal definition)! The integration of quotes from the classic works into jibes!

"What I've learned is how little we know,
The world is complex, not some circular flow.
The economy's not a class you can master in college,
to think otherwise is the pretense of knowledge."

And oh the sweet, sweet rhyme!

Some subtle, and I think probably effective propaganda (for the side I like, so its ok) is at the end: the the crowd of people eager to congratulate and speak with Keynes are suited, older-white-dude types. The Bernanke-clone among them, they're calculated to look like power-brokers. The people extending their hands to shake Hayek's are young men and women dressed less expensively and with the general appearance of being students. They did a nice job with that, I think.

Thursday, April 7, 2011

And more!



So the answer to the question in my previous post turns out to be: it depends. It depends on what you mean by "the same idea as Pascal's triangle, but in three dimensions," which boils down to how you want to define adjacency. Pascal's triangle adds the two numbers that are "above" it in the two-dimensional triangle (which is skewed sideways if you write it in a grid). So if you're making a pyramid on a grid, what counts as the numbers "above" a number? is it all nine (ie: n,s,e,w, nw,ne,sw,se, and directly above)? Or is it just the four at the cardinal directions plus the one directly above?

If you choose the former, the sum of each level of the pyramid produces the powers of nine. If you choose the latter, its the powers of five. This is unsurprising in retrospect; the series of powers you will produce depends on the number of neighbors you define as adjacent to the central cell. Ie: 9 way adjacency produces the powers of nine.

Come to think of it, making the pyramid on a square grid isn't necessarily the next logical step from the original Pascal's triangle. You could make a triangular grid (though not with a spreadsheet; not easily anyway), which would give you four neighbors, presumably resulting in the powers of four.

Or you could do an octagonal grid, which would give you 9 neighbors and the powers of 9 again. Come to think (further) of it, that's essentially what you're doing when you define adjacency in the first way above (ie; nine-way adjacency).

(note: each square is intended to be stacked on top of the one below it, forming the pyramid. )







9-way adjacency













5-way adjacency










1

sum





0 0 0




sum





0 0 0



2

1





0 1 0




1





0 1 0



3








0 0 0











0 0 0



































1







0 0 0 0 0









0 0 0 0 0


2







0 1 1 1 0









0 0 1 0 0


3

9




0 1 1 1 0



5




0 1 1 1 0


4







0 1 1 1 0









0 0 1 0 0


5







0 0 0 0 0









0 0 0 0 0


































1






0 0 0 0 0 0 0







0 0 0 0 0 0 0

2






0 1 2 3 2 1 0







0 0 0 1 0 0 0

3






0 2 4 6 4 2 0


25



0 0 2 2 2 0 0

4

81



0 3 6 9 6 3 0







0 1 2 5 2 1 0

5






0 2 4 6 4 2 0







0 0 2 2 2 0 0

6






0 1 2 3 2 1 0







0 0 0 1 0 0 0

7






0 0 0 0 0 0 0







0 0 0 0 0 0 0

































1





0 0 0 0 0 0 0 0 0





0 0 0 0 0 0 0 0 0
2





0 1 3 6 7 6 3 1 0





0 0 0 0 1 0 0 0 0
3





0 3 9 18 21 18 9 3 0





0 0 0 3 3 3 0 0 0
4





0 6 18 36 42 36 18 6 0

125


0 0 3 6 12 6 3 0 0
5

729


0 7 21 42 49 42 21 7 0





0 1 3 12 13 12 3 1 0
6





0 6 18 36 42 36 18 6 0





0 0 3 6 12 6 3 0 0
7





0 3 9 18 21 18 9 3 0





0 0 0 3 3 3 0 0 0
8





0 1 3 6 7 6 3 1 0





0 0 0 0 1 0 0 0 0
































9





0 0 0 0 0 0 0 0 0





0 0 0 0 0 0 0 0 0

































What better use of Spreadsheet mastery could there be but to solve curiosities about mathematical constructs? I know, right? Oh and look at the beeeauuutiful surface it makes in 3d!


One final question: what powers can be produced in this way; ie by the concept of "adjacency"? So far we've seen 2, 5, 9, and conjecturally 4. Can three be done? How bout six, seven, and eight?
I suppose it depends on how wedded you are to the concept of a regular geometric grid? Could a more abstract geometry accomplish those other power series?

Pascal's Triangle

I just made a rather interesting discovery: in Pascal's triangle, the sum of the ith row is equal to the i-1th power of 2.
Row
Sum
Pascal's triangle:
1
1
0
1
0
0
0
0
0
0
0
0
0
0
2
2
0
1
1
0
0
0
0
0
0
0
0
0
3
4
0
1
2
1
0
0
0
0
0
0
0
0
4
8
0
1
3
3
1
0
0
0
0
0
0
0
5
16
0
1
4
6
4
1
0
0
0
0
0
0
6
32
0
1
5
10
10
5
1
0
0
0
0
0
7
64
0
1
6
15
20
15
6
1
0
0
0
0
8
128
0
1
7
21
35
35
21
7
1
0
0
0
9
256
0
1
8
28
56
70
56
28
8
1
0
0
10
512
0
1
9
36
84
126
126
84
36
9
1
0
11
1024
0
1
10
45
120
210
252
210
120
45
10
1
I was trying to remember how the construction of the triangle was done in LISP yesterday on the bus, and I decided this morning to try and figure out how to do it in Excel. Its extreamly easy in Excel, of course.


Added: ooooh, heres a fun question: if you made a "Pascale's Pyrimid" (ie, same idea but in three dimensions) what series would the sums of each layer make? Would it be the powers of three? If that turns out to be true, could it be generalized to n dimensions?

mmmystery


Out of further curiosity, I plotted the rows of Pascal's triangle. The result is a series of curves that look decidedly Gaussian, though with the center shifting leftwards. I remember one of my calculus teachers saying that he had been fascinated with Pascal's triangle as a young studnet because of its many interesting and strange attributes, and he said it was the thing that got him interested in math. Indeeeed.

Perl

I've also been learning Perl in my spare time, since its the only programming language it seems I can use at work. Well, aside from Java and VBA, but I mean for command line stuff. I'm studying the book thats available for free on the Perl website, and one of the excercises suggested i figure out how to convert decimal to binary using eight bitwise "and" operators. I figured it out (mostly) myself, thoguh I used a hint about the binary representation of the powers of two. Check it out, I think its a pretty clever hack.
#!/usr/bin/perl
#dec2bin.plx
use warnings;
use strict;
print "Enter a decimal number ";
my $num=;
print(
($num & 128) <=> 0,
($num & 64) <=> 0,
($num & 32) <=> 0,
($num & 16) <=> 0,
($num & 8) <=> 0,
($num & 4) <=> 0,
($num & 2) <=> 0,
($num & 1) <=> 0,
"\n");
It works becuase Perl converts all numebrs into their binary representation, and the bitwise "and" operator compares numbers bit by bit. The binary representations of the powers of 2 all start with 1 and the rest are zeros. So you build up a string that becomes a binary number by &'ing each of the powers of two as high as needed, as these get compared with the binary representation of the input number. Its not the most straightforward way, especially since the input number is apparently already being used in binary internally, but neat none the less.