Skip to content
Quantoros

A least-squares model has m complex residuals and n complex unknowns. How can it be represented for a solver accepting…

MathematicsLevel: IntermediateNonlinear least squares

A least-squares model has m complex residuals and n complex unknowns. How can it be represented for a solver accepting only real variables and residuals?

Hints
  • Each complex coordinate contains two independent real coordinates.
  • Expand the squared magnitude of a+bi before choosing the residual vector.

Answer

Split the unknowns into 2n real coordinates and return 2m real residual components by stacking real and imaginary parts. Their sum of squares equals the sum of squared complex magnitudes; dropping the imaginary parts would change the objective.

Source and licence: SciPy — nonlinear least squares · BSD-3-Clause · answer: Quantoros editorial

Related questions