You are on page 1of 6

NAME: ANANYAA GUPTA

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.

Being continuous, ƒ assumes absolute maximum and minimum values on


[a, b] by Rolle’s theorem.
These can occur only
1. at interior points where ƒ’ is zero,
2. at interior points where f’ does not exist,
3. at endpoints of the function’s domain, in this case a and b.
Given question:
f(x)=x3/3 – 3x where x€ [-3,3]
f’(x)=x2 – 3
according to Rolle’s theorem
f’(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.

Suppose y = ƒ(x) is continuous over a closed interval 3a, b4 and differentiable


on the interval’s interior (a, b). Then there is at least one point c in (a, b) at which
(ƒ(b) - ƒ(a))/(b – a) = ƒ’(c)
We picture the graph of ƒ and draw a line through the points A(a, ƒ(a)) and
B(b, ƒ(b)).
g(x) = ƒ(a) +(ƒ(b) - ƒ(a))*(x-a)/(b – a)
The vertical difference between the graphs of ƒ and g at x is
h(x) = ƒ(x) - g(x)
= ƒ(x) - ƒ(a) –(ƒ(b) - ƒ(a))*(x-a)/(b – a)
The function h satisfies the hypotheses of Rolle’s Theorem on [a, b] . It is continuous
on [a, b] and differentiable on (a, b) because both ƒ and g are. Also, h(a) = h(b) = 0
because the graphs of ƒ and g both pass through A and B. Therefore h’(c) = 0 at some
point c€(a, b).
To verify Equation (1), we differentiate both sides of Equation (3) with respect to x
and then set x = c:
h’(x) = ƒ’(x) –(ƒ(b) - ƒ(a))/(b – a)
h’(c) = ƒ’(c) –(ƒ(b) - ƒ(a))/(b – a) (Evaluated at x = c
0 = ƒ’(c) –(ƒ(b) - ƒ(a))/(b – a) h’(c) = 0)
f’(c) =(ƒ(b) - ƒ(a))/(b – a)
hence proved

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)

hence at x=0 { y1’*y2’=-1 }


hence these tangents are perpendicular as their slope multiplication -1.
That is why this tangent is a special case.

You might also like