Thank you for all the answers.
At the end the easiest way was to calculate first the discriminant of thee polynomio for a range of k and then use the roots function to calculate the solution. In this way I have better control on the expected solutions since the discriminant will tell me if I should have all real roots or real and complex conjugates one.