# [petsc-dev] How to implement the damped Newton method

Jed Brown jed at jedbrown.org
Sat Feb 7 07:54:36 CST 2015

```Lulu Liu <lulu.liu at kaust.edu.sa> writes:

> X is the current approximate solution, Y is the Newton direction
>
> Step 1. the unknown X=[phi,omega,S], the third component S in [0,1]. Hence,
> we firstly compute a multiplier alpha such that
>
> X1= X-alpha*Y, and the component S of X1 is still in [0,1].
> In step1, we need access the component S to calculate multiplier.
>
> Step 2. Let the damping factor damp=1;
>
> for n=1:N
>
>     lambda=alpha*damp;
>     X1=X-lambda*Y;
>
>      Solve J(X1)Y1 = F(X1);
>
>      if ||Y1||<||Y||
>            break;
>       else
>             damp = damp/2;
>        end
> endfor

The above algorithm looks strange for a bunch of reasons (it's not
convergent, for one; are you sure you mean it exactly as written?), but
you could use a SNES pre-check and SNESLineSearchSetDamping or you can
write a SNESLineSearch implementation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150207/a4d73975/attachment.sig>
```