(poly)
| 579 | return result.length == 1 ? result[0] : result |
| 580 | } |
| 581 | derivate(poly) { |
| 582 | if (poly.type != 'polynomial') { |
| 583 | throw "TheoremJS: Derivative: Not a polynomial" |
| 584 | } |
| 585 | let values = [] |
| 586 | const arr = poly.values.reverse() |
| 587 | for (let i = 0; i < arr.length; i++) { |
| 588 | values.push(i * arr[i]) |
| 589 | } |
| 590 | values.reverse() |
| 591 | values.pop() |
| 592 | const out = values.filter(a => !isNaN(a)) |
| 593 | |
| 594 | return this.polynomial(...out) |
| 595 | } |
| 596 | f(v, func) { |
| 597 | if (typeof v == 'function') { |
| 598 | return { |
no test coverage detected