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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Book SYSTEM "gapdoc.dtd" [
<!ENTITY see '<Alt Only="LaTeX">$\to$</Alt><Alt Not="LaTeX">--&tgt;</Alt>'>
<#Include Label="Version">
]>
<Book Name="FLOAT">
<TitlePage>
<Title>Floating-point numbers</Title>
<Version>Version &Version;</Version>
<TitleComment>
Integration of mpfr, mpfi, mpc, fplll and cxsc in GAP
</TitleComment>
<Author>Laurent Bartholdi
<Email><Alt Only="HTML">laurent.bartholdi@gmail.com</Alt>
<Alt Not="HTML">laurent.bartholdi@gmail.com</Alt></Email>
<Homepage>https://www.math.uni-sb.de/ag/bartholdi/</Homepage>
</Author>
<Date>&Date;</Date>
<Address>
FR Mathematik<Br/>D-66041 Saarbrücken<Br/>Germany
</Address>
<Abstract>
This document describes the package <Package>Float</Package>, which
implements in &GAP; arbitrary-precision floating-point numbers.
<Alt Only="HTML">
<P/>
The computer algebra system &GAP; is available at
<URL>https://gap-system.org</URL>.
<P/>
This documentation for <Package>Float</Package> is available at
<URL>https://www.gap-system.org/Manuals/pkg/float-&Version;/doc/manual.pdf</URL> in PDF format, and may be
accessed online at <URL>https://gap-packages.github.io/float/</URL>.
<P/>
The latest release of the package may be downloaded as
<URL>https://github.com/gap-packages/float/releases/download/v&Version;/float-&Version;.tar.gz</URL> (tar, gzipped).
The latest repository version (possibly unstable) may be downloaded as
<URL>https://github.com/gap-packages/float/tarball/master</URL> (tar, gzipped),
<URL>https://github.com/gap-packages/float.git</URL> (git repository),
<URL>https://packages.debian.org/search?keywords=gap-float&searchon=names&suite=all&section=all</URL> (debian package), or
explored at <URL>https://github.com/gap-packages/float/tree/master/</URL>.
</Alt>
<P/>
For comments or questions on <Package>Float</Package> please contact
the author.
</Abstract>
<Copyright>©right; 2011-2021 by Laurent Bartholdi
</Copyright>
<Acknowledgements>Part of this work was supported by the "Swiss
National Fund for Scientific Research (SNF)", the "German National Science Foundation (DFG)",
and the Courant Research Centre "Higher Order Structures" of the University of Göttingen.
</Acknowledgements>
</TitlePage>
<TableOfContents/>
<Body>
<Chapter><Heading>Licensing</Heading>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or any
later version.
<P/> This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
<P/> You should have received a copy of the GNU General Public
License along with this program, in the file COPYING. If not, see
<URL>https://www.gnu.org/licenses/</URL>.
</Chapter>
<Chapter Label="floatpackage"><Heading>Float package</Heading>
<Section Label="sample"><Heading>A sample run</Heading>
The extended floating-point capabilities of &GAP; are installed by loading the package
via <C>LoadPackage("float");</C> and selecting new floating-point handlers via
<C>SetFloats(MPFR)</C>, <C>SetFloats(MPFI)</C>, <C>SetFloats(MPC)</C> or<C>SetFloats(CXSC)</C>,
depending on whether high-precision real, interval or complex arithmetic are desired, or
whether a fast package containing all four real/complex element/interval arithmetic is desired:
<Example><![CDATA[
gap> LoadPackage("float");
Loading FLOAT 0.7.0 ...
true
gap> SetFloats(MPFR); # floating-point
gap> x := 4*Atan(1.0);
.314159e1
gap> Sin(x);
.169569e-30
gap> SetFloats(MPFR,1000); # 1000 bits
gap> x := 4*Atan(1.0);
.314159e1
gap> Sin(x);
.125154e-300
gap> String(x,300);
".3141592653589793238462643383279502884197169399375105820974944592307816406286\
208998628034825342117067982148086513282306647093844609550582231725359408128481\
117450284102701938521105559644622948954930381964428810975665933446128475648233\
78678316527120190914564856692346034861045432664821339360726024914127e1"
gap>
gap> SetFloats(MPFI); # intervals
gap> x := 4*Atan(1.0);
.314159e1(99)
gap> AbsoluteDiameter(x); Sup(x); Inf(x);
.100441e-29
.314159e1
.314159e1
gap> Sin(x);
-.140815e-29(97)
gap> 0.0 in last;
true
gap> 1.0; # exact representation
.1e1(∞)
gap> IncreaseInterval(last,0.001); # now only 8 significant bits
.1e1(8)
gap> IncreaseInterval(last,-0.002); # now becomes empty
∅
gap> r2 := Sqrt(2.0);
.141421e1(99)
gap> MinimalPolynomial(Rationals,r2);
-2*x_1^2+1
gap> Cyc(r2);
E(8)-E(8)^3
gap>
gap> SetFloats(MPC); # complex numbers
gap> z := 5.0-1.0i;
.5e1-.1e1i
gap> (1+1.0i)*last^4*(239+1.0i);
.228488e6
gap> Exp(6.2835i);
.1e1+.314693e-3i
]]></Example>
</Section>
</Chapter>
<Chapter Label="poly"><Heading>Polynomials</Heading>
<Section><Heading>The Floats pseudo-field</Heading>
Polynomials with floating-point coefficients may be manipulated in
&GAP;; though they behave, in subtle ways, quite differently than
polynomials over rings. A "pseudo-field" of floating-point numbers
is available to create them using the standard &GAP; syntax.
<P/>
<ManSection>
<Var Name="FLOAT_PSEUDOFIELD"/>
<Description>
The "pseudo-field" of floating-point numbers, containing all
floating-point numbers in the current implementation.
<P/>
Note that it is not really a field, e.g. because addition of
floating-point numbers is not associative. It is mainly used to
create indeterminates, as in the following example:
<Example><![CDATA[
gap> x := Indeterminate(FLOAT_PSEUDOFIELD,"x");
x
gap> 2*x^2+3;
2.0*x^2+3.0
gap> Value(last,10);
203.0
]]></Example>
</Description>
</ManSection>
</Section>
<Section><Heading>Roots of polynomials</Heading>
The Jenkins-Traub algorithm has been implemented, in arbitrary
precision for MPFR and MPC.
<P/>
Furthermore, CXSC can provide complex enclosures for the roots of a
complex polynomial.
</Section>
<Section><Heading>Finding integer relations</Heading>
<#Include Label="PSLQ">
</Section>
<Section><Heading>LLL lattice reduction</Heading>
A faster implementation of the LLL lattice reduction algorithm has
also been implemented. It is accessible via the commands
<C>FPLLLReducedBasis(m)</C> and
<C>FPLLLShortestVector(m)</C>.
<P/>
</Section>
</Chapter>
<Chapter Label="impl"><Heading>Implemented packages</Heading>
<Section><Heading>MPFR</Heading>
<#Include Label="IsMPFRFloat">
</Section>
<Section><Heading>MPFI</Heading>
<#Include Label="IsMPFIFloat">
</Section>
<Section><Heading>MPC</Heading>
<#Include Label="IsMPCFloat">
</Section>
<Section><Heading>CXSC</Heading>
<#Include Label="IsCXSCFloat">
</Section>
<Section><Heading>FPLLL</Heading>
<#Include Label="FPLLL">
</Section>
</Chapter>
</Body>
<Bibliography Databases="float"/>
<TheIndex/>
</Book>
|