\begin{patch}{ContinuedFractionXmpPagePatch1}
\begin{paste}{ContinuedFractionXmpPageFull1}{ContinuedFractionXmpPageEmpty1}
\pastebutton{ContinuedFractionXmpPageFull1}{\hidepaste}
\tab{5}\spadcommand{c := continuedFraction(314159/100000)\bound{c }}
\indentrel{3}\begin{verbatim}
   (1)
           1 |     1  |     1 |     1  |     1 |     1 |
     3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+
         | 7     | 15     | 1     | 25     | 1     | 7
   + 
       1 |
     +---+
     | 4
                       Type: ContinuedFraction(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty1}
\begin{paste}{ContinuedFractionXmpPageEmpty1}{ContinuedFractionXmpPagePatch1}
\pastebutton{ContinuedFractionXmpPageEmpty1}{\showpaste}
\tab{5}\spadcommand{c := continuedFraction(314159/100000)\bound{c }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch2}
\begin{paste}{ContinuedFractionXmpPageFull2}{ContinuedFractionXmpPageEmpty2}
\pastebutton{ContinuedFractionXmpPageFull2}{\hidepaste}
\tab{5}\spadcommand{partialQuotients c\free{c }}
\indentrel{3}\begin{verbatim}
   (2)  [3, 7, 15, 1, 25, 1, 7, 4]
                                  Type: Stream(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty2}
\begin{paste}{ContinuedFractionXmpPageEmpty2}{ContinuedFractionXmpPagePatch2}
\pastebutton{ContinuedFractionXmpPageEmpty2}{\showpaste}
\tab{5}\spadcommand{partialQuotients c\free{c }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch3}
\begin{paste}{ContinuedFractionXmpPageFull3}{ContinuedFractionXmpPageEmpty3}
\pastebutton{ContinuedFractionXmpPageFull3}{\hidepaste}
\tab{5}\spadcommand{convergents c\free{c }}
\indentrel{3}\begin{verbatim}
            22  333  355  9208  9563  76149  314159
   (3)  [3, --, ---, ---, ----, ----, -----, ------]
             7  106  113  2931  3044  24239  100000
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty3}
\begin{paste}{ContinuedFractionXmpPageEmpty3}{ContinuedFractionXmpPagePatch3}
\pastebutton{ContinuedFractionXmpPageEmpty3}{\showpaste}
\tab{5}\spadcommand{convergents c\free{c }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch4}
\begin{paste}{ContinuedFractionXmpPageFull4}{ContinuedFractionXmpPageEmpty4}
\pastebutton{ContinuedFractionXmpPageFull4}{\hidepaste}
\tab{5}\spadcommand{approximants c\free{c }}
\indentrel{3}\begin{verbatim}
                                             ______
            22  333  355  9208  9563  76149  314159
   (4)  [3, --, ---, ---, ----, ----, -----, ------]
             7  106  113  2931  3044  24239  100000
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty4}
\begin{paste}{ContinuedFractionXmpPageEmpty4}{ContinuedFractionXmpPagePatch4}
\pastebutton{ContinuedFractionXmpPageEmpty4}{\showpaste}
\tab{5}\spadcommand{approximants c\free{c }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch5}
\begin{paste}{ContinuedFractionXmpPageFull5}{ContinuedFractionXmpPageEmpty5}
\pastebutton{ContinuedFractionXmpPageFull5}{\hidepaste}
\tab{5}\spadcommand{pq := partialQuotients(1/c)\free{c }\bound{pq }}
\indentrel{3}\begin{verbatim}
   (5)  [0, 3, 7, 15, 1, 25, 1, 7, 4]
                                  Type: Stream(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty5}
\begin{paste}{ContinuedFractionXmpPageEmpty5}{ContinuedFractionXmpPagePatch5}
\pastebutton{ContinuedFractionXmpPageEmpty5}{\showpaste}
\tab{5}\spadcommand{pq := partialQuotients(1/c)\free{c }\bound{pq }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch6}
\begin{paste}{ContinuedFractionXmpPageFull6}{ContinuedFractionXmpPageEmpty6}
\pastebutton{ContinuedFractionXmpPageFull6}{\hidepaste}
\tab{5}\spadcommand{continuedFraction(first pq,repeating [1],rest pq)\free{pq }}
\indentrel{3}\begin{verbatim}
   (6)
       1 |     1 |     1  |     1 |     1  |     1 |
     +---+ + +---+ + +----+ + +---+ + +----+ + +---+
     | 3     | 7     | 15     | 1     | 25     | 1
   + 
       1 |     1 |
     +---+ + +---+
     | 7     | 4
                       Type: ContinuedFraction(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty6}
\begin{paste}{ContinuedFractionXmpPageEmpty6}{ContinuedFractionXmpPagePatch6}
\pastebutton{ContinuedFractionXmpPageEmpty6}{\showpaste}
\tab{5}\spadcommand{continuedFraction(first pq,repeating [1],rest pq)\free{pq }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch7}
\begin{paste}{ContinuedFractionXmpPageFull7}{ContinuedFractionXmpPageEmpty7}
\pastebutton{ContinuedFractionXmpPageFull7}{\hidepaste}
\tab{5}\spadcommand{z:=continuedFraction(3,repeating [1],repeating [3,6])\bound{z }}
\indentrel{3}\begin{verbatim}
   (7)
           1 |     1 |     1 |     1 |     1 |     1 |
     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
         | 3     | 6     | 3     | 6     | 3     | 6
   + 
       1 |     1 |     1 |     1 |
     +---+ + +---+ + +---+ + +---+ + ...
     | 3     | 6     | 3     | 6
                       Type: ContinuedFraction(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty7}
\begin{paste}{ContinuedFractionXmpPageEmpty7}{ContinuedFractionXmpPagePatch7}
\pastebutton{ContinuedFractionXmpPageEmpty7}{\showpaste}
\tab{5}\spadcommand{z:=continuedFraction(3,repeating [1],repeating [3,6])\bound{z }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch8}
\begin{paste}{ContinuedFractionXmpPageFull8}{ContinuedFractionXmpPageEmpty8}
\pastebutton{ContinuedFractionXmpPageFull8}{\hidepaste}
\tab{5}\spadcommand{dens : Stream Integer := cons(1, stream((x +-> x + 4), 6))\bound{dens }}
\indentrel{3}\begin{verbatim}
   (8)  [1, 6, 10, 14, 18, 22, 26, 30, 34, 38, ...]
                                  Type: Stream(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty8}
\begin{paste}{ContinuedFractionXmpPageEmpty8}{ContinuedFractionXmpPagePatch8}
\pastebutton{ContinuedFractionXmpPageEmpty8}{\showpaste}
\tab{5}\spadcommand{dens : Stream Integer := cons(1, stream((x +-> x + 4), 6))\bound{dens }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch9}
\begin{paste}{ContinuedFractionXmpPageFull9}{ContinuedFractionXmpPageEmpty9}
\pastebutton{ContinuedFractionXmpPageFull9}{\hidepaste}
\tab{5}\spadcommand{cf := continuedFraction(0,repeating [1],dens)\free{dens }\bound{cf }}
\indentrel{3}\begin{verbatim}
   (9)
       1 |     1 |     1  |     1  |     1  |     1  |
     +---+ + +---+ + +----+ + +----+ + +----+ + +----+
     | 1     | 6     | 10     | 14     | 18     | 22
   + 
       1  |     1  |     1  |     1  |
     +----+ + +----+ + +----+ + +----+ + ...
     | 26     | 30     | 34     | 38
                       Type: ContinuedFraction(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty9}
\begin{paste}{ContinuedFractionXmpPageEmpty9}{ContinuedFractionXmpPagePatch9}
\pastebutton{ContinuedFractionXmpPageEmpty9}{\showpaste}
\tab{5}\spadcommand{cf := continuedFraction(0,repeating [1],dens)\free{dens }\bound{cf }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch10}
\begin{paste}{ContinuedFractionXmpPageFull10}{ContinuedFractionXmpPageEmpty10}
\pastebutton{ContinuedFractionXmpPageFull10}{\hidepaste}
\tab{5}\spadcommand{ccf := convergents cf\free{cf }\bound{ccf }}
\indentrel{3}\begin{verbatim}
   (10)
          6  61   860  15541  342762   8927353
   [0, 1, -, --, ----, -----, ------, --------,
          7  71  1001  18089  398959  10391023
    268163352   9126481321
    ---------, -----------, ...]
    312129649  10622799089
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty10}
\begin{paste}{ContinuedFractionXmpPageEmpty10}{ContinuedFractionXmpPagePatch10}
\pastebutton{ContinuedFractionXmpPageEmpty10}{\showpaste}
\tab{5}\spadcommand{ccf := convergents cf\free{cf }\bound{ccf }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch11}
\begin{paste}{ContinuedFractionXmpPageFull11}{ContinuedFractionXmpPageEmpty11}
\pastebutton{ContinuedFractionXmpPageFull11}{\hidepaste}
\tab{5}\spadcommand{eConvergents := [2*e + 1 for e in ccf]\bound{ec }\free{ccf }}
\indentrel{3}\begin{verbatim}
   (11)
          19  193  2721  49171  1084483  28245729
   [1, 3, --, ---, ----, -----, -------, --------,
           7   71  1001  18089   398959  10391023
    848456353  28875761731
    ---------, -----------, ...]
    312129649  10622799089
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty11}
\begin{paste}{ContinuedFractionXmpPageEmpty11}{ContinuedFractionXmpPagePatch11}
\pastebutton{ContinuedFractionXmpPageEmpty11}{\showpaste}
\tab{5}\spadcommand{eConvergents := [2*e + 1 for e in ccf]\bound{ec }\free{ccf }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch12}
\begin{paste}{ContinuedFractionXmpPageFull12}{ContinuedFractionXmpPageEmpty12}
\pastebutton{ContinuedFractionXmpPageFull12}{\hidepaste}
\tab{5}\spadcommand{eConvergents :: Stream Float\free{ec }}
\indentrel{3}\begin{verbatim}
   (12)
   [1.0, 3.0, 2.7142857142_857142857,
    2.7183098591_549295775, 2.7182817182_817182817,
    2.7182818287_356957267, 2.7182818284_585634113,
    2.7182818284_590458514, 2.7182818284_590452348,
    2.7182818284_590452354, ...]
                                    Type: Stream(Float)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty12}
\begin{paste}{ContinuedFractionXmpPageEmpty12}{ContinuedFractionXmpPagePatch12}
\pastebutton{ContinuedFractionXmpPageEmpty12}{\showpaste}
\tab{5}\spadcommand{eConvergents :: Stream Float\free{ec }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch13}
\begin{paste}{ContinuedFractionXmpPageFull13}{ContinuedFractionXmpPageEmpty13}
\pastebutton{ContinuedFractionXmpPageFull13}{\hidepaste}
\tab{5}\spadcommand{exp 1.0}
\indentrel{3}\begin{verbatim}
   (13)  2.7182818284_590452354
                                            Type: Float
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty13}
\begin{paste}{ContinuedFractionXmpPageEmpty13}{ContinuedFractionXmpPagePatch13}
\pastebutton{ContinuedFractionXmpPageEmpty13}{\showpaste}
\tab{5}\spadcommand{exp 1.0}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch14}
\begin{paste}{ContinuedFractionXmpPageFull14}{ContinuedFractionXmpPageEmpty14}
\pastebutton{ContinuedFractionXmpPageFull14}{\hidepaste}
\tab{5}\spadcommand{cf := continuedFraction(1,[(2*i+1)^2 for i in 0..],repeating [2])\bound{cf1 }}
\indentrel{3}\begin{verbatim}
   (14)
           1 |     9 |     25 |     49 |     81 |
     1 + +---+ + +---+ + +----+ + +----+ + +----+
         | 2     | 2     | 2      | 2      | 2
   + 
     121 |     169 |     225 |     289 |     361 |
   +-----+ + +-----+ + +-----+ + +-----+ + +-----+ + ...
   |  2      |  2      |  2      |  2      |  2
                       Type: ContinuedFraction(Integer)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty14}
\begin{paste}{ContinuedFractionXmpPageEmpty14}{ContinuedFractionXmpPagePatch14}
\pastebutton{ContinuedFractionXmpPageEmpty14}{\showpaste}
\tab{5}\spadcommand{cf := continuedFraction(1,[(2*i+1)^2 for i in 0..],repeating [2])\bound{cf1 }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch15}
\begin{paste}{ContinuedFractionXmpPageFull15}{ContinuedFractionXmpPageEmpty15}
\pastebutton{ContinuedFractionXmpPageFull15}{\hidepaste}
\tab{5}\spadcommand{ccf := convergents cf\free{cf1 }\bound{ccf1 }}
\indentrel{3}\begin{verbatim}
   (15)
       3  15  105  315  3465  45045  45045  765765
   [1, -, --, ---, ---, ----, -----, -----, ------,
       2  13   76  263  2578  36979  33976  622637
    14549535
    --------, ...]
    11064338
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty15}
\begin{paste}{ContinuedFractionXmpPageEmpty15}{ContinuedFractionXmpPagePatch15}
\pastebutton{ContinuedFractionXmpPageEmpty15}{\showpaste}
\tab{5}\spadcommand{ccf := convergents cf\free{cf1 }\bound{ccf1 }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch16}
\begin{paste}{ContinuedFractionXmpPageFull16}{ContinuedFractionXmpPageEmpty16}
\pastebutton{ContinuedFractionXmpPageFull16}{\hidepaste}
\tab{5}\spadcommand{piConvergents := [4/p for p in ccf]\bound{piConvergents }\free{ccf1 }}
\indentrel{3}\begin{verbatim}
   (16)
       8  52  304  1052  10312  147916  135904  2490548
   [4, -, --, ---, ----, -----, ------, ------, -------,
       3  15  105   315   3465   45045   45045   765765
    44257352
    --------, ...]
    14549535
                        Type: Stream(Fraction(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty16}
\begin{paste}{ContinuedFractionXmpPageEmpty16}{ContinuedFractionXmpPagePatch16}
\pastebutton{ContinuedFractionXmpPageEmpty16}{\showpaste}
\tab{5}\spadcommand{piConvergents := [4/p for p in ccf]\bound{piConvergents }\free{ccf1 }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch17}
\begin{paste}{ContinuedFractionXmpPageFull17}{ContinuedFractionXmpPageEmpty17}
\pastebutton{ContinuedFractionXmpPageFull17}{\hidepaste}
\tab{5}\spadcommand{piConvergents :: Stream Float\free{piConvergents }}
\indentrel{3}\begin{verbatim}
   (17)
   [4.0, 2.6666666666_666666667, 3.4666666666_666666667,
    2.8952380952_380952381, 3.3396825396_825396825,
    2.9760461760_461760462, 3.2837384837_384837385,
    3.0170718170_718170718, 3.2523659347_188758953,
    3.0418396189_294022111, ...]
                                    Type: Stream(Float)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty17}
\begin{paste}{ContinuedFractionXmpPageEmpty17}{ContinuedFractionXmpPagePatch17}
\pastebutton{ContinuedFractionXmpPageEmpty17}{\showpaste}
\tab{5}\spadcommand{piConvergents :: Stream Float\free{piConvergents }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch18}
\begin{paste}{ContinuedFractionXmpPageFull18}{ContinuedFractionXmpPageEmpty18}
\pastebutton{ContinuedFractionXmpPageFull18}{\hidepaste}
\tab{5}\spadcommand{continuedFraction((- 122 + 597*\%i)/(4 - 4*\%i))}
\indentrel{3}\begin{verbatim}
                             1     |         1      |
   (18)  - 90 + 59 %i + +----------+ + +------------+
                        | 1 - 2 %i     | - 1 + 2 %i
              Type: ContinuedFraction(Complex(Integer))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty18}
\begin{paste}{ContinuedFractionXmpPageEmpty18}{ContinuedFractionXmpPagePatch18}
\pastebutton{ContinuedFractionXmpPageEmpty18}{\showpaste}
\tab{5}\spadcommand{continuedFraction((- 122 + 597*\%i)/(4 - 4*\%i))}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch19}
\begin{paste}{ContinuedFractionXmpPageFull19}{ContinuedFractionXmpPageEmpty19}
\pastebutton{ContinuedFractionXmpPageFull19}{\hidepaste}
\tab{5}\spadcommand{r : Fraction UnivariatePolynomial(x,Fraction Integer)\bound{rdec }}
\indentrel{3}\begin{verbatim}
                                             Type: Void
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty19}
\begin{paste}{ContinuedFractionXmpPageEmpty19}{ContinuedFractionXmpPagePatch19}
\pastebutton{ContinuedFractionXmpPageEmpty19}{\showpaste}
\tab{5}\spadcommand{r : Fraction UnivariatePolynomial(x,Fraction Integer)\bound{rdec }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch20}
\begin{paste}{ContinuedFractionXmpPageFull20}{ContinuedFractionXmpPageEmpty20}
\pastebutton{ContinuedFractionXmpPageFull20}{\hidepaste}
\tab{5}\spadcommand{r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))\free{rdec }\bound{r }}
\indentrel{3}\begin{verbatim}
           2
          x  - 3 x + 2
   (20)  -------------
          2
         x  - 7 x + 12
Type: Fraction(UnivariatePolynomial(x,Fraction(Integer)))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty20}
\begin{paste}{ContinuedFractionXmpPageEmpty20}{ContinuedFractionXmpPagePatch20}
\pastebutton{ContinuedFractionXmpPageEmpty20}{\showpaste}
\tab{5}\spadcommand{r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))\free{rdec }\bound{r }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch21}
\begin{paste}{ContinuedFractionXmpPageFull21}{ContinuedFractionXmpPageEmpty21}
\pastebutton{ContinuedFractionXmpPageFull21}{\hidepaste}
\tab{5}\spadcommand{continuedFraction r\free{r }}
\indentrel{3}\begin{verbatim}
                  1    |         1     |
   (21)  1 + +---------+ + +-----------+
             | 1     9     | 16     40
             | - x - -     | -- x - --
             | 4     8     |  3      3
Type: ContinuedFraction(UnivariatePolynomial(x,Fraction(Integer)))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty21}
\begin{paste}{ContinuedFractionXmpPageEmpty21}{ContinuedFractionXmpPagePatch21}
\pastebutton{ContinuedFractionXmpPageEmpty21}{\showpaste}
\tab{5}\spadcommand{continuedFraction r\free{r }}
\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPagePatch22}
\begin{paste}{ContinuedFractionXmpPageFull22}{ContinuedFractionXmpPageEmpty22}
\pastebutton{ContinuedFractionXmpPageFull22}{\hidepaste}
\tab{5}\spadcommand{[i*i for i in convergents(z) :: Stream Float]\free{z }}
\indentrel{3}\begin{verbatim}
   (22)
   [9.0, 11.1111111111_11111111, 10.9944598337_9501385,
    11.0002777777_77777778, 10.9999860763_98799786,
    11.0000006979_29731039, 10.9999999650_15834446,
    11.0000000017_53603304, 10.9999999999_12099531,
    11.0000000000_04406066, ...]
                                    Type: Stream(Float)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{ContinuedFractionXmpPageEmpty22}
\begin{paste}{ContinuedFractionXmpPageEmpty22}{ContinuedFractionXmpPagePatch22}
\pastebutton{ContinuedFractionXmpPageEmpty22}{\showpaste}
\tab{5}\spadcommand{[i*i for i in convergents(z) :: Stream Float]\free{z }}
\end{paste}\end{patch}

