I'm trying to implement Laguerre's method for following equation:
1/(99*x+1)=2
. (general form is more complex - polynomial of n-th degree 1/(a*x+1)+...+1/(z*x+1)=res
) where a,b,...z>=0
and 0<res<N
but it quickly terminates and goes to infinity.
Solution for this case is very simple - -0.00505050505050505
.
Since they say that Laguerre's method is working in 99.999% of cases, I hope this is not that 0.001?
Is there some other way that I could use to polynomial roots that is working in all cases? I need just one real root (and there is always 1 in my case).
Laguerres method works for polynomials exclusively, so you need to first transform your expressions into a polynomial form. Your first equation then becomes linear, which any method solves in one step. Your general problem has the form 1/x*q'(1/x)/q(1/x)=res
with q(z)=(z+a1)*...*(z+an)
, so that the polynomial is z*q'(z)-res*q(z)
or x^(n-1)*q'(1/x)-res*x^n*q(1/x)
.
If you want a third order method for general functions, try the Halley method.