Search code examples
matlabsymbolic-math

Solve a symbolic quartic equation in matlab


I try to solve a quartic function in Matlab using the Symbolic Math Toolbox. Example:

syms x c1 c2 c3
solve(x^4+c1*x^3+c2*x^2+c3,x)

AFAIK, there should not be a problem in solving quartic equations analytically (example). However, instead of the desired roots, Matlab returns

ans=

RootOf(X9^4 + X9^3*c1 + X9^2*c2 + c3, X9)

Any idea how to symbolically find the roots?

Thanks.


EDIT: Thanks to Luis Mendo for his answer. Unhappily, I am using Matlab R2010b, which does not support the 'MaxDegree' parameter.


Solution

  • According to the doc, you should use the 'MaxDegree' option of solve (if your Matlab version supports it):

    s = solve(x^4+c1*x^3+c2*x^2+c3==0, x, 'MaxDegree', 4);
    pretty(s)