NumTheoryQQ

© 2010 John Abbott
GNU Free Documentation License, Version 1.2



index page

User documentation

Generalities

The functions in the NumTheoryQQ file are predominantly basic operations from number theory which involve rational numbers (rather than just integers). Please recall that computational number theory is not the primary remit of CoCoALib, so do not expect to find a complete collection of operations here -- you would do better to look at Victor Shoup's NTL (Number Theory Library), or PARI/GP, or some other specialized library/system.

The Functions Available For Use

Several of these functions give errors if they are handed unsuitable values: unless otherwise indicated below the error is of type ERR::BadArg.

The main functions available are:

Maintainer Documentation

It is all pretty simple. The only tricky part is that the "end" of the ContFracIter is represented by both myFrac and myQuot being zero. This means that a newly created iterator for zero is already ended.

CFApproximantsIter delegates most of the work to ContFracIter.

Bugs, Shortcomings, etc.

How should these iterators be printed out?

ContFracIter could be rather more efficient for rationals having very large numerator and denominator. One way would be to compute with num and den divided by the same large factor (probably a power of 2), and taking care to monitor how accurate these "scaled" num and den are. I'll wait until there is a real need before implementing (as I expect it will turn out a bit messy).

CFApproximantsIter::operator should be made more efficient.