Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004

Lets define four matrices I,S,T,L as follows:

$ I = \left( ParseError: KaTeX parse error: Unknown column alignment: a at position 15: \begin{array}{a̲|b}1&0\\0&1\end… \right)$; $ S = \left( ParseError: KaTeX parse error: Unknown column alignment: a at position 15: \begin{array}{a̲|b}0&1\\1&0\end… \right)$; $ T = \left( ParseError: KaTeX parse error: Unknown column alignment: a at position 15: \begin{array}{a̲|b}0&1\\1&1\end… \right)$; $ L = \left( ParseError: KaTeX parse error: Unknown column alignment: a at position 15: \begin{array}{a̲|b}0&1\\-1&0\en… \right)$;

For every continued fraction (CF) x=[a0,a1,an,]x = [a_{0},a_{1}, \ldots a_{n}, \ldots ]   in cannonical form we may represent continuant matrix for that fraction ( n-order continuant if x is irrational number) in the following form:

ParseError: KaTeX parse error: Unknown column alignment: a at position 51: … \begin{array}{a̲|b} a & b + c +…

var('a,b,c,d,A,B,C,D');
\newcommand{\Bold}[1]{\mathbf{#1}}\left(a, b, c, d, A, B, C, D\right)
I=matrix([[1,0],[0,1]]);S=matrix([[0,1],[1,0]]);T=matrix([[0,1],[1,1]]);L=S*T -T*S;
M=a*I+ b*S+c*T+d*L;M
\newcommand{\Bold}[1]{\mathbf{#1}}\left(ab+c+db+cda+c\begin{array}{rr} a & b + c + d \\ b + c - d & a + c \end{array}\right)

Matrices I,S,T,LI,S,T,L are lineary independent and so they form standard base in 2x2 linear matrix space. we build ring over rational numbers over this space, I wil call it S(ST)=Q[{I,S,T,L}]S(ST) = Q[\{I,S,T,L\}]. Multiplication table or this ring You may find below.

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

If we consider continued faction here we have additional requirements, that is det(M)=1\left| det(M) \right| = 1. So we have to consider not fully general decompositions M=aI+bS+cT+dLM = aI+bS+cT+dL but only subset of numbers {a,b,c,d}\{a,b,c,d \} for which M has required determinant , namely set for which W={(a,b,c,d):det(M(a,b,c,d))=1} W = \{(a,b,c,d): \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 is quadrics.

M
\newcommand{\Bold}[1]{\mathbf{#1}}\left(ab+c+db+cda+c\begin{array}{rr} a & b + c + d \\ b + c - d & a + c \end{array}\right)
det(M)
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a + c\right)} a - {\left(b + c - d\right)} {\left(b + c + d\right)}
m = transpose(matrix([a,b,c,d]));m
\newcommand{\Bold}[1]{\mathbf{#1}}\left(abcd\begin{array}{r} a \\ b \\ c \\ d \end{array}\right)
B=matrix([[1,0,1/2,0],[0,-1,-1,0],[1/2,-1,-1,0],[0,0,0,1]]);B
\newcommand{\Bold}[1]{\mathbf{#1}}\left(101200110121100001\begin{array}{rrrr} 1 & 0 & \frac{1}{2} & 0 \\ 0 & -1 & -1 & 0 \\ \frac{1}{2} & -1 & -1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right)
expand(transpose(m)*B*m)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(a2+acb22bcc2+d2\begin{array}{r} a^{2} + a c - b^{2} - 2 \, b c - c^{2} + d^{2} \end{array}\right)
expand(det(M))
\newcommand{\Bold}[1]{\mathbf{#1}}a^{2} + a c - b^{2} - 2 \, b c - c^{2} + d^{2}
expand(transpose(m)*B*m) == expand(det(M))
\newcommand{\Bold}[1]{\mathbf{#1}}{\rm True}

As we see requirements det(M)=1\left| det(M) \right| = 1 may be expressed, in vector space m=[a,b,c,d]m=[a,b,c,d] as mTBm=1\left| m^{T} B m \right| =1 where T is transpositon and BB is symmetrical bilinear ( quadric) form. It is quadrics equation. It is worth to note that we may change  BB into diagonal form by similarity transformation of [a,b,c,d][a,b,c,d], and that it has signature (+,,,+)(+,-,-,+)

 

Below we play with linear algebra and define two important functions:

#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)) #n - continuant number def MCFFR(x,n=20): #x - real number s=matrix([[0,1],[1,0]]) t=matrix([[0,1],[1,1]]) g=s*t if x in QQ: return s*prod(s*g^CFF(x,nterms=n)[k] for k in range(len(CFF(x,nterms=n)))) else: return s*prod(s*g^CFF(x,nterms=n)[k] for k in range(len(CFF(x,nterms=n))))
CFF(pi,nterms=5)
<html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3+ \frac{\displaystyle 1}{\displaystyle 7+ \frac{\displaystyle 1}{\displaystyle 15+ \frac{\displaystyle 1}{\displaystyle 1+ \frac{\displaystyle 1}{\displaystyle 292
}}}
float(CFF(pi,nterms=5))
\newcommand{\Bold}[1]{\mathbf{#1}}3.14159265301
MCFFR(pi,5)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(35510399311333102\begin{array}{rr} 355 & 103993 \\ 113 & 33102 \end{array}\right)
float(103993/33102)
\newcommand{\Bold}[1]{\mathbf{#1}}3.14159265301
MCFFR(pi)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(61679504541488539268719633196074738167652\begin{array}{rr} 6167950454 & 14885392687 \\ 1963319607 & 4738167652 \end{array}\right)
MCFFR(pi,50);float(16397605394050964443746106649/5219519906667074477262822481)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(2246605553512900705233191143163976053940509644437461066497151167580385634663727106165219519906667074477262822481\begin{array}{rr} 2246605553512900705233191143 & 16397605394050964443746106649 \\ 715116758038563466372710616 & 5219519906667074477262822481 \end{array}\right)
\newcommand{\Bold}[1]{\mathbf{#1}}3.14159265359

MCFFR(x,n) above returns matrix of n-th continuants as in formula below:

ParseError: KaTeX parse error: Unknown column alignment: a at position 35: … \begin{array}{a̲|b}h_{n-1}& h_{…

Now usning I,S,T,LI,S,T,L defined above we may define function, which for given continuant matrix M returns coresponding continued fraction:

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

where TrTr is of course trace matrix operation. As by definition  ( see for example Wikipedia definition  ) we have

hnkn=hnkn=12Tr(M(SL))Tr( M(ST))=Kn+1(a0,a1,a2an)Kn(a1,a2an) \boxed{\frac{h_{n}}{k_{n}} = \frac{h_{n}}{k_{n}}= - \frac{1}{2} \frac{Tr \left( M(S- L) \right) }{Tr \left(  M(S-T) \right) }= \frac{ K_{n+1}(a_{0},a_{1},a_{2} \ldots a_{n}) }{ K_{n}(a_{1},a_{2} \ldots a_{n}) }}

Further analysis gives us expressions for $ K_{n+1}(a_{0},a_{1},a_{2} \ldots a_{n}) $ polynomials itself:

$K_{n+1}(a_{0},a_{1},a_{2} \ldots a_{n}) =\frac{1}{2} Tr \left( M(S- L) \right) $

Kn(a1,a2an)=Tr(M(ST)) K_{n}(a_{1},a_{2} \ldots a_{n}) = - Tr \left( M(S-T) \right)



def CFFR(M): if ( abs(M.det()) == 1): return -1/2*( (M*(S- L)).trace()) / ((M*(S-T)).trace()) else: #return -1/2*( (M*(S- L)).trace()) / ((M*(S-T)).trace()) print "|det(M) =/= 1 - not continued fraction matrix"
X = MCFFR(pi,30);X
\newcommand{\Bold}[1]{\mathbf{#1}}\left(61348995254170453024627303373592119527991696844919627687726852338\begin{array}{rr} 6134899525417045 & 30246273033735921 \\ 1952799169684491 & 9627687726852338 \end{array}\right)
CFFR(X)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{30246273033735921}{9627687726852338}
X = matrix([[1,1],[1,1]]);X
\newcommand{\Bold}[1]{\mathbf{#1}}\left(1111\begin{array}{rr} 1 & 1 \\ 1 & 1 \end{array}\right)
CFFR(X)
|det(M) =/= 1 - not continued fraction matrix
var('a_0,a_1,a_2,a_3,a_4,a_5,a_6,a_7,a_8,a_9')
\newcommand{\Bold}[1]{\mathbf{#1}}\left(a_{0}, a_{1}, a_{2}, a_{3}, a_{4}, a_{5}, a_{6}, a_{7}, a_{8}, a_{9}\right)
#this function returns (n+1)-th continuant polynomial K_{n+1}(a0...an) or n-th if K_{n}(a1,...an) #depending on the n-value in relation to list = [a0,a1,a2...an]. #If poly = False it returns continuant matrix instead def K(n,lista,poly=True): w= lambda x: matrix([[1,x],[0,1]]) s= matrix([[0,1],[1,0]]) t= matrix([[0,1],[1,1]]) l= matrix([[0,1],[-1,0]]) if poly: if (len(lista) == n): return 1/2 * (( s*prod( s*w(lista[k]) for k in range(0,len(lista)) ) )*(s-l)).trace() elif (len(lista)-1 == n ): return -((s*prod( s*w(lista[k]) for k in range(0,len(lista)) ))*(s-t)).trace() if not(poly): if (len(lista) == n): return s*prod( s*w(lista[k]) for k in range(0,len(lista)) ) elif (len(lista)-1 == n ): return s*prod( s*w(lista[k]) for k in range(0,len(lista)) )
K(5,[a_0,a_1,a_2,a_3,a_4])
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a_{0} a_{1} + 1\right)} a_{2} + {\left({\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3}\right)} a_{4} + a_{0}
expand(K(5,[a_0,a_1,a_2,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}a_{0} a_{1} a_{2} a_{3} a_{4} + a_{0} a_{1} a_{2} + a_{0} a_{1} a_{4} + a_{0} a_{3} a_{4} + a_{2} a_{3} a_{4} + a_{0} + a_{2} + a_{4}
K(4,[a_0,a_1,a_2,a_3,a_4])
\newcommand{\Bold}[1]{\mathbf{#1}}{\left({\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3}\right)} a_{4} + a_{1} a_{2} + 1
expand(K(4,[a_0,a_1,a_2,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}a_{1} a_{2} a_{3} a_{4} + a_{1} a_{2} + a_{1} a_{4} + a_{3} a_{4} + 1
K(5,[a_0,a_1,a_2,a_3,a_4],False);K(5,[a_0,a_1,a_2,a_3,a_4]);
\newcommand{\Bold}[1]{\mathbf{#1}}\left((a2a3+1)(a0a1+1)+a0a3(a0a1+1)a2+((a2a3+1)(a0a1+1)+a0a3)a4+a0(a2a3+1)a1+a3((a2a3+1)a1+a3)a4+a1a2+1\begin{array}{rr} {\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3} & {\left(a_{0} a_{1} + 1\right)} a_{2} + {\left({\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3}\right)} a_{4} + a_{0} \\ {\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3} & {\left({\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3}\right)} a_{4} + a_{1} a_{2} + 1 \end{array}\right)
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a_{0} a_{1} + 1\right)} a_{2} + {\left({\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3}\right)} a_{4} + a_{0}
K(4,[a_0,a_1,a_2,a_3,a_4],False);K(4,[a_0,a_1,a_2,a_3,a_4])
\newcommand{\Bold}[1]{\mathbf{#1}}\left((a2a3+1)(a0a1+1)+a0a3(a0a1+1)a2+((a2a3+1)(a0a1+1)+a0a3)a4+a0(a2a3+1)a1+a3((a2a3+1)a1+a3)a4+a1a2+1\begin{array}{rr} {\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3} & {\left(a_{0} a_{1} + 1\right)} a_{2} + {\left({\left(a_{2} a_{3} + 1\right)} {\left(a_{0} a_{1} + 1\right)} + a_{0} a_{3}\right)} a_{4} + a_{0} \\ {\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3} & {\left({\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3}\right)} a_{4} + a_{1} a_{2} + 1 \end{array}\right)
\newcommand{\Bold}[1]{\mathbf{#1}}{\left({\left(a_{2} a_{3} + 1\right)} a_{1} + a_{3}\right)} a_{4} + a_{1} a_{2} + 1
float(8/5)
\newcommand{\Bold}[1]{\mathbf{#1}}1.6
MCFFR(8/5)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(3825\begin{array}{rr} 3 & 8 \\ 2 & 5 \end{array}\right)
expand(K(4,[a_0,a_1,a_2,a_3]))
\newcommand{\Bold}[1]{\mathbf{#1}}a_{0} a_{1} a_{2} a_{3} + a_{0} a_{1} + a_{0} a_{3} + a_{2} a_{3} + 1
expand(K(4,[a_1,a_2+1,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}a_{1} a_{2} a_{3} a_{4} + a_{1} a_{3} a_{4} + a_{1} a_{2} + a_{1} a_{4} + a_{3} a_{4} + a_{1} + 1
expand(K(5,[a_0,a_1,a_2,a_3,a_4]) - K(5,[a_0,a_1,(a_2)+1,a_3,a_4]) - K(7,[a_0,a_1,a_2,1,1,a_3,a_4]) + 2*K(6,[a_0,a_1,a_2,1,a_3,a_4]) )
\newcommand{\Bold}[1]{\mathbf{#1}}a_{0} a_{1} a_{2} a_{4} - a_{0} a_{1} a_{4} + a_{0} a_{4} + a_{2} a_{4} - a_{4}
expand(K(6,[a_1,a_2,1,1,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}2 \, a_{1} a_{2} a_{3} a_{4} + a_{1} a_{2} a_{4} + a_{1} a_{3} a_{4} + 2 \, a_{1} a_{2} + a_{1} a_{4} + 2 \, a_{3} a_{4} + a_{1} + a_{4} + 2
expand(K(5,[a_1,a_2,1,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}a_{1} a_{2} a_{3} a_{4} + a_{1} a_{2} a_{4} + a_{1} a_{3} a_{4} + a_{1} a_{2} + a_{3} a_{4} + a_{1} + a_{4} + 1
expand(K(5,[a_0,a_1,a_2,a_3,a_4]) - K(7,[a_0,a_1,a_2,1,1,a_3,a_4]) + K(6,[a_0,a_1,a_2,1,a_3,a_4]))
\newcommand{\Bold}[1]{\mathbf{#1}}0
K(3,[a_0,a_1,a_2])
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a_{0} a_{1} + 1\right)} a_{2} + a_{0}
K(5,[a_0,1,1,a_1,a_2])
\newcommand{\Bold}[1]{\mathbf{#1}}{\left({\left(a_{1} + 1\right)} {\left(a_{0} + 1\right)} + a_{0} a_{1}\right)} a_{2} + 2 \, a_{0} + 1
K(4,[a_0,1,a_1,a_2])
\newcommand{\Bold}[1]{\mathbf{#1}}{\left(a_{0} + 1\right)} {\left(a_{1} a_{2} + 1\right)} + a_{0} a_{2}
expand(K(3,[a_0,a_1,a_2])) == expand(K(5,[a_0,1,1,a_1,a_2]) - K(4,[a_0,1,a_1,a_2]) )
\newcommand{\Bold}[1]{\mathbf{#1}}a_{0} a_{1} a_{2} + a_{0} + a_{2} = a_{0} a_{1} a_{2} + a_{0} + a_{2}