factory-0.2.0.5: Rational arithmetic in an irrational world.

Safe HaskellSafe-Inferred

Factory.Math.Precision

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines the unit with which precision is measured, and operations on it.

Synopsis

Types

Type-synonyms

type DecimalDigits = IntSource

A number of decimal digits.

Constants

linearConvergence :: ConvergenceOrderSource

Linear convergence-rate; which may be qualified by the rate of convergence.

quadraticConvergence :: ConvergenceOrderSource

Quadratic convergence-rate.

cubicConvergence :: ConvergenceOrderSource

Cubic convergence-rate.

quarticConvergence :: ConvergenceOrderSource

Quartic convergence-rate.

Functions

getIterationsRequiredSource

Arguments

:: Integral i 
=> ConvergenceOrder 
-> DecimalDigits

The precision of the initial estimate.

-> DecimalDigits

The required precision.

-> i 

The predicted number of iterations, required to achieve a specific accuracy, at a given order of convergence.

getTermsRequiredSource

Arguments

:: Integral i 
=> ConvergenceRate 
-> DecimalDigits

The additional number of correct decimal digits.

-> i 
  • The predicted number of terms which must be extracted from a series, if it is to converge to the required accuracy, at the specified linear convergence-rate.
  • The convergence-rate of a series, is the error in the series after summation of (n+1)th terms, divided by the error after only n terms, as the latter tends to infinity. As such, for a convergent series (in which the error get smaller with successive terms), it's value lies in the range 0 .. 1.
  • http://en.wikipedia.org/wiki/Rate_of_convergence.

promote :: Num n => n -> DecimalDigits -> nSource

Promotes the specified number, by a number of DecimalDigits.

simplifySource

Arguments

:: RealFrac operand 
=> DecimalDigits

The number of places after the decimal point, which are required.

-> operand 
-> Rational 
  • Reduces a Rational to the minimal form required for the specified number of fractional decimal places; irrespective of the number of integral decimal places.
  • A Rational approximation to an irrational number, may be very long, and provide an unknown excess precision. Whilst this doesn't sound harmful, it costs in performance and memory-requirement, and being unpredictable isn't actually useful.