MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / derivate

Method derivate

__test__/theorem.js:581–595  ·  view source on GitHub ↗
(poly)

Source from the content-addressed store, hash-verified

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 {

Callers 1

test.jsFile · 0.80

Calls 2

polynomialMethod · 0.95
reverseMethod · 0.80

Tested by

no test coverage detected