| @@ 276-292 (lines=17) @@ | ||
| 273 | /** |
|
| 274 | * @return string [Value of a single debt repayment instance as a string] |
|
| 275 | */ |
|
| 276 | public function getDebtSingleRepayment() |
|
| 277 | { |
|
| 278 | // single repayment 'K = PV/((1-v^n)/i)' |
|
| 279 | return MathFuncs::div( |
|
| 280 | $this->debtPrincipal, |
|
| 281 | MathFuncs::div( |
|
| 282 | MathFuncs::sub( |
|
| 283 | 1, |
|
| 284 | MathFuncs::pow( |
|
| 285 | $this->getDebtDiscountFactor(), |
|
| 286 | $this->debtNoOfCompoundingPeriods |
|
| 287 | ) |
|
| 288 | ), |
|
| 289 | $this->debtInterest |
|
| 290 | ) |
|
| 291 | ); |
|
| 292 | } |
|
| 293 | ||
| 294 | /** |
|
| 295 | * @return string [Value of a single debt repayment instance as a string] |
|
| @@ 297-313 (lines=17) @@ | ||
| 294 | /** |
|
| 295 | * @return string [Value of a single debt repayment instance as a string] |
|
| 296 | */ |
|
| 297 | public function getDebtSingleRepayment_Rounded() { |
|
| 298 | // single repayment 'K = PV/((1-v^n)/i)' |
|
| 299 | return MathFuncs::round_up( |
|
| 300 | MathFuncs::div( |
|
| 301 | $this->debtPrincipal, |
|
| 302 | MathFuncs::div( |
|
| 303 | MathFuncs::sub( |
|
| 304 | 1, |
|
| 305 | MathFuncs::pow( |
|
| 306 | $this->getDebtDiscountFactor(), |
|
| 307 | $this->debtNoOfCompoundingPeriods |
|
| 308 | ) |
|
| 309 | ), |
|
| 310 | $this->debtInterest |
|
| 311 | ) |
|
| 312 | ), 2); |
|
| 313 | } |
|
| 314 | ||
| 315 | /** |
|
| 316 | * @return RepaymentInstance[] [Array of individual debt repayments (RepaymentInstances)] |
|