Experiment No : 02
Experiment Name : Study on mathematical operation functions and symbolic math toolbox in
MATLAB
Command Code :
clc;
clear all;
close all;
a=4.172;
b=9.131044;
d=-3.5;
e=(11.2-4.6);
f=(7-2.91683);
sqrt((((a+b)^3)-18)/(d+(e*(f)^-0.4)))
command output :
ans =
94.8601
Command Code :
clc;
clear all;
close all;
syms x y z;
[x,y,z]=solve(3*x+4*y+5*z==2,2*x-3*y+7*z==-1,x-6*y+z==3, x,y,z)
command output :
x=
241/92
y=
-21/92
z=
-91/92
Command Code :
clc;
close all;
clear all;
syms x y;
f=sin(5*x)
diff(f)
diff(f,2)
diff(f,3)
A=int(sin(2*x),x,0,pi/2)
A=int(int(sin(2*x),x,0,pi/2),y,0,pi/2)
command output :
f=
sin(5*x)
ans =
5*cos(5*x)
ans =
-25*sin(5*x)
ans =
-125*cos(5*x)
A=
A=
pi/2
command code:
clc;
clear all;
close all;
syms k n;
symsum((1/k)-(1/k+1),1,n)
symsum((1/n^2),1,inf)
command output:
ans =
-n
ans =
pi^2/6
command code:
clc;
clear all;
close all;
syms x r;
f(x)=6*x^3+5*x*x+2*x-3
diff(f(x))
f(x)=(2*x-1/x*x+1)
diff(f(x))
f(x)=sin(3*x^2+2);
diff(f(x))
f(x)=sqrt(1+x^4);
diff(f(x))
f(x)=x^r;
diff(f(x))
f(x)=asin(2*x+3);
diff(f(x))
f(x)=atan(x^2+1);
diff(f(x))
command output:
f(x) =
6*x^3 + 5*x^2 + 2*x - 3
ans =
18*x^2 + 10*x + 2
f(x) =
2*x
ans =
ans =
6*x*cos(3*x^2 + 2)
ans =
(2*x^3)/(x^4 + 1)^(1/2)
ans =
r*x^(r - 1)
ans =
2/(1 - (2*x + 3)^2)^(1/2)
ans =
(2*x)/((x^2 + 1)^2 + 1)
Command code:
clc;
clear all;
close all;
syms x;
int((cos(x)),x,0,pi/2)
int(x*sin(x*x),x)
f(x)=sqrt(1-cos(3*x))
int(sin(3*x)*f(x),x)
f(x)=sqrt(x+4)
int(x*x*f(x),x)
f(x)=exp(-x^2)
int(f(x),x,-inf,inf)
command output:
ans =
ans =
-cos(x^2)/2
f(x) =
(1 - cos(3*x))^(1/2)
ans =
(2*(1 - cos(3*x))^(3/2))/9
f(x) =
(x + 4)^(1/2)
ans =
-(2*(x + 4)^(3/2)*(168*x - 15*(x + 4)^2 + 112))/105
f(x) =
exp(-x^2)
ans =
pi^(1/2)