Complex numbers and fractals
First of all, we look at how Python handles complex numbers. It is a simple matter. For example, setting x = 5 + 4j
in Python, we must write the following:
>>> x = 5.+4j
It means that >>> x
is equal to 5+4j
.
At the same time, you can write the following:
>>> x = complex(5,4)
>>> x
(5+4j)
We also note that:
- Python uses
j
to mean√-1
instead ofi
in math. - If you put a number before the
j
, Python will consider it as an imaginary number, otherwise, its a variable. It means that if you want to write the imaginary numberi
, you must write1j
rather thanj
.
To get the real and imaginary parts of a Python complex number, you can use the following:
>>> x.real
5.0
>>> x.imag
4.0
>>>
We turn now to our problem, namely how to display ...
Get Getting Started with TensorFlow now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.