Skip to content

Instantly share code, notes, and snippets.

@fsodogandji
Last active December 21, 2015 05:09
Show Gist options
  • Select an option

  • Save fsodogandji/6254925 to your computer and use it in GitHub Desktop.

Select an option

Save fsodogandji/6254925 to your computer and use it in GitHub Desktop.
Fibonacci calculation with matrix ...
from numpy import matrix
F = matrix('0 1; 1 1')
"""
F = [[ Fn-1 Fn ] = [[0 1]
Fn Fn+1]] [1, 1]]
"""
result = F**5
"""
[[21, 34]
F ^5 = [34, 55]]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment