Professional Documents
Culture Documents
20BCT0177 VL2020210106194 Ast01 PDF
20BCT0177 VL2020210106194 Ast01 PDF
20BCT0177
SLOT: L3+L4
MAT1011
DATE: 21-12-20
TITLE
EXPERIMENT-1A
ROLLE’S THEOREM
AIM
TO VERIFY ROLLE’S THEOREM USING MATLAB CODE.
MATHEMATICAL BACKGROUND
Suppose that y = ƒ(x) is continuous over the closed interval [a, b] and differentiable
at every point of its interior (a, b). If ƒ(a) = ƒ(b), then there is at least one
number c in (a, b) at which ƒ’(c) = 0.
therefore, c=±√3
hence theorem verified
MATLAB CODE
clc
clear% clear
close all %close
syms x c
f=input('enter the function in x');% function
I=input('enter the interval');%interval
fx=diff(f,x);% differentiation of x
fc=subs(fx,x,c);% replacing x with c
c=solve(fc==0,c);% solving the f'(c) for the value c
count=0;
for i=1:numel(c)
if c(i)>I(1) && c(i)<I(2)
count=count+1;% counting interior c
else
disp('exterior point');
end
end
if count>=1 % if at lease one c exists
disp('rolles theorem verified');
else
disp('rolles theorem failed');
end
u=-3:3;
v=subs(f,x,c(1))*ones(1,numel(u));
%w=subs(f,x,c(2))*ones(1,nume(u));
ezplot(f,[I(1),I(2)])% function
hold on
plot(u,v)%tangentline1
%hold on
CONCLUSION:
As we can see that the values of c in matlab and manual
calculation are same and lie in the interval [-3 3], hence we can conclude
that ROLLE’S THEOREM verified.
EXPERIMENT-1B
MEAN VALUE THEOREM
AIM: Find the time taken by the ball to reach ground and find c and plot
graph.
MATLAB CODE
Question 2:
clc
clear% clear
close all %close
syms x c
f=input('enter the function in x');% function
I=input('enter the interval');%inteval{a,b]
fx=diff(f,x);% differentiation of x
fc=subs(fx,x,c);% replacing x with c
fb=subs(f,x,I(2)); %f(b)
fa=subs(f,x,I(1)); %f(a)
rhsmvt=(fb-fa)/(I(2)-I(1));
c=solve(fc==rhsmvt,c)
disp (rhsmvt)
if c>I(1) && c<I(2)
disp('mean value theorem verified')
end
ezplot(f,[I(1),I(2)])
hold on
ezplot(fa+rhsmvt*(x-I(1)),[I(1),I(2)])
hold on
ezplot(subs(f,x,c)+(subs(fx,x,c)*(x-c)),[I(1),I(2)])
hold off
title('Mean value theorem');
CONCLUSION
as we can see that the value of c lie in the range[0 3.34] Hence mean value
theorem verified.
Question 3:
AIM:
Plot the tangents to the curve sin(2x) and -sin(x\2) at the origin and relation.
MATHEMATICAL BACKGROUND:
A tangent is a line which passes through a point in a curve and whose slope is equal
to the slope of the curve at that point
To find the tangent of the curve we have to find slope of curve at that point.
MATLAB CODE:
clc
clear all
close all
syms x c
y1=sin(2*x)
y2=-sin(x/2)
y1_=diff(y1,x);
y2_=diff(y2,x);
grid on;
axis on;
ezplot(y1,[-pi,pi])
hold on
ezplot(y2,[-pi,pi])
hold on
ezplot(subs(y1_,x,0)*x)
hold on
ezplot(subs(y2_,x,0)*x)
hold off
CONCLUSION
y1’=2cox2x
1 𝑥
y2’=-2 cos(2)