Complex Analysis Practicals
Complex Analysis Practicals
Complex Analysis
Practical File
NAME : SHREEJI
SECTION:A
6. Contour Integration.
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
>> [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=
[]
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)
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
>>
absolute = abs(z);
conjugate = conj(z);
theta = angle(z);
str1 = ['the absolute value of the complex number is: ' num2str(absolute)];
str3 = ['the phase angle of the complex number is: ' num2str(theta)];
disp(str1);
disp(str2);
disp(str3);
end
output
>>complex_array
the absolute value of the complex number is: 2.2361 5.831 7.2801
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
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
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
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
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)