[Matrix-SIG] Fibonnaci

Yoon, Hoon (CICG - NY Program Trading) HYoon@exchange.ml.com
Tue, 25 May 1999 15:30:52 -0400


Hi, 

  Iam trying to do Fibonnaci numbers. Obviously I am trying to raise the
base matrix x to some power p, but I don't know how to do it in one step. I
would like to call something like x^34.
 
x = 
array([[ 1.,  1.],
       [ 1.,  0.]],'f')
>>> x*x
array([[ 1.,  1.],
       [ 1.,  0.]],'f')
>>> matrixmultiply(x,x)
array([[ 2.,  1.],
       [ 1.,  1.]],'f')
>>> matrixmultiply(x,matrixmultiply(x,x))
array([[ 3.,  2.],
       [ 2.,  1.]],'f')
>>> matrixmultiply(x,matrixmultiply(x,matrixmultiply(x,x)))
array([[ 5.,  3.],
       [ 3.,  2.]],'f')
>>> power(x, 3)
array([[ 1.,  1.],
       [ 1.,  0.]])
>>> power.outer(x,3)
array([[ 1.,  1.],
       [ 1.,  0.]])

Thanks much,

P.S: Does anyone have Markov Chains in NumPy?
**************************************************************
S. Hoon Yoon                   (Quant)                    Merrill Lynch
Equity Trading 
yelled@yahoo.com hoon@bigfoot.com(w)
"Miracle is always only few standard deviations away, but so is
catastrophe."
* Expressed opinions are often my own, but NOT my employer's.
"I feel like a fugitive from the law of averages."    Mauldin
**************************************************************