1.0.3 • Public • Published

    richardson-extrapolation Build Status npm version Dependency Status

    Use Richardson Extrapolation sequence acceleration to compute the order of convergence and exact value of a sequence


    Richardson Extrapolation is a numerical method that uses solutions at multiple values of a small parameter h (think: h = grid size) to accelerate the converenge of a sequence. To make that concrete, consider an method f(h) that approximates the value of f. Writing this as

    f(h) = f + c h^n + o(h^{n+1}),

    the unknowns are the exact value f, the error constant c, and the order of convergence n.

    In its current form, this module solves for two of three unknowns using the solution at two parameter sizes h. So for example, given the the order of convergence n, you may approximate the exact value f (with error of order o(h^{n+1})), or given the exact value f, you may solve for the order of convergence n.

    The solution of all three unknowns requires the solution of a set of three nonlinear equations and is not implemented yet. :(


    $ npm install richardson-extrapolation


    var richardson = require('richardson-extrapolation')
    // Exact value = 3.5
    // Order of convergence = 3
    function func( h ) {
      return 3.5 + 2.0 * Math.pow( h, 3 )
    // Solve for the order of convergence:
    richardson( func, 1, { f: 3.5 } )
    // => { f: 3.5,  n: 3,  c: 2 }
    // Approximate the the exact value given order of convergence:
    richardson( func, 1, { n: 3 } )
    // => { f: 3.5,  n: 3,  c: 2 }


    require('richardson-extrapolation')( func, h, knowns )


    • func: a function that takes small parameter h as its only argument
    • h: either a starting parameter size or a set of parameter sizes
      • if a number, then h is subdivided by a factor of 2 as needed t solve for the unknowns
      • if an array of numbers, then the first n are used as values of h in order solve for n unknowns
    • knowns: a hash of known parameters. Possibilities are:
      • n provided (solves for f and c)
      • f provided (solves for n and c)

    Returns: A hash containing three values: the approximated exact value f, order of convergence n, and the constant of the error term c.


    Implement nonlinear simultaneous equation solver as a separate module in order to solve for all three unknowns.


    (c) 2015 Ricky Reusser. MIT License


    npm i richardson-extrapolation

    DownloadsWeekly Downloads






    Last publish


    • jaspervdg
    • mikolalysenko
    • planeshifter
    • rreusser