allroots
functions with variable coefficients also, but only,
if the polynomials degree
in the main variable is smaller than 3, or it is biquadratic.
If roots of other variables x
are searched, one should use the more
general solve(p,x)
, which will be discussed in more detail later.
>> syms x,z >> y = x*z^2-3*x*z+(2*x+1); >> allroots(y) ans = [ sqrt((1/4*x-1)/x)+3/2 -sqrt((1/4*x-1)/x)+3/2 ] >> solve(y,x) ans = -1/(z^2-3*z+2)