Write a Python function called polynomial derivative that takes a single argument coefficients , a list of…
Write a Python function called polynomial derivative that takes a single argument coefficients , a list of…: a task in repo2rlenv-r2e (Harbor dataset). For a polynomial of degree n with n+1 coefficients a n, a {n-1}, ..., a 1, a 0 , the derivative has n coefficients n a n, (n-1) a {n-1}, ..., 1 a…
The task
For a polynomial of degree n with n+1 coefficients [a_n, a_{n-1}, ..., a_1, a_0], the derivative has n coefficients [n*a_n, (n-1)*a_{n-1}, ..., 1*a_1]. The output list has length max(0, len(coefficients) - 1). For an empty input or a single-element input (constant polynomial), return an empty list.
Part of FineEnvs/repo2rlenv-r2e.