MATLAB: Solve not finding trivial zero

polynomialsolve

I have a symbolic function
syms x
f = -25*x*(- 32*x^10 + 660*x^8 + 27400*x^6 + 304500*x^4 + 900000*x^2 – 2671875)
I want to solve for the zeros…
solve(f == 0,x)
and it returns an empty set. For some weird reason, if I divide f(x) by -25x, it spits out 10 complex roots as expected.
solve(f/(-25*x) == 0,x)
6.6919693149784015130684514768684
1.3248772524381469976203144660927
-1.3248772524381469976203144660927
-6.6919693149784015130684514768684
1.1011196125836762425306399367927 – 3.1220589588466888838496981405409*i
– 1.1011196125836762425306399367927 – 3.1220589588466888838496981405409*i
1.1011196125836762425306399367927 + 3.1220589588466888838496981405409*i
– 1.1011196125836762425306399367927 + 3.1220589588466888838496981405409*i
2.9737480666733788426010418554987*i
-2.9737480666733788426010418554987*i
If I recall, a 10th order polynomial is to large for an analytic solution, but I can not figure out why Matlab fails to find the trivial root x=0 ??? The reason why I ask this is because I'm trying to make plots for an arbitrary order polynomial. You give me an polynomial and I make the plot with a red X at the root locations. In the case above, I can see the roots exists in the plot, but unfortunately, Matlab fails to find the roots in my script using the solve command. How do fix this such that my script is more robust?

Best Answer

As always, you absolutely need to tell what release you are using, because this works with no problem. Done using R2019a:
syms x
f = -25*x*(- 32*x^10 + 660*x^8 + 27400*x^6 + 304500*x^4 + 900000*x^2 - 2671875);
R = solve(f == 0,x);
vpa(R,10)
ans =
0
-1.324877252
-2.973748067i
- 1.101119613 - 3.122058959i
- 1.101119613 + 3.122058959i
-6.691969315
1.324877252
2.973748067i
1.101119613 + 3.122058959i
1.101119613 - 3.122058959i
6.691969315
numel(R)
ans =
11
So 11 roots. As expected. One of which is zero. As expected.
It is possible that your real problem which is causing an issue also may be due to needing to expand some product (rather then doing the divide by x.) Or, it may be possible that you have an old release. We cannot know what issue you are tripping on, because MATLAB has no problem with what you claim to have done.