Socket
Book a DemoInstallSign in
Socket

richardson-extrapolation

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

richardson-extrapolation

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

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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

Introduction

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

Install

$ npm install richardson-extrapolation

Example

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 }

API

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

Arguments:

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

TODO

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

Credits

(c) 2015 Ricky Reusser. MIT License

Keywords

scijs

FAQs

Package last updated on 01 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts