I am using the following code - but not getting the phase back in the original form (3.366):
import math
import numpy as np
import cmath
Magn = 0.786236
Phase = 3.366
cohs = Magn * math.cos(Phase) + 1j*Magn*math.sin(Phase)
Magn_value = np.absolute(cohs)
Phase_value = np.angle(cohs)
print(alpha_value)
print(phase_value)
The Magnitude is returned correctly, the phase is, however, returned as -2.9.. Why is that, and how can the original phase value be retrieved?
Look at the documentation for the angle
method: you get the phase expressed in a given range, -π to +π. If you want it in the more positive range 0 to 2π, simply add 2π to any negative value.