13th Jan
In [7]: 1 from numpy import *
2 from sympy import *
3 import math
4 def conjugate():
5 init_printing(use_latex=True)
6 x,y,c=symbols("x,y,c")
7 f=input("Enter the function u:")
8 print("")
9 dx2=diff(f,x,2)
10 dy2=diff(f,y,2)
11 if dx2 + dy2==0:
12 print("The function ",f,"is harmonic")
13 else:
14 print("The function ",f,"is not harmonic")
15 return
16 dvx=diff(f,x)
17 dvy=diff(f,y)
18 ivx=integrate(dvx,y)
19 ivy=(-integrate(dvy,x))
20 v=ivx+ivy
21 print("The harmonic conjugate of u is :")
22 display(v)
In [8]: 1 conjugate()
Enter the function u:x*y
The function x*y is harmonic
The harmonic conjugate of u is :
− 𝑥22 + 𝑦22
In [9]: 1 conjugate()
Enter the function u:x**3-3*x*y**2
The function x**3-3*x*y**2 is harmonic
The harmonic conjugate of u is :
6𝑥2 𝑦 − 𝑦3
In [10]: 1 conjugate()
Enter the function u:exp(x)*sin(x)+x**2-y**2
The function exp(x)*sin(x)+x**2-y**2 is not harmonic
In [11]: 1 conjugate()
Enter the function u:exp(x)*cos(y)
The function exp(x)*cos(y) is harmonic
The harmonic conjugate of u is :
2𝑒𝑥 sin(𝑦)
In [13]: 1 conjugate()
Enter the function u:y/(x**2+y**2)
The function y/(x**2+y**2) is not harmonic
In [ ]: 1