Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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


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

How can that be?

Thanks for any help!

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

share|improve this question
Add WorkingPrecision -> 20 to NSolve, or use Solve. – Sjoerd C. de Vries Jun 4 '14 at 13:10
up vote 1 down vote accepted

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.881804502096507338262550159650160849077944540375990660447`19.522878745280337}, {k \[Rule] -0.065405554370487539402286205663266109496635258365570796624`19.522878745280337+0.053716555213638053292679360620515250137280758369776306496`19.522878745280337 \[ImaginaryI]},{k \[Rule] -0.065405554370487539402286205663266109496635258365570796624`19.522878745280337-0.053716555213638053292679360620515250137280758369776306496`19.522878745280337 \[ImaginaryI]}} *)

(* {k \[Rule] 0.8818045020741043`} *)
share|improve this answer
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 '14 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 '14 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 '14 at 13:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.