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

cmath 모듈 - polar 함수(function)


/// 설명

극좌표계에서의 x 를 표현하며, (거리, 각도) 를 반환합니다.(abs(x), phase(x))

참고: cmath.phase()

※ 형식
cmath.polar(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
import cmath
 
print(cmath.polar(complex(10)))  # (1.0, 0)
print(cmath.polar(complex(11)))  # (1.4142135623730951, 0.7853981633974483)
print(cmath.polar(complex(01)))  # (1.0, 1.5707963267948966)
print(cmath.polar(complex(-11)))  # (1.4142135623730951, 2.356194490192345)
print(cmath.polar(complex(-10)))  # (1.0, 3.141592653589793)
print(cmath.polar(complex(-1-1)))  # (1.4142135623730951, -2.356194490192345)
print(cmath.polar(complex(0-1)))  # (1.0, -1.5707963267948966)
print(cmath.polar(complex(1-1)))  # (1.4142135623730951, -0.7853981633974483)
 
# polar coordinates: https://ko.wikipedia.org/wiki/%EA%B7%B9%EC%A2%8C%ED%91%9C%EA%B3%84
# tuple = ( distance, angle )
#
# z = a + bi
# distance = |z| = sqrt(a^2 + b^2), sqrt is squart root
 
cs

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


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

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

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

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

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

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