@nexys/math-ts
Version:
[](https://www.npmjs.com/package/@nexys/math-ts) [](https://travis-ci.com/github/Nexysweb/math-ts) [ • 690 B
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const Timevalue = __importStar(require("./timevalue"));
const Zeros = __importStar(require("../zeros"));
exports.price = (c, n, i, m) => m * Timevalue.pv(i, n) + c * Timevalue.pvMulti(i, n);
exports.yieldToMaturity = (c, n, m, p) => {
const f = (x) => -p + exports.price(c, n, x, m);
return Zeros.secant([-.2, 1.5], f);
};