Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/lib/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 3 kB image not shown  

Quelle  contfrac.gd   Sprache: unbekannt

 
Spracherkennung für: .gd vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

#############################################################################
##
##  This file is part of GAP, a system for computational discrete algebra.
##  This file's authors include Stefan Kohl.
##
##  Copyright of GAP belongs to its developers, whose names are too numerous
##  to list here. Please refer to the COPYRIGHT file for details.
##
##  SPDX-License-Identifier: GPL-2.0-or-later
##
##  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);
##  [ 21114111411141114111 ]
##  gap> ContinuedFractionExpansionOfRoot(x^2-7,0);
##  [ 21114 ]
##  gap> ContinuedFractionExpansionOfRoot(x^3-2,20);
##  [ 13151141181141102141223 ]
##  gap> ContinuedFractionExpansionOfRoot(x^5-x-1,50);
##  [ 15142132422116111112311125,
##    1711141422342111114112181,
##    111192154 ]
##  ]]></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" );


[Dauer der Verarbeitung: 0.12 Sekunden, vorverarbeitet 2026-06-10]