find_correct_sign

find_correct_sign(z1, z2, z_approx)[source]

Create new vector from z1, z2 choosing elements with sign matching z_approx.

This is used when you have to make a root choice on a complex number. and you know the approximate value of the root.

\[z1,z2 = \pm \sqrt(z^2)\]
Parameters:
  • z1 (array-like) – Root 1.

  • z2 (array-like) – Root 2.

  • z_approx (array-like) – Approximate answer of z.

Returns:

z3 – Array built from z1 and z2 by z1 where sign(z1) == sign(z_approx), z2 else.

Return type:

np.array