Solve not finding trivial zero
4 Ansichten (letzte 30 Tage)
HiWave am 30 Aug. 2019
I have a symbolic function
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)
1.1011196125836762425306399367927 - 3.1220589588466888838496981405409*i
- 1.1011196125836762425306399367927 - 3.1220589588466888838496981405409*i
1.1011196125836762425306399367927 + 3.1220589588466888838496981405409*i
- 1.1011196125836762425306399367927 + 3.1220589588466888838496981405409*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?
John D'Errico am 30 Aug. 2019
Bearbeitet: John D'Errico am 30 Aug. 2019
As always, you absolutely need to tell what release you are using, because this works with no problem. Done using R2019a:
f = -25*x*(- 32*x^10 + 660*x^8 + 27400*x^6 + 304500*x^4 + 900000*x^2 - 2671875);
R = solve(f == 0,x);
- 1.101119613 - 3.122058959i
- 1.101119613 + 3.122058959i
1.101119613 + 3.122058959i
1.101119613 - 3.122058959i
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.