파이썬[Python]: cmath - phase 함수

cmath 모듈 - phase 함수(function)


/// 설명

복소수 x 의 위상(phase)을 반환합니다.
math.atan2(x.imag, x.real) 과 동일합니다.

※ 형식
cmath.phase(x)

reference
https://docs.python.org/3/library/cmath.html#module-cmath

/// 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cmath
 
print(cmath.phase(complex(0.00.0)))  # 0.0
print(cmath.phase(complex(1.00.0)))  # 0.0
print(cmath.phase(complex(-0.01.0)))  # 1.5707963267948966
print(cmath.phase(complex(-1.01.0)))  # 2.356194490192345
print(cmath.phase(complex(0.0-0.0)))  # -0.0
print(cmath.phase(complex(1.0-0.0)))  # -0.0
print(cmath.phase(complex(-0.0-1.0)))  # -1.5707963267948966
print(cmath.phase(complex(-1.0-1.0)))  # -2.356194490192345
 
 
# phase : an angle-like quantity - https://ko.wikipedia.org/wiki/%EC%9C%84%EC%83%81
#
# equivalent to math.atan2(x.imag, x.real)
#               math.atan2(   y  ,   x   ) (x=0, y=0, undefined)
#
# 0, pi/2, pi, 3*pi/2, ...
# pi = 3.1415926535...
 
 
cs

* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수