复数是高中知识,可我没上过高中,编程要用到,我用的python复数是怎么计算的,复数后面的j是什么意思___________________________________________________________________________...
复数是高中知识,可我没上过高中,编程要用到,我用的python复数是怎么计算的,复数后面的j是什么意思______________________________________________________________________________________________a=3b=4c=5.66d=8.0e = complex(c,d)f = complex(float(a),float(b))print("a is type: ",type(a))print("b:",type(b))print("c:",type(c))print("d",type(d))print(("e:"),type(e))print("f:",type(f))print("\n")print(a+b)print(b/a)print(b//a)print(e)print(e+f)______________________________________________________________________________________________上面是代码,下面试运行结果______________________________________________________________________________________________a is type: b: c: d e: f: 1.413427561837455970(5.66+8j)(8.66+12j)
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> help(complex)
Help on class complex in module builtins:
class complex(object)
| complex(real[, imag]) -> complex number
|
| Create a complex number from a real part and an optional imaginary part.
| This is equivalent to (real + imag*1j) where imag defaults to 0.
|
| Methods defined here:
|
| __abs__(self, /)
省略.....
展开