I am trying to solve a polynomial equation of higher order with non-integer exponents. When the order of the system is greater than 4, FindRoot provides a correct solution that is not found by NSolve.

Here is a minimal example:

In:

Clear[k,sol1, a, G, j, l, equ];
a=0.3; G=4;
equ := k^(G(1 - a)) == (1-a)/G Sum[(G-j+1) a^(j-1) k^((G-j)(1-a)), {j, G}];
NSolve[equ, k]
sol1 = FindRoot[equ, {k, 1}]
equ /. sol1


Out:

{{k -> -0.0654054 + 0.0537165 I}, {k -> -0.0654054 - 0.0537165 I}}
{k -> 0.881805}
True


How can that be?

Thanks for any help!

PS: for G<4 everything is fine, for G>4 the same problem seems to persist

-
Add WorkingPrecision -> 20 to NSolve, or use Solve. –  Sjoerd C. de Vries Jun 4 at 13:10

It is a precision issue:

Clear[k, sol1, a, G, j, l, equ];
a = 3/10; G = 4;
equ = k^(G (1 - a)) == (1 - a)/
G Sum[(G - j + 1) a^(j - 1) k^((G - j) (1 - a)), {j, G}];
Solve[equ, k] // N
NSolve[equ, k, WorkingPrecision -> 20]
sol1 = FindRoot[equ, {k, 1}]

(* {{k \[Rule] -0.06540285694758019+0.053714761344886404 \[ImaginaryI]}, {k \[Rule] -0.0654028569475802-0.0537147613448864 \[ImaginaryI]}, {k \[Rule] 0.8818045020741044}} *)

(* {{k \[Rule] 0.88180450209650733826255015965016084907794454037599066044719.522878745280337}, {k \[Rule] -0.06540555437048753940228620566326610949663525836557079662419.522878745280337+0.05371655521363805329267936062051525013728075836977630649619.522878745280337 \[ImaginaryI]},{k \[Rule] -0.06540555437048753940228620566326610949663525836557079662419.522878745280337-0.05371655521363805329267936062051525013728075836977630649619.522878745280337 \[ImaginaryI]}} *)

(* {k \[Rule] 0.8818045020741043} *)
`
-
Thank you for the helpful and quick reply. By the time, I managed to solve the particular equation by substituting k^(1-a)=z. Then, the exponents are all integers and Mathematica quickly finds exact solution for even high values for g. –  Ben Jun 4 at 14:48
I am yet exploring Methematica, so I want to be sure to get it right: NSolve does not provide one out of three solutions unless we tell Mathematica too look for more precise solutions? How can I be sure that NSolve gives me all possible solutions in other, possibly more complex situations? How reliable is numerical equation solving with MachinePrecision? –  Ben Jun 5 at 11:14
If working on any serious problem, precision sensitivity testing should be used to build confidence in result. In particular, if results are "unexpected", one of the first areas to investigate is numerical noise/precision. To reduce issues: use symbolic calculations/simplifications until last feasible step; rationalize/simplify prior to using machine precision; use plots to obtain good initial values/verify results; look at available options for different methods that may provide better results; use the "See Also" section of documentation for alternate approaches that can be compared. –  Bob Hanlon Jun 5 at 13:21