Module for plotting complex-valued functions of complex variable using different methods.
A script for generating the following examples can be found at examples.py
.
To use this module just place the script cplotting_tools.py
in your working directory. It can be imported like this:
import cplotting_tools as cplt
In this first set of examples the test function is the following one:
We start defining the variables and parameters for these first examples:
import numpy as np
N = 100
lim = 3
x, y = np.meshgrid(np.linspace(-lim,lim,N),
np.linspace(-lim,lim,N))
z = x + 1j*y
The code of the function , f
, and its set of poles and zeros, pts
, looks like this:
f = (z**2-1)*(z-2-1j)**2/(z**2+2+2j)
pts = [-1, 1, 2+1j, 2**(3/4)*np.exp(1j*(5*np.pi/8)), 2**(3/4)*np.exp(1j*(5*np.pi/8+np.pi))]
Then, we can use the functions defined in cplotting_tools.py
to generate, for example, the following plots:
In this second set of examples the test function is:
As we did in the first set of examples, we start defining the variables, the parameters and the function:
N = 40
lim = 6
x, y = np.meshgrid(np.linspace(-lim,lim,N),
np.linspace(-lim,lim,N))
z = x + 1j*y
f = np.cos(z)
Then, we could obtain the following plots:
If you are a beginner with complex functions you might also find useful: "Plotting Complex Variable Functions".
I would also like to recommend an online interactive book by Juan Carlos Ponce Campuzano called "COMPLEX ANALYSIS - A Visual and Interactive Introduction".