I am using python with scipy for writing some code to converge Cartesian coordinates to Kepler elements and the other way round.
For converting Cartesian to Kepler I use the following expression:
E = scopt.newton(self.f, self.M, self.df, args=(), tol=10^(-10), maxiter=10000)
with
self.f = lambda x: x-self.e*scipy.sin(x)-self.M
self.df= lambda x: 1-self.e*scipy.cos(x)
When running the entire code I get the error:
RuntimeError: Failed to converge after 10000 iterations, value is 5.25182613825
If I run it for less iterations (50), I get:
RuntimeError: Failed to converge after 50 iterations, value is 5.25182613825
Comparing the two values it obviously converges. Even if I reduce the tolerance to 10^(-2) i still get the same runtime error.
Does anybody knows why this error occurs?
The exponentiation operator in Python is
**. Usetol=10**(-10)or1E-10.^is bitwise XOR.