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
No comments:
Post a Comment