1.1.3 • Published 8 years ago

dichotomy v1.1.3

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

dichotomy(f, a, b) ⇒ number | Promise.<number>

dichotomy.js Dichotomy algorithm: given a function f : x -> f(x) and two numbers a, b find y such that a < y < b and f(y) = 0

Kind: global function
Returns: number | Promise.<number> - y, such that f(y) == 0

ParamTypeDefaultDescription
ffunctiona function that takes a number and returns a number or a Promise
aNumber-Number.MAX_VALUEStart of the search interval
bNumberNumber.MAX_VALUEEnd of the search interval

Example

dichotomy(x => x*x-2, 0, 10) == Math.sqrt(2)
dichotomy(x => Promise.resolve(x*x-2), 0, 10) == Promise.resolve(Math.sqrt(2))
1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago