All problems
Routh-Hurwitz Stability Check
Problem
The cubic s^3 + a2*s^2 + a1*s + a0 is Hurwitz stable if and only if all coefficients are positive and a2*a1 > a0.
Given a2, a1, and a0, return True when the polynomial is stable and False otherwise.
Hint
The Routh array's first column must have no sign changes.
Test cases
case 1
in: [3,2,1]
expected: true
case 2
in: [1,2,3]
expected: false
case 3
in: [0,1,1]
expected: false
case 4
in: [2,1,1]
expected: true
case 5
in: [1,1,1]
expected: false
Starter codePython
def routh_hurwitz_cubic(a2, a1, a0):
# Your code here
pass5 test cases · run your code against them in the editor