sqrt_known_sign

sqrt_known_sign(z_squared, z_approx)[source]

Return the square root of a complex number, with sign chosen to match z_approx.

Parameters:
  • z_squared (number or array-like) – The complex to be square-rooted.

  • z_approx (number or array-like) – The approximate value of z. The sign of z is chosen to match that of z_approx.

Returns:

z – Square root of z_squared.

Return type:

number, array-like (same type as z_squared)