Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004

Nonstandard matrix representation of continued fractions

In this workbook I will show matrix representation of continued fractions (CF) different from typical one. In typical representation, two matrix L, and R are used. On the Stern-Brocot tree ( SBTree) representation of CF, matrix R decodes move to the right child and L move to the left child of given SBTree node. We may call it RL representation of CF.

Representation below gives other, complementary picture, where matrix S means "reverse direction" whilst matrix T means "go step forward".I will call it S(ST) representation for te reasons which will be explained below.

Matrix representations of CF, both RL representation and S(ST) form monoids. For monoid S(ST) I wil define ring over rational numbers, with generators I,S,T,L where I is identity matrix, S,T are defined below, and L=ST-TS = [S,T] where [.,.] means "commutator in the ring". Every matrix M representing given CF may be decomposed in the ring Q[S(ST)] into the form M = a*I+b*S+c*T+d*L . Requirement that det(M) = +-1 gives us quadratic form in the vector space [a,b,c,d] which means that every four "a,b,c,d" representing CF lays on quadric with given below equation.

Lets define matrices which will be used below:

S=matrix([[0,1],[1,0]]);S
[0 1] [1 0]
T=matrix([[0,1],[1,1]]);T
[0 1] [1 1]
I=matrix([[1,0],[0,1]]);I
[1 0] [0 1]
G=S*T;G
[1 1] [0 1]

CF of x=[a0,a1,a2,...an]x = [a_{0},a_{1},a_{2},...a_{n}] may be represented as formula: Sprod(SGiai1..len(x))S*prod(S*G^a_{i} i \in 1..len(x)). For example (please, note the exponents of G in formula below) :

S*S*G^(1)*S*G^(2)*S*G^(3)
[ 3 10] [ 2 7]
CFF(10/7)
[1, 2, 3]
#Lets define function which for given CF x= [a0...an] return matrix of the form S*prod(S*G^an n in 1..len(x)) def MCFFR(x): #x - real number s=matrix([[0,1],[1,0]]) t=matrix([[0,1],[1,1]]) g=s*t return s*prod(s*g^CFF(x)[n] for n in range(len(CFF(x))))

For  π\pi we obtain:

MCFFR(pi)
[ 5419351 80143857] [ 1725033 25510582]
float(80143857/25510582)
3.1415926535897922
CFF(43/30)
[1, 2, 3, 4]
MCFFR(43/30)
[10 43] [ 7 30]

Matrices S, T and G has several interesting properties:

S^2;S^2==1
[1 0] [0 1] True
T^2;T^2==S^2+T
[1 1] [1 2] True

Teraz komutatory S,T,G:

L=S*T-T*S;L
[ 0 1] [-1 0]
X=S*G-G*S;X
[-1 0] [ 0 1]
Y=T*G-G*T;Y
[-1 -1] [ 0 1]
S*X;S*X==L
[ 0 1] [-1 0] True
T*Y;T*Y==L
[ 0 1] [-1 0] True

And another interesting relations:

S*T;S*T==G
[1 1] [0 1] True
L^2;L^2==-1
[-1 0] [ 0 -1] True
X^2;X^2==1
[1 0] [0 1] True
Y^2;Y^2==1
[1 0] [0 1] True
X*Y;X*Y==G
[1 1] [0 1] True
S*L;S*L==X
[-1 0] [ 0 1] True
S*X ==L
True
S*Y == L*G
True
L*G
[ 0 1] [-1 -1]
T*S
[1 0] [1 1]
G^2
[1 2] [0 1]
(S^2-X)*S +S^2 == G^2
True
T*G == S*G^2
True
T*L
[-1 0] [-1 1]
T*X
[ 0 1] [-1 1]
G*T == S+G
True
G*L == G*S*X
True
G*X
[-1 1] [ 0 1]
G*Y == X
True
L*S == -X
True
L*T == -Y
True
L*G==S*Y
True
L*X == S
True
L*Y == T
True
X*S == -L
True
X*T == -S*Y
True
X*G ==Y
True
X*L == -S
True
X^2
[1 0] [0 1]
X*Y == G
True
Y*S
[-1 -1] [ 1 0]
Y*T
[-1 -2] [ 1 1]
Y*G
[-1 -2] [ 0 1]
Y*L
[ 1 -1] [-1 0]
Y*X
[ 1 -1] [ 0 1]
Y^2
[1 0] [0 1]

***************************************

I would like to buld ring Q[{I,S,T,L}] over rational numbers and construct multiplication table of coefficeints  gigj=Ci,jkgkg_{i}*g_{j}=C^{k}_{i,j}*g_{k} where summation over repeating indices is assumed, and gi{I,S,T,L}g_{i} \in \{ I,S,T,L \} . In order to do so, I will have to solve several linear systems od equations for Ci,jkC^{k}_{i,j}

***************************************

var('a,b,c,d');
(a, b, c, d)
m=a*I+ b*S+c*T-L;m
[ a b + c - 1] [b + c + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c);
[]
%latex Equation above means that L is independent of {I,S,T} matrices. That means that L has to be one of elements of the base of the Q[S(ST)] ring
m=a*I+ b*S+c*T+d*L-S^2;m
[ a - 1 b + c + d] [b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 0, c == 0, d == 0]]
#which means that S^2 == I;
True
m=a*I+ b*S+c*T+d*L-T^2;m
[ a - 1 b + c + d - 1] [b + c - d - 1 a + c - 2]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 0, c == 1, d == 0]]
#which means that: T^2==I+T;
True
m=a*I+ b*S+c*T+d*L-S*T;m
[ a - 1 b + c + d - 1] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (1/2), c == 0, d == (1/2)]]
#which means that: S*T==I+(1/2)*S+(1/2)*L;
True
m=a*I+ b*S+c*T+d*L-T*S;m
[ a - 1 b + c + d] [b + c - d - 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (1/2), c == 0, d == (-1/2)]]
#which means that: T*S == I +(1/2)*S - (1/2)*L;
True
m=a*I+ b*S+c*T+d*L-L^2;m
[ a + 1 b + c + d] [b + c - d a + c + 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == 0, c == 0, d == 0]]
#which means that: L^2 == -1*I;
True
m=a*I+ b*S+c*T+d*L-S*L;m
[ a + 1 b + c + d] [b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == -2, c == 2, d == 0]]
#which means that: S*L==-1*I-2*S +2*T;
True
m=a*I+ b*S+c*T+d*L-L*S;m
[ a - 1 b + c + d] [b + c - d a + c + 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 2, c == -2, d == 0]]
#which means that: L*S==I+2*S-2*T;
True
m=a*I+ b*S+c*T+d*L-T*L;m
[ a + 1 b + c + d] [b + c - d + 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == (-5/2), c == 2, d == (1/2)]]
#which means that: T*L == -1*I -(5/2)*S +2*T +(1/2)*L;
True
m=a*I+ b*S+c*T+d*L-L*T;m
[ a - 1 b + c + d - 1] [ b + c - d a + c + 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (5/2), c == -2, d == (1/2)]]
#which means that: L*T==I+(5/2)*S -2*T +(1/2)*L
True
m=a*I+ b*S+c*T+d*L-S*X;m
[ a b + c + d - 1] [b + c - d + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 0, c == 0, d == 1]]
#which means that: S*X==L;
True
m=a*I+ b*S+c*T+d*L-X*L;m
[ a b + c + d + 1] [b + c - d + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == -1, c == 0, d == 0]]
#which means that: X*L == -S
True
m=a*I+ b*S+c*T+d*L-S*G;m
[ a b + c + d - 1] [b + c - d - 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 0, c == 1, d == 0]]
#which means that: S*G == T;
True
m=a*I+ b*S+c*T+d*L-S*Y;m
[ a b + c + d - 1] [b + c - d + 1 a + c + 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 1, c == -1, d == 1]]
#which means that: S*Y == S-T+L;
True
m=a*I+ b*S+c*T+d*L-T*G;m
[ a b + c + d - 1] [b + c - d - 1 a + c - 2]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == -1, c == 2, d == 0]]
#which means that: T*G == -S+2*T;
True
m=a*I+ b*S+c*T+d*L-T*X;m
[ a b + c + d - 1] [b + c - d + 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == -1, c == 1, d == 1]]
#which means that: T*X == -S +T +L;
True
m=a*I+ b*S+c*T+d*L-T*Y;m
[ a b + c + d - 1] [b + c - d + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 0, c == 0, d == 1]]
#which means that: T*Y==L;
True
m=a*I+ b*S+c*T+d*L-L*G;m
[ a b + c + d - 1] [b + c - d + 1 a + c + 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 1, c == -1, d == 1]]
#which means that: L*G == S -T +L
True
m=a*I+ b*S+c*T+d*L-L*X;m
[ a b + c + d - 1] [b + c - d - 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == 1, c == 0, d == 0]]
#which means that: L*X == S;
True
m=a*I+ b*S+c*T+d*L-G*S;m
[ a - 1 b + c + d - 1] [b + c - d - 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 2, c == -1, d == 0]]
#which means that: G*S == I+2*S -T;
True
m=a*I+ b*S+c*T+d*L-G*T;m
[ a - 1 b + c + d - 2] [b + c - d - 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (3/2), c == 0, d == (1/2)]]
#which means that: G*T == I +(3/2)*S +(1/2)*L;
True
m=a*I+ b*S+c*T+d*L-G*L;m
[ a + 1 b + c + d - 1] [b + c - d + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == -1, c == 1, d == 1]]
#which means that: G*L == -I -S +T+L;
True
m=a*I+ b*S+c*T+d*L-G*G;m
[ a - 1 b + c + d - 2] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 1, c == 0, d == 1]]
#which means that: G*G == I+S+L
True
m=a*I+ b*S+c*T+d*L-G*X;m
[ a + 1 b + c + d - 1] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == (-3/2), c == 2, d == (1/2)]]
#which means that: G*X == -I -(3/2)*S +2*T+(1/2)*L
True
m=a*I+ b*S+c*T+d*L-G*Y;m
[ a + 1 b + c + d] [b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == -2, c == 2, d == 0]]
#which means that: G*Y == -I -2*S +2*T
True
m=a*I+ b*S+c*T+d*L-X*T;m
[ a b + c + d + 1] [b + c - d - 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 0, b == -1, c == 1, d == -1]]
#which means that: X*T == -S+T-L
True
m=a*I+ b*S+c*T+d*L-X*G;m
[ a + 1 b + c + d + 1] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == (-5/2), c == 2, d == (-1/2)]]
#which means that: X*G == -I -(5/2)*S + 2*T -(1/2)*L
True
m=a*I+ b*S+c*T+d*L-X*Y;m
[ a - 1 b + c + d - 1] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (1/2), c == 0, d == (1/2)]]
#which means that: X*Y == I+(1/2)*S +(1/2)*L
True
m=a*I+ b*S+c*T+d*L-Y*S;m
[ a + 1 b + c + d + 1] [b + c - d - 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == -1, c == 1, d == -1]]
#which means that: Y*S == -I -S +T -L
True
m=a*I+ b*S+c*T+d*L-Y*T;m
[ a + 1 b + c + d + 2] [b + c - d - 1 a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == (-5/2), c == 2, d == (-3/2)]]
#which means that: Y*T == -I -(5/2)*S +2*T -(3/2)*L
True
m=a*I+ b*S+c*T+d*L-Y*L;m
[ a - 1 b + c + d + 1] [b + c - d + 1 a + c]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == 0, c == -1, d == 0]]
#which means that: Y*L == I -T;
True
m=a*I+ b*S+c*T+d*L-Y*G;m
[ a + 1 b + c + d + 2] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == -1, b == -3, c == 2, d == -1]]
#which means that: Y*G == -I -3*S +2*T -L
True
m=a*I+ b*S+c*T+d*L-Y*X;m
[ a - 1 b + c + d + 1] [ b + c - d a + c - 1]
solve([m[0,0],m[0,1],m[1,0],m[1,1]],a,b,c,d);
[[a == 1, b == (-1/2), c == 0, d == (-1/2)]]
#which means that: Y*X == I -(1/2)*S -(1/2)*L
True
#And the last one: Y^2 == I
True

Reasumming - the following elements:

html.table([ [" ","$I$","$S$","$T$","$L=[S,T]$","$G=ST$","$X=[S,G]$","$Y=[T,G] $"],["macierz",I,S,T,L,G,X,Y] ]);
I S T L=[S,T] G=ST X=[S,G] Y=[T,G]
macierz \left(1001\begin{array}{rr} 1 & 0 \\ 0 & 1 \end{array}\right) \left(0110\begin{array}{rr} 0 & 1 \\ 1 & 0 \end{array}\right) \left(0111\begin{array}{rr} 0 & 1 \\ 1 & 1 \end{array}\right) \left(0110\begin{array}{rr} 0 & 1 \\ -1 & 0 \end{array}\right) \left(1101\begin{array}{rr} 1 & 1 \\ 0 & 1 \end{array}\right) \left(1001\begin{array}{rr} -1 & 0 \\ 0 & 1 \end{array}\right) \left(1101\begin{array}{rr} -1 & -1 \\ 0 & 1 \end{array}\right)

forms the folowing multiplication table:

html.table([ ["generator","$I$","$S$","$T$","$L=[S,T]$","$G=ST$","$X=[S,G]$","$Y=[T,G]$"],["$I$","$I$","$S$","$T$","$L$","$G$","$X$","$Y$"],["$S$","$S$","$I$","$I+(1/2)S+(1/2)L$","$-I-2S +2T$","$T$","$L$","$S-T+L$"],["$T$","$T$","$I+(1/2)S-(1/2)L$","$I+T$","$-I-(5/2)S +2T +(1/2)L$","$-S+2T$","$-S +T +L$","L"],["$L$","$L$","$I+2S-2T$","$I+(5/2)S-2T+(1/2)L$","$-I$","$S-T+L$","$S$","$T$"],["$G$","$G$","$I+2S -T$","$I+(3/2)S +(1/2)L$","$-I-S+T+L$","$I+S+L$","$-I-(3/2)S+2T+(1/2)L$","$-I-2S +2T$"],["$X$","$X$","$-L$","$-S+T-L$","$-S$","$-I-(5/2)S+2T-(1/2)L$","$I$","$I+(1/2)S +(1/2)L$"],["$Y$","$Y$","$-I -S +T -L$","$-I-(5/2)S+2T-(3/2)L$","$I-T$","$-I-3S+2T-L$","$I-(1/2)S-(1/2)L$","$I$"] ]);
generator I S T L=[S,T] G=ST X=[S,G] Y=[T,G]
I I S T L G X Y
S S I I+(1/2)S+(1/2)L -I-2S +2T T L S-T+L
T T I+(1/2)S-(1/2)L I+T -I-(5/2)S +2T +(1/2)L -S+2T -S +T +L L
L L I+2S-2T I+(5/2)S-2T+(1/2)L -I S-T+L S T
G G I+2S -T I+(3/2)S +(1/2)L -I-S+T+L I+S+L -I-(3/2)S+2T+(1/2)L -I-2S +2T
X X -L -S+T-L -S -I-(5/2)S+2T-(1/2)L I I+(1/2)S +(1/2)L
Y Y -I -S +T -L -I-(5/2)S+2T-(3/2)L I-T -I-3S+2T-L I-(1/2)S-(1/2)L I

--------------------------------------

What leasd us to the following ring ( in fact noncommutative algebra) wit the following multiplication table, for base elements I,S,T,L

--------------------------------------

html.table([ ["generator","$I$","$S$","$T$","$L=[S,T]$"],["$I$","$I$","$S$","$T$","$L$"],["$S$","$S$","$I$","$I+(1/2)S+(1/2)L$","$-I-2S +2T$"],["$T$","$T$","$I+(1/2)S-(1/2)L$","$I+T$","$-I-(5/2)S +2T +(1/2)L$"],["$L$","$L$","$I+2S-2T$","$I+(5/2)S -2T +(1/2)L$","$-I$"] ]);
generator I S T L=[S,T]
I I S T L
S S I I+(1/2)S+(1/2)L -I-2S +2T
T T I+(1/2)S-(1/2)L I+T -I-(5/2)S +2T +(1/2)L
L L I+2S-2T I+(5/2)S -2T +(1/2)L -I

Reasaume once again in different way.

We start with monoid S(ST) generated by two generators S,TS,T. S,TS,T are matrices for which det(S)=det(T)=+1det(S)=det(T) = +-1 so means that for every monoid element M we have det(m)=+1det(m) = +-1. Every element is matrix representation of certain confinued fraction, preciselly - matrix of continuats for such fraction - CF matrix for short.

The monoid has one relation S2=1S^2=1 so it means our monoid S(ST) has finite presentation of the form M=<S,T;S2>M=<S,T;S^2>. We have also interesting equation T2=T+1T^2=T+1 which in fact is algebraic relation outside monoid S(ST) since is has addition inside. So it sugges to to be fruitful to move further to ring over rational numbers Q[S(ST)].  It consists of formal sums of monoid elements with rational  coefficients.  Of course elements of Q[S(ST)] has determinant which do not obey very important relation det(m) =1 \left| det(m) \right|  =1 so generaly speaking we have new class of elements -  elements of ring Q[S(ST)] wich are with loose relation to our starting monoid ad which do not represent any CF matrix.

But now we consider structure described in table above. It consists of elements of ring monoid Q[S(ST)] given by linear comnbinations of four elements 1,S,T,L1,S,T,L namely M(a,b,c,d)=a1+bS+cT+dLM(a,b,c,d) = {a1+bS+cT+dL} elements obeying relations from the table. In fact we have to build bigger structure Q[{I,S,T,L}]Q[\{ I,S,T,L \}] because in the ring Q[S(ST)] element L=STTSL=ST-TS is algebraically independent of S and T.  For every element M, every sum and multiply of it by any ring element is also of the form M with some other coefficients a',b',c',d', and then set of elements M is ideal of ring Q[{I,S,T,L}]Q[\{I,S,T,L \}]. In fact this ideal is equal to whole ring Q[{I,S,T,L}]Q[\{I,S,T,L \}] as every element of Q[{I,S,T,L}]Q[\{I,S,T,L \}] may be decomposed to form of M for some coefficients. 

But now if we consider some subset of elements M, namely set for which W={M:det(M(a,b,c,d))=1} W = \{M: \left| det(M(a,b,c,d)) \right| =1\} then we get elements of the ring which may represents elements from original monoid and thus may be represeentation of continued fractions.

So set W of a,b,c,d such that det(M(a,b,c,d)=1|det(M(a,b,c,d)| =1 is some algebraic curve inside of ideal of monoid ring Q[{I,S,T,L}]Q[\{I,S,T,L \}].

Below we will show the equation for this curve, which as is shown is quadrics.

var('n,a,b,c,d,A,B,C,D,E,F,G,H,J,K,N,O,P,U,V,Z,X');
(n, a, b, c, d, A, B, C, D, E, F, G, H, J, K, N, O, P, U, V, Z, X)
m=a*I+ b*S+c*T+d*L;m
[ a b + c + d] [b + c - d a + c]
M=transpose(matrix([a,b,c,d]));M
[a] [b] [c] [d]
BIS=matrix([[1,0,1/2,0],[0,-1,-1,0],[1/2,-1,-1,0],[0,0,0,1]]);BIS
[ 1 0 1/2 0] [ 0 -1 -1 0] [1/2 -1 -1 0] [ 0 0 0 1]
expand(transpose(M)*BIS*M)
[a^2 + a*c - b^2 - 2*b*c - c^2 + d^2]
expand(det(m))
a^2 + a*c - b^2 - 2*b*c - c^2 + d^2
%latex so BIS is bilinear form for which $M*BIS*M^{T}$ where T - is matrix transposition, gives us $\det(m)$
expand(det(m))==expand(transpose(M)*BIS*M)
True

******************************

Some additional remarks: adding elements from ring we get operations called mediant of monoid elements, but we have to simplify rationals we obtain - so it is operation throwing us outside monoid, but stil inside ring!  Multiplying them we "concatenate" continued fractions which is normal monoid operation and also proper ring operation. Also normal addition and multiplication of ordinary continued fractions ( which valuse are normal rational numbers) generates some internal operations in the monoid Q[{I,S,T,L}]Q[\{I,S,T,L \}]. In any of this cases we start from two rational numbers represented by some matrices M and M' in the Q[{I,S,T,L}]Q[\{I,S,T,L \}] and at the end we obtain another number represented by  element of Q[{I,S,T,L}]Q[\{I,S,T,L \}] - so our algebraic qurve nas interesting algebraic structure on it.

There is another,interesting property. For a given continuant matrix ParseError: KaTeX parse error: Unknown column alignment: a at position 26: … \begin{array}{a̲|b}a&b\\c&d\end… we may compute continued fraction value: 


 x=[a0,a1,a2,...an]=bd=12Tr(M(S[S,T]))Tr(M(TS))=12Tr(M(SL))Tr( M(ST)) \boxed{  x = [a_{0},a_{1},a_{2},...a_{n}] =\frac{b}{d}=\frac{1}{2} \frac{Tr \left( M(S- [S,T]) \right)}{Tr \left( M(T-S) \right) } = - \frac{1}{2} \frac{Tr \left( M(S- L) \right) }{Tr \left(  M(S-T) \right) }}

where TrTr is of course trace matrix operation.

 

So this is reverse operation to this defined by MCFFR, and it is given explicite!

TMCFF = lambda x : -1/2*( (MCFF(x,100)*(S- L)).trace()) / ((MCFF(x,100)*(S-T)).trace())
TMCFFR = lambda x : -1/2*( (MCFFR(x)*(S- L)).trace()) / ((MCFFR(x)*(S-T)).trace())
M = matrix([[a,b],[c,d]]);M
[a b] [c d]
-1/2*( (M*(S- L)).trace()) / ((M*(S-T)).trace())
b/d
MCFFR(3/4);
[1 3] [1 4]
TMCFFR(3/4) == 3/4
True
TMCFFR(pi)
80143857/25510582
float(TMCFFR(pi))
3.1415926535897922
TMCFFR(134/237)
134/237