UNPKG

nsolvejs

Version:

Solve equations using numerical methods

17 lines (14 loc) 306 B
const xintersection = require('./Xintersection'); module.exports = function (A, B, f, presicion) { const x = xintersection(A, B); const y = f(x); if (Math.abs(y) <= presicion) return x; const test = A.y * y < 0; if (test) { B.x = x; B.y = y; } else { A.x = x; A.y = y; } };