# Levenberg-Marquardt¶

The Levenberg-Marquardt iterative method is often used to solve non-linear least squares problems. in those problems one reduces the calculated error by iteratively solving a system of equations that provides the increment to add to the solution in order to decrease the solution error. So conceptually it applies to the power flow problem.

Set the initial values:

In every iteration:

- Compute the jacobian matrix if ComputeH is true:

- Compute the mismatch in the same order as the jacobian:

- Compute the auxiliary jacobian transformations:

- Compute the first value of (only in the first iteration):

- Compute the system Matrix:

- Compute the linear system right hand side:

- Solve the system increment:

- Compute the objective function:

- Compute the decision function:

Update values:

If

- Update the voltage solution using .

Else

Compute the convergence:

As you can see it takes more steps than Newton-Raphson. It is a slower method, but it works better for ill-conditioned and large grids.