Semester 6
Complex Analysis
Practical File
NAME : SHREEJI
COURSE: MATHS HONS (3rd year)
SECTION:A
ROLL NO. :15032563057
INDEX
[Link]. Name of the Practical
1. To compute the poles and corresponding residues of complex
functions.
2. To compute the integral over a straight line path.
3. Declaring complex numbers and graphical representation.
4. Algebra of complex numbers.
5. To find modulus, conjugate and face angle of an array of
complex numbers.
6. Contour Integration.
7. Plot the complex function and analyze the graph.
8. Taylor’s Series expansion of a given function at a given point.
9. To perform Laurent Series expansion.
Q. 1 To compute the poles and corresponding residues of
complex functions.
1. 4Z+1/Z2-Z-2
>>num=[4 1]
num =
4 1
>>den=[1 -1 -2]
den =
1 -1 -2
>> [r,p,k]=residue(num,den)
r=
p=
-1
k=
[]
2. 4Z+3/2Z3-3.4Z2+1.98Z-0.408
>>num=[4 3]
num =
4 3
>>den=[2 -3.4 1.98 -0.408]
den =
2.0000 -3.4000 1.9800 -0.4080
>> [r,p,k]=residue(num,den)
r=
32.5402
-16.2701 +12.3344i
-16.2701 -12.3344i
p=
0.7118
0.4941 + 0.2061i
0.4941 - 0.2061i
k=
[]
3. 2Z+1/Z3+5Z2+8Z+4
>>num=[2 1]
num =
2 1
>>den=[1 5 8 4]
den =
1 5 8 4
>> [r,p,k]=residue(num,den)
r=
1.0000
3.0000
-1.0000
p=
-2.0000
-2.0000
-1.0000
k=
[]
Q.2. To compute the integral over a straight line path
%AIM- TO PERFORM LINE INTEGRATION
% Compute integral over a straight line path between two
specified points
%f=z+1, where C is the straight line path from -1+i to 2-i
function line_integration
syms t;
x=t;
y=(1-2*t)/3;
z=x+i*y;
f=z+1;
integrand=f*diff(z,t);
F=int(integrand,'t',-1,2)
Q3) Declaring complex numbers and graphical representation
Function plot_complex_no
z1=3+2*i;
z2=7-4*i;
plot(z1,'*');
hold on;
plot(z2,'*');
hold off;
end
Q4) Algebra of complex numbers
Function algebra_complexno
z1=3+2*i;
z2=7-4*i;
z3=z1+z2;
z4=z1-z2;
z5=z1*z2;
z6=z1/z2;
str1=['Sum of the complex numbers is:' num2str(z3)];
str2=['Difference of the complex numbers is:' num2str(z4)];
str3=['Product of the complex numbers:' num2str(z5)];
str4=['Division in the complex numbers gives:' num2str(z6)];
disp(str1);
disp(str2);
disp(str3);
disp(str4);
end
>>algebra_complexno
Sum of the complex numbers is:10-2i
Difference of the complex numbers is:-4+6i
Product of the complex numbers:29+2i
Division in the complex numbers gives:0.2+0.4i
>>
Q5) To find modulus, conjugate and face angle of an array of
complex numbers
Function complex_array
z=input('enter the complex numbers: ');
absolute = abs(z);
conjugate = conj(z);
theta = angle(z);
str1 = ['the absolute value of the complex number is: ' num2str(absolute)];
str2 = ['the conjugate of the complex number is: ' num2str(conjugate)];
str3 = ['the phase angle of the complex number is: ' num2str(theta)];
disp(str1);
disp(str2);
disp(str3);
end
output
>>complex_array
enter the complex numbers: [1+2i, 3+5i, -2-7i]
the absolute value of the complex number is: 2.2361 5.831 7.2801
the conjugate of the complex number is: 1-2i 3-5i -2+7i
the phase angle of the complex number is: 1.1071 1.0304 -1.8491
Q.6 Contour Integration
function contour_integration1
symst;
y=t;
x=t^2+1;
z=x+i*y;
f=z.^2-2.*z+1;
integrand=f*diff(z,t);
answer=int(integrand,'t',-2,2)
>> contour_integration1
answer =
176/3*i
function contour_integration2
symst;
y=sin(t);
x=cos(t);
z=x+i*y;
f=z.^3+2.*z.^2+1;
integrand=f*diff(z,t);
answer=int(integrand,'t',0,2*pi)
>> contour_integration2
answer =
function contour_integration3
symst;
x=t;
y=(-2*t+1)/3;
z=x+i*y;
f=z+1;
integrand=f*diff(z,t);
answer=int(integrand,'t',1,-1)
>> contour_integration3
answer =
-22/9+2/3*i
Q. 7 Plot the complex function and analyze the graph
Function complexgrid
z=cplxgrid(40);
cplxmap(z,real(z))
figure
cplxmap(z,imag(z))
1
1
0.5
0.5
0
0
-0.5
-0.5
-1
-1
1 1
0.5 1 0.5 1
0 0.5 0.5
0
0 0
-0.5 -0.5 -0.5 -0.5
-1 -1 -1 -1
function complexgrid2
z=cplxgrid(40);
cplxmap(z,real(z.^2))
figure
cplxmap(z,imag(z.^2))
1
0.5
0.5
0
0
-0.5
-0.5
-1
-1 1
1
0.5 1
0.5 1
0 0.5
0 0.5
0 0
-0.5 -0.5 -0.5
-0.5
-1 -1 -1 -1
function complexgrid3
z=cplxgrid(40);
cplxmap(z,real(z.^3))
figure
cplxmap(z,imag(z.^3))
1
0.5
0.5
0
0
-0.5
-0.5
-1
-1 1
1
0.5 1
0.5 1 0.5
0.5 0
0 0
0 -0.5
-0.5 -0.5
-0.5
-1 -1 -1 -1
function complexgrid4
z=cplxgrid(40);
cplxmap(z,real((z.^4-1).^(1/4)))
figure
cplxmap(z,imag((z.^4-1).^(1/4)))
1
0.8
0.6 0.5
0.4 0
0.2 -0.5
0
1 -1
1
0.5 1
0.5 1
0 0.5
0 0.5
0 0
-0.5 -0.5 -0.5 -0.5
-1 -1 -1 -1
function complexgrid5
z=cplxgrid(40);
cplxmap(z,real(conj(z)))
figure
cplxmap(z,imag(conj(z)))
1
0.5
0.5
0
0
-0.5
-0.5
-1
1 -1
1
0.5 1
0.5 0.5 1
0 0.5
0 0
-0.5 0
-0.5 -0.5 -0.5
-1 -1 -1 -1
function complexgrid6
z=cplxgrid(40);
cplxmap(z,real(exp(z)))
figure
cplxmap(z,imag(exp(z)))
1.5
3
1
2.5
0.5
2
0
1.5
-0.5
1
-1
0.5
0 -1.5
1 1
0.5 1 0.5 1
0.5 0 0.5
0
0 0
-0.5 -0.5 -0.5
-0.5
-1 -1 -1 -1
function complexgrid7
z=cplxgrid(40);
cplxmap(z,real(z+1))
figure
cplxmap(z,imag(z+1))
1
2
0.5
1.5
0
1
-0.5
0.5
0 -1
1 1
0.5 1 0.5 1
0.5 0 0.5
0
0 0
-0.5 -0.5 -0.5
-0.5
-1 -1 -1 -1
Q.8. Taylor’s Series expansion of a given function at a given
point
function complexgrid6
z=cplxgrid(40);
cplxmap(z,real(exp(z)))
figure
cplxmap(z,imag(exp(z)))
1.5
3
1
2.5
0.5
2
0
1.5
-0.5
1
-1
0.5
0 -1.5
1 1
0.5 1 0.5 1
0.5 0 0.5
0
0 0
-0.5 -0.5 -0.5
-0.5
-1 -1 -1 -1
function complexgrid7
z=cplxgrid(40);
cplxmap(z,real(z+1))
figure
cplxmap(z,imag(z+1))
1
2
0.5
1.5
0
1
-0.5
0.5
0 -1
1 1
0.5 1 0.5 1
0.5 0 0.5
0
0 0
-0.5 -0.5 -0.5
-0.5
-1 -1 -1 -1
Taylor series expansion of a given function at a given point
function taylor1
syms xy;
z=x+i*y
f=exp(z)
taylor(f,6,0)
z=
x+i*y
f=
exp(x+i*y)
ans =
exp(i*y)+exp(i*y)*x+1/2*exp(i*y)*x^2+1/6*exp(i*y)*x^3+1/24*exp(i*y)*x^4+1/120*exp(i*y)*x^5
function taylor2
symsxy;
z=x+i*y
f=exp(z^2)
taylor(f,6,0)
z =
x+i*y
f =
exp((x+i*y)^2)
ans =
exp(-y^2)+2*i*exp(-y^2)*y*x+exp(-y^2)*(1-2*y^2)*x^2+exp(-
y^2)*(2*i*y-4/3*i*y^3)*x^3+exp(-y^2)*(1/2-
2*y^2+2/3*y^4)*x^4+exp(-y^2)*(i*y-4/3*i*y^3+4/15*i*y^5)*x^5
Q. 9 To perform Laurent Series expansion
%AIM:to perform laurents series expansion of a given function f(z) around a
%given point
functionlaurent_series
symsfz;
f=(sin(z)-1)/(z^4);
disp('the laurent series expansion of the function at z=0')
laurent_s=maple('series',f,'z=0',8)
end
laurent_series
thelaurent series expansion of the function at z=0
laurent_s =
series(-1*z^(-4)+1*z^(-3)-1/6*z^(-1)+1/120*z-1/5040*z^3+O(z^4),z,4)
function laurent_series1
symsfz;
f=cot(z)/(z^4);
disp('the laurent series expansion of the function at z=0')
laurent_s=maple('series',f,'z=0',8)
end
laurent_series1
thelaurent series expansion of the function at z=0
laurent_s =
series(1*z^(-5)-1/3*z^(-3)-1/45*z^(-1)-2/945*z-1/4725*z^3+O(z^4),z,4)
function laurent_series2
symsfz;
f=1/z*(z+5);
disp('the laurent series expansion of the function at z=0')
laurent_s=maple('series',f,'z=0',8)
end
laurent_series2
thelaurent series expansion of the function at z=0
laurent_s =
series(5*z^(-1)+1,z)