Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grossvogel/4c73a2f66e38c841c3dde2da08a59266 to your computer and use it in GitHub Desktop.
Save grossvogel/4c73a2f66e38c841c3dde2da08a59266 to your computer and use it in GitHub Desktop.
class Polynomial {
//...
get derivative() {
const newCoefficients = this.coefficients
.map((coefficient, degree) => coefficient * degree)
.slice(1);
return new Polynomial(newCoefficients);
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment