Complex Analysis - Jupyter Notebook
Complex Analysis - Jupyter Notebook
2 re (𝑧) im (𝑧)
VERIFY CAUCHY-RIEMANN EQUATIONS
x, y = sp.symbols('x y')
u = x**3 - 3*x*y**2
v = 3*x**2*y - y**3
is_analytic, eqn1, eqn2 = verify_CR_equation(u, v, x, y)
print('u_x = ',sp.diff(u, x))
print('u_y = ',sp.diff(u, y))
print('v_x = ',sp.diff(v, x))
print('v_y = ',sp.diff(v, y))
if is_analytic:
print('The function satisfies the CR equations and is analytic')
else:
print('The function does not satisfies the CR equations and is not analytic')
print(f"CR equation 1 : {eqn1}")
print(f"CR equation 2 : {eqn2}")
Partial derivatives:
u_x : 2*x
u_y : -2*y
v_x : 2*y
v_y : 2*x
Cauchy-Riemann equations:
u_x - v_y = 0
u_y + v_x = 0
Partial derivatives:
u_x : 3*x**2 - 3*y**2
u_y : -6*x*y
v_x : 6*x*y
v_y : 3*x**2 - 1
Cauchy-Riemann equations:
u_x - v_y = 1 - 3*y**2
u_y + v_x = 0
The function does not satisfy the Cauchy-Riemann equations and is not analytic.
HARMONIC FUNCTION
u_xx = 2
u_yy = -2
u_xx + u_yy = 0
The function is harmonic
In [7]: import sympy as sp
x, y = sp.symbols('x y')
u = x**2 - y**3
u_xx = sp.diff(u,x,x)
u_yy = sp.diff(u,y,y)
Laplacian = u_xx + u_yy
print('u_xx = ', u_xx)
print('u_yy = ', u_yy)
print('u_xx + u_yy = ', Laplacian)
if Laplacian == 0:
print('The function is harmonic')
else:
print('The function is not harmonic')
u_xx = 2
u_yy = -6*y
u_xx + u_yy = 2 - 6*y
The function is not harmonic
v_y = u_x
v_x = -u_y
v1 = sp.integrate(v_y,y)
g = sp.integrate(sp.diff(v1,x)-v_x, x)
print('g(x) = ',g)
v=v1+g
v = sp.symbols('c')+v
return v
x, y = sp.symbols('x y')
u = x**2 - y**2
v = find_harmonic_conjugate(u,x,y)
print("The harmonic conjugate of u(x,y) is :")
display(v)
g(x) = 0
The harmonic conjugate of u(x,y) is :
𝑐 + 2𝑥𝑦
v_y = u_x
v_x = -u_y
v1 = sp.integrate(v_y,y)
c = sp.integrate(sp.diff(v1,x)-v_x, x)
v=v1+c
v = v + sp.symbols('c')
return v
x, y = sp.symbols('x y')
u = x**3-3*x*y**2
v = find_harmonic_conjugate(u,x,y)
print("The harmonic conjugate of u(x,y) is :")
display(v)
𝑐 + 3𝑥2 𝑦 − 𝑦3