Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell98 |

`AUTHOR`

- Dr. Alistair Ward
`DESCRIPTION`

- Defines the unit with which precision is measured, and operations on it.

- type ConvergenceOrder = Int
- type ConvergenceRate = Double
- type DecimalDigits = Int
- linearConvergence :: ConvergenceOrder
- quadraticConvergence :: ConvergenceOrder
- cubicConvergence :: ConvergenceOrder
- quarticConvergence :: ConvergenceOrder
- getIterationsRequired :: Integral i => ConvergenceOrder -> DecimalDigits -> DecimalDigits -> i
- getTermsRequired :: Integral i => ConvergenceRate -> DecimalDigits -> i
- roundTo :: (RealFrac a, Fractional f) => DecimalDigits -> a -> f
- promote :: Num n => n -> DecimalDigits -> n
- simplify :: RealFrac operand => DecimalDigits -> operand -> Rational

# Types

## Type-synonyms

type ConvergenceOrder = Int Source

The *order of convergence*; http://en.wikipedia.org/wiki/Rate_of_convergence.

type ConvergenceRate = Double Source

The *rate of convergence*; http://en.wikipedia.org/wiki/Rate_of_convergence.

type DecimalDigits = Int Source

A number of decimal digits; presumably positive.

# Constants

linearConvergence :: ConvergenceOrder Source

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

quadraticConvergence :: ConvergenceOrder Source

*Quadratic* convergence-rate.

cubicConvergence :: ConvergenceOrder Source

*Cubic* convergence-rate.

quarticConvergence :: ConvergenceOrder Source

*Quartic* convergence-rate.

# Functions

:: 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*.

:: 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.

roundTo :: (RealFrac a, Fractional f) => DecimalDigits -> a -> f Source

Rounds the specified number, to a positive number of `DecimalDigits`

.

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

Promotes the specified number, by a positive number of `DecimalDigits`

.

:: 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.