<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  padics.msk                  GAP documentation            Alexander Hulpke -->
<!-- %% -->
<!-- %A  @(#)<M>Id: padics.msk,v 1.6 2002/04/15 10:02:31 sal Exp </M> -->
<!-- %% -->
<!-- %Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="p-adic Numbers">
<Heading>p-adic Numbers (preliminary)</Heading>

In this chapter <M>p</M> is always a (fixed) prime integer.
<P/>
The <M>p</M>-adic numbers <M>Q_p</M> are the completion of the rational
numbers with respect to the valuation <M>\nu_p( p^v \cdot a / b) = v</M>
if <M>p</M> divides neither <M>a</M> nor <M>b</M>.
They form a field of characteristic 0 which nevertheless shows
some behaviour of the finite field with <M>p</M> elements.
<P/>
A <M>p</M>-adic numbers can be represented by a
<Q><M>p</M>-adic expansion</Q> which is similar to the decimal expansion
used for the reals (but written from left to right).
So for example if <M>p = 2</M>, the numbers <M>1</M>, <M>2</M>, <M>3</M>,
<M>4</M>, <M>1/2</M>, and <M>4/5</M>
are represented as <M>1(2)</M>, <M>0.1(2)</M>, <M>1.1(2)</M>, <M>0.01(2)</M>,
<M>10(2)</M>, and the infinite periodic
expansion <M>0.010110011001100...(2)</M>.

<M>p</M>-adic numbers can be approximated by ignoring higher powers of <M>p</M>,
so for example with only 2 digits accuracy <M>4/5</M> would be approximated
as <M>0.01(2)</M>.
This is different from the decimal approximation of real numbers in that
<M>p</M>-adic approximation is a ring homomorphism on the subrings of
<M>p</M>-adic numbers whose valuation is bounded from below so that
rounding errors do not increase with repeated calculations.
<P/>

In &GAP;, <M>p</M>-adic numbers are always represented by such approximations.
A family of approximated <M>p</M>-adic numbers consists of
<M>p</M>-adic numbers with a fixed prime <M>p</M> and a certain precision,
and arithmetic with these numbers is done with this precision.


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Pure p-adic Numbers">
<Heading>Pure p-adic Numbers</Heading>

Pure <M>p</M>-adic numbers are the <M>p</M>-adic numbers described so far.

<#Include Label="PurePadicNumberFamily">

<ManSection>
<Oper Name="PadicNumber" Arg='fam, rat' Label="for pure padics"/>

<Description>
returns the element of the <M>p</M>-adic number family <A>fam</A>
that approximates the rational number <A>rat</A>.
<P/>
<M>p</M>-adic numbers allow the usual operations for fields.
<P/>
<Example><![CDATA[
gap> fam:=PurePadicNumberFamily(2,20);;
gap> a:=PadicNumber(fam,4/5);
0.010110011001100110011(2)
gap> fam:=PurePadicNumberFamily(2,3);;
gap> a:=PadicNumber(fam,4/5);
0.0101(2)
gap> 3*a;
0.0111(2)
gap> a/2;
0.101(2)
gap> a*10;
0.001(2)
]]></Example>
See 
<Ref Oper="PadicNumber" Label="for a p-adic extension family and a rational"/>
for other methods for <Ref Oper="PadicNumber" Label="for pure padics"/>.
</Description>
</ManSection>

<#Include Label="Valuation">
<#Include Label="ShiftedPadicNumber">
<#Include Label="IsPurePadicNumber">
<#Include Label="IsPurePadicNumberFamily">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Extensions of the p-adic Numbers">
<Heading>Extensions of the p-adic Numbers</Heading>

The usual Kronecker construction with an irreducible polynomial can be used
to construct extensions of the <M>p</M>-adic numbers. 
Let <M>L</M> be such an extension.
Then there is a subfield <M>K &lt; L</M> such that <M>K</M> is an unramified
extension of the <M>p</M>-adic numbers and <M>L/K</M> is purely ramified.
<P/>
(For an explanation of <Q>ramification</Q> see for example
<Cite Key="neukirch" Where="Section II.7"/>,
or another book on algebraic number theory.
Essentially, an extension <M>L</M> of the <M>p</M>-adic numbers generated
by a rational polynomial <M>f</M> is unramified if <M>f</M> remains
squarefree modulo <M>p</M> and is completely ramified if modulo <M>p</M> the
polynomial <M>f</M> is a power of a linear factor while remaining irreducible
over the <M>p</M>-adic numbers.)
<P/>
The representation of extensions of <M>p</M>-adic numbers in &GAP; uses the
subfield <M>K</M>.

<#Include Label="PadicExtensionNumberFamily">
<#Include Label="PadicNumber">
<#Include Label="IsPadicExtensionNumber">
<#Include Label="IsPadicExtensionNumberFamily">

</Section>
</Chapter>


