# Change the absolute and relative tolerance of newton solver

Dear all,

I used Newton solver to solve a nonlinear variational problem and the default absolute tolerance and relative tolerance of Newton solver were used. However, the computation did not converge after 500 iterations. I think I need to decrease the absolute and relative tolerance of Newton solver. But I do not know which value I should use. For example:

#values1:
prm["newton_solver"]["relative_tolerance"] = 1e-7
prm["newton_solver"]["absolute_tolerance"] = 1e-7
#values2:
prm["newton_solver"]["relative_tolerance"] = 1e-5
prm["newton_solver"]["absolute_tolerance"] = 1e-5


Which values are reasonable? Or are they both OK?
I appreciate any help.

Choosing larger tolerances when the nonlinear solver doesnâ€™t converge is in general not a good idea, unless the default tolerances were super small (which is not the case). In doing so, you may be able to trick the code into saying â€śthe nonlinear solverâ€ť has converged, but the reality remains that the solution you computed may still be bad, since the final residual is large (or, at the very least, not really small).

See Default absolute tolerance and relative tolerance for more comments.

Got it. Thank you very much, Ballarin. Besides, there are some parameters of Newton solvers that I do not understand, for example:

prm["newton_solver"]["lu_solver"]["symmetric"] = False
prm["newton_solver"]["relaxation_parameter"] = 1.0


I searched these two parameters but did not find explanations for them. Do you have any document, website, or textbook that explains the parameters of Newton solvers? Thank you very much.

prm["newton_solver"]["relaxation_parameter"] = 1.0

Newton method computes an increment \delta x, which you then need to add back to the previous solution x^{prev} to get the updated solution x^{updated} = x^{prev} + \delta x. In principle, you could also pick a step length \alpha \in \mathbb{R}^+ and decide that x^{updated} = x^{prev} + \alpha \delta x. The default is \alpha = 1.

prm["newton_solver"]["lu_solver"]["symmetric"] = False


This tells that the jacobian matrix is not symmetric. Youâ€™ll have to look into the implementation of the LU solver to see how that information is used.

1 Like

I understand now. Thank you very much, Ballarin.