Home > other >  Python beginners
Python beginners

Time:09-21

C=1 + 5 j
Print (type (c))

# this code can output & lt; The class 'complex' & gt;
Five at the back of the j # but convert into other letters complains
# what this j represents

CodePudding user response:

1 + 5 j this type is useful, represent the imaginary mathematical

5 j is the imaginary part, 1 is in front of real component, is 1 + 0 j, but can not be a single j

CodePudding user response:

Say the plural imaginary part

CodePudding user response:

J is the name of the variable

CodePudding user response:

Short answer: Python c=1 + 5 j j said imaginary

A:

1. To understand basic math knowledge
Reference:
Real number
https://zh.wikipedia.org/wiki/
Number, in addition to the ordinary real number and imaginary number corresponding to the corresponding together called the plural
Plural=real number + imaginary

2. The corresponding Python language, with j said imaginary part
Grammar is:
Real + imag j
Or:
The complex (real, imag)

(3) corresponds to your code:
 c=1 + 5 j 

Also can be written as:
 c=complex (1, 5) 


Where j, said of the imaginary part, its value is 5

Appendix:
(1) science information
How to understand the imaginary number and plural? - zhihu
https://www.zhihu.com/question/46877027

(2)
Abstract base class Numbers - Numbers - Python 3.8.6 rc1 document
https://docs.python.org/zh-cn/3.8/library/numbers.html#numbers.Complex
The
reference
real
Abstract, get the real part of the digital,

Imag
Abstract, get the imaginary part of the digital,


(3) Python complex () function | novice tutorial
https://www.runoob.com/python/python-func-complex.html

  • Related