Files
python3-cookbook/cookbook/c03/p06_complex.py

24 lines
331 B
Python
Raw Normal View History

2014-09-11 12:04:06 +08:00
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: sample
Desc :
"""
2014-09-12 21:51:21 +08:00
import cmath
2014-09-11 12:04:06 +08:00
def complex_math():
a = complex(2, 4)
b = 3 - 5j
2014-09-12 21:51:21 +08:00
print(a.conjugate())
# 正弦 余弦 平方根等
print(cmath.sin(a))
print(cmath.cos(a))
print(cmath.sqrt(a))
2014-09-11 12:04:06 +08:00
if __name__ == '__main__':
complex_math()