/usr/share/gap/lib/contfrac.gd is in gap-libs 4r7p9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #############################################################################
##
#W contfrac.gd Stefan Kohl
##
#Y Copyright (C) 2004 The GAP Group
##
##
## This file contains declarations of functions for computing (with)
## continued fraction expansions of real numbers.
##
#############################################################################
##
#F ContinuedFractionExpansionOfRoot( <f>, <n> )
##
## <#GAPDoc Label="ContinuedFractionExpansionOfRoot">
## <ManSection>
## <Func Name="ContinuedFractionExpansionOfRoot" Arg='f, n'/>
##
## <Description>
## The first <A>n</A> terms of the continued fraction expansion of the only
## positive real root of the polynomial <A>f</A> with integer coefficients.
## The leading coefficient of <A>f</A> must be positive and the value of <A>f</A> at 0
## must be negative. If the degree of <A>f</A> is 2 and <A>n</A> = 0, the function
## computes one period of the continued fraction expansion of the root in
## question. Anything may happen if <A>f</A> has three or more positive real
## roots.
## <Example><![CDATA[
## gap> x := Indeterminate(Integers);;
## gap> ContinuedFractionExpansionOfRoot(x^2-7,20);
## [ 2, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1 ]
## gap> ContinuedFractionExpansionOfRoot(x^2-7,0);
## [ 2, 1, 1, 1, 4 ]
## gap> ContinuedFractionExpansionOfRoot(x^3-2,20);
## [ 1, 3, 1, 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3 ]
## gap> ContinuedFractionExpansionOfRoot(x^5-x-1,50);
## [ 1, 5, 1, 42, 1, 3, 24, 2, 2, 1, 16, 1, 11, 1, 1, 2, 31, 1, 12, 5,
## 1, 7, 11, 1, 4, 1, 4, 2, 2, 3, 4, 2, 1, 1, 11, 1, 41, 12, 1, 8, 1,
## 1, 1, 1, 1, 9, 2, 1, 5, 4 ]
## ]]></Example>
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareGlobalFunction( "ContinuedFractionExpansionOfRoot" );
#############################################################################
##
#F ContinuedFractionApproximationOfRoot( <f>, <n> )
##
## <#GAPDoc Label="ContinuedFractionApproximationOfRoot">
## <ManSection>
## <Func Name="ContinuedFractionApproximationOfRoot" Arg='f, n'/>
##
## <Description>
## The <A>n</A>th continued fraction approximation of the only positive real root
## of the polynomial <A>f</A> with integer coefficients. The leading coefficient
## of <A>f</A> must be positive and the value of <A>f</A> at 0 must be negative.
## Anything may happen if <A>f</A> has three or more positive real roots.
## <Example><![CDATA[
## gap> ContinuedFractionApproximationOfRoot(x^2-2,10);
## 3363/2378
## gap> 3363^2-2*2378^2;
## 1
## gap> z := ContinuedFractionApproximationOfRoot(x^5-x-1,20);
## 499898783527/428250732317
## gap> z^5-z-1;
## 486192462527432755459620441970617283/
## 14404247382319842421697357558805709031116987826242631261357
## ]]></Example>
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareGlobalFunction( "ContinuedFractionApproximationOfRoot" );
|