11001110 Ruby 11001110
Saturday, May 12, 2012
Judea Pearl
Judea Pearl is the newest winner of the Turing Award.
Judea Pearl's studies and advancements range from in artificial intelligence to philosophy
I recently listened to 1hr 41min interview by Stephen Ibaraki on behalf of ACM here are the highlights
Education:
Counterfactuals:
Success:
Friday, May 11, 2012
3: First Order Recurrence Relations
Check out the project description here
First Order what?
First order recurrence is a type of a recursive equation that can be . The following equations have first order recurrence relations:
The Code
Due to the fact that my professor usually gives us read-in-files contain similar formats I decided to make a master parsing class that you can look at on github if you want.
First Order what?
First order recurrence is a type of a recursive equation that can be . The following equations have first order recurrence relations:
- The coefficients are constants and only to the first power
- The nth term depends only on term ( n - 1 )
- General Form: S(n) = cS( n - 1 ) + g(n)
- S(n) = Cn-1S(1) + nΣi=2 [ Cn-i * g(n) ]
- Original: S(n) = 2*S( n - 1 ) + 3
- Becomes: S(n) = 2n-1 * S(1) + nΣi=2 [ 2n-i * 3 ]
The Code
Due to the fact that my professor usually gives us read-in-files contain similar formats I decided to make a master parsing class that you can look at on github if you want.
- The code doesn't contain anything fancy.
- I love ruby's exponent operator **
- I love ruby's for loops
Monday, May 7, 2012
2: Second Order Recurrence Relations
Second Order What?
Second Order Recurrence Relations is a fancy way of saying, if recursive equation meets a specific criteria, it can be reduced to a no recursive equation.
Requirements:
Example:
S(n) = 2S( n - 1 ) + 3S( n - 2 )
S(1) = 3
S(2) = 1
Second Order Recurrence Relations is a fancy way of saying, if recursive equation meets a specific criteria, it can be reduced to a no recursive equation.
Requirements:
- The nth term depends on the two previous terms
- Constant coefficients with exponents no greater than 1
- Must be homogeneous ( g(n) == 0 )
- General form: S(n) = C1S( n - 1 ) + C2S( n - 2 )
- Find the roots of t2 - C1t - C2 = 0
- r1 & r2
- Solve for p & q
- S(1) = p + q
- S(2) = p( r1 ) + q( r2 )
- Plug answers in the solution formula
- S(n) = p( r1 )n - 1 + q( r2 )n - 1
Example:
S(n) = 2S( n - 1 ) + 3S( n - 2 )
S(1) = 3
S(2) = 1
- t2 - 2t - 3 = 0
- r1 = 3
- r2 = -1
- Solve for p & q
- 3 = q + p
- p( 3 ) + q( -1 ) = 1
- p = 1
- q = 2
- Substitute
- S(n) = 1( 3 )n-1 + 2( -1 )n-1
- line 10: Love how you can simultaneously assign variables from an array
- Line 36: This isn't a true quadratic formula. It takes advantage of the fact that a == 1in all cases
- I added a master parse file
- I love the ||= assignment, this is amazing. It will only assign the variable if it doesn't exist
Sunday, April 29, 2012
Sync RVM with TextMate
I've been trying to sync TextMate with RVM found this tutorial extremely helpful.
Basic Process:
Basic Process:
- Print path to RVM-AUTO-RUBY ( the exec file that runs the default interpreter set by rvm )
- Unix command: $ which rvm-auto-ruby
- Copy path to TextMate's preferences
- Print out path to current ruby interpreter
Tuesday, April 24, 2012
1: Programming Review
Project description.
Concerns
- line 21: I'm not sure if this is the best way to check the command line inputs and save them.
- line 27: I feel like there should be a way to combine this with line 24? like or die in perl
- I can't believe the there aren't any Math.sum Math.average or Math.median functions but I do like the way you can easily insert methods into a core class ( line 1 - 11 )
- line 31 - 36: I swear I've heard of an cleaner way to parse in a file, but my solution works
- line 40: I'm not really sure what ensure does
- line 2: inject(:+) ??? what the crap? this is cool, but not intuitive at all. Someone please explain
- I could make it a little more object oriented by making a print result method ... but meh
Blog init
Blog.what?
Here are some sample projects from my CIS 206 Discrete Mathematics class. The course is taught by Geoffrey Draper at BYU-Hawaii. In our class, we are permitted to program in any language of our choice. I've decided to take advantage of that freedom to try and learn Ruby. I'm using Ruby 1.9.2
Blog.why?
I've decided to blog my projects for the following reasons:
Here are some sample projects from my CIS 206 Discrete Mathematics class. The course is taught by Geoffrey Draper at BYU-Hawaii. In our class, we are permitted to program in any language of our choice. I've decided to take advantage of that freedom to try and learn Ruby. I'm using Ruby 1.9.2
Blog.why?
I've decided to blog my projects for the following reasons:
- My programs will be helpful to others who learn Ruby
- People's comments will help me learn Ruby faster
- It's a personal programming journal
Subscribe to:
Posts (Atom)