0.0.4 • Published 3 years ago

@lkarabeg/bisection-method v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Bisection method root finder

Attempts to find a root of an input function within a given boundary interval, using the bisection method.

To work, it requires that the function values have opposite signs at each end of the boundary interval, and that there is only one root within the interval.

Install

npm install @lkarabeg/bisection-method

Use

import findRoot, { BisectionMethodLogLevel } from "@lkarabeg/bisection-method"

const myFunction = (x: number) => Math.log(x)

const lowerBound = 0
const upperBound = 3
const options = { logging: BisectionMethodLogLevel.results }

const result = findRoot(myFunction, lowerBound, upperBound, options)
console.log(result) // 1

Options

OptionTypeDefaultComment
tolerancenumber1e-12
maxIterationsnumber100
loggingenumnone (no logging)Set the log level to none (default), results or debug. Import the BisectionMethodLogLevel enum to use
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago