UNPKG

@nexys/math-ts

Version:

[![npm version](https://badge.fury.io/js/%40nexys%2Fmath-ts.svg)](https://www.npmjs.com/package/@nexys/math-ts) [![TavisCI](https://travis-ci.com/Nexysweb/tableau-wdc-react.svg?branch=master)](https://travis-ci.com/github/Nexysweb/math-ts) [![Deployment](

17 lines (16 loc) 690 B
"use strict"; 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); };