0% found this document useful (0 votes)
14 views2 pages

13th Jan: Conjugate

The document contains a Python script that defines a function to determine if a given function u is harmonic and to find its harmonic conjugate. The script uses the sympy library for symbolic mathematics and allows user input for the function. Several examples demonstrate the function's capability to classify functions as harmonic or not and compute their conjugates.

Uploaded by

ranjithplaygames
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

13th Jan: Conjugate

The document contains a Python script that defines a function to determine if a given function u is harmonic and to find its harmonic conjugate. The script uses the sympy library for symbolic mathematics and allows user input for the function. Several examples demonstrate the function's capability to classify functions as harmonic or not and compute their conjugates.

Uploaded by

ranjithplaygames
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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 ​

You might also like