You are on page 1of 5

ASSIGNMENT-2A:

Write a program to find the area bounded by the curves y=2- x 2


and y = -x from x=-1 to 2.

Coding:
clear all
clc
syms x
f=input('Enter the upper curve f(x): ');
g=input('Enter the lower curve g(x): ');
a=input('Enter the lower limit of
integration: ');
b=input('Enter the upper limit of
integration: ');
disp('Area bounded by the curves f(x)
and g(x) is: ')
Area=int(f-g,x,a,b)
ezplot(f)
hold on;
ezplot(g)
xlabel('x-axis');
ylabel('y-axis');
legend('f(x)','g(x)');
title('AREA BOUNDED BY TWO CURVES')
grid on;

OutPut:

Enter the upper curve f(x): 2-x^2

Enter the lower curve g(x): -x

Enter the lower limit of integration: -1

Enter the upper limit of integration: 2


Area bounded by the curves f(x) and g(x) is:

Area =9/2

AREA BOUNDED BY TWO CURVES

f(x)
6 g(x)

2
y-axis

-2

-4

-6

-6 -4 -2 0 2 4 6
x-axis
ASSIGNMENT-2B:

Write a program to find the volume of the solid generated by


revolving the curve x2 + y2 = 4 about the x-axis

CODING:

clc
clear all
syms x
f=input('Enter the function f(x)');
c=input('Enter the axis of rotation
y = c (enter only c value): ');
a=input('Enter the lower limit of integration: ');
b=input('Enter the upper limit of integration: ');
disp('Volume of solid of revolution is: ');
vol=pi*int((f-c)^2,a,b)
x1=linspace(a,b,20);
y1=subs(f,x,x1);
x2=x1;
y2=c*ones(length(x1));
plot(x1,y1);
hold on;
plot(x2,y2);
xlabel('x-axis');
ylabel('y-axis')
legend('The curve y=f(x)' ,
'The axis of revolution y=c');
title('volume of solid of revolution');
grid on;
Output:

Enter the function f(x)sqrt(4-x^2)

Enter the axis of rotation y = c (enter only c value): 0

Enter the lower limit of integration: -2

Enter the upper limit of integration: 2

Volume of solid of revolution is:

vol =(32*pi)/3

volume of solid of revolution


2
The curve y=f(x)
1.8 The axis of revolution y=c

1.6

1.4

1.2
y-axis

0.8

0.6

0.4

0.2

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
x-axis

You might also like