Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

09 December 2011

Right Triangles && Integers

Now that I'm in the world of creating exams, I find that it is helpful to keep as many integers involved as possible so that students don't get hung up on significant figures and rounding. In the end, more integers means easier grading.

Also, the problems (it's a statics class at the moment ... stupid pun) involve lots of right triangles, and one can use a 3-4-5 triangle only so many times before it becomes passé.

A little ruby spits out leg dimensions of uniquely proportioned right triangles with integer legs:

http://codepad.org/O43BQ0H0

(lookUp marks legs that are a multiple)

Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
4 x 3
12 x 5
15 x 8
21 x 20
35 x 12
40 x 9
45 x 28
55 x 48
60 x 11
72 x 65
80 x 39
91 x 60
99 x 20
105 x 88
112 x 15
132 x 85      ***
140 x 51      ***
165 x 52
168 x 95
180 x 19
195 x 28

13 May 2008

flickr, java, ruby... [geek]


Substrate
Originally uploaded by jared
So I was inspired (thanks, Ben) the other day by this snake. So I dug a bit deeper to find the original Processing java environment, and was immediately reminded of all the visualization intentions I had had a long time ago. Forward ahead a Sunday and two movies later (Hitman and Children of Men) and I had implemented a midi library to read signals from Ableton Live and my xboard, then display those visually thru Processing.

Today I managed to get a Ruby script to read my latest flickr post. This ruby wrapper for the flickr api is very simple to use, albeit far from complete. So now, combining the amazing powers of ruby and processing, I have a stupid li'l setup that gets live feeds from my flickr which get visualized and can be messed with in real time using midi signals from my controller and ableton live.

Next up: getting my wiimote hooked up to this mess. It's been a fun week.