Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 36

1

LAB9 Double Integrals and their applications

In this Lab

We shall learn double Integrals and their applications.

1.1: Introduction to double integrals


The concept of double integrals arises from the fact that the function of two
independent variables x and y f(x, y) can be integrated with respect to either
variable whilst taking the other variable as constant.
We know from Calculus courses that the following Mathematical illustration is
known as double integral.
2

Also remember that we used to perform the following steps for the evaluation
(that is finding the value) of this double integral

 Starting from the inside integral


 We integrate the integrand f(x, y) with respect to x when the limits of
integration x1 and x2 are the values of first variable x
 The result or outcome is then integrated with respect to y when the limits
of integration y1 and y2 are the values of second variable y

Also remember that we can evaluate the double integrals over rectangular (where
limits of integration are constant) and non-rectangular (where limits of
integration are not all constant) regions.

The further detail about double integrals can be found in Calculus books, and here
in this Lab we shall write a program in Matlab which will evaluate the double
integrals for us over rectangular and non-rectangular regions.

The Matlab function which we shall use for the evaluation of double integrals is
called integral2.

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

% Please Enter the two variable function

f = input('Please enter the Integrand as Anonymous Function with independent


variable x and y \n f(x,y) = ');
3

% Enter the following choices

fprintf('\n Enter the following Choices\n');


fprintf(' 1) For Evaluating a Double Integral over a Rectangular Region.\n');
fprintf(' 2) For Evaluating a Double Integral over a Non Rectangular Regions \
n');

% Enter your choice

ch = input('\n Enter Your Choice \n ch = ');

% Start of Switch Statement.

switch ch

case 1

% Enter the limits of Integration

x1 = input('Enter the values of lower limit of integration as a vector\


n x1 = ');

x2 = input('Enter the values of upper limit of integration as a vector\


n x2 = ');

y1 = input('Enter the values of lower limit of integration as a vector\


n y1 = ');

y2 = input('Enter the values of upper limit of integration as a vector\


n y2 = ');

len = length(x1);

% Comoute the values of integral when length of vectors is 1 or more


% than 1

for i = 1: len

Qvalues(i) = integral2(f,x1(i),x2(i),y1(i),y2(i));

end

% Display the Values.

for i = 1:len

fprintf('\n\n The value of Double Integral is %.5f when x1 is %.5f , x2 is


%.5f, y1 is %.5f and y2 is %.5f\n', Qvalues(i),x1(i), x2(i), y1(i), y2(i));

end

case 2

% Enter the following choices.


4

fprintf('\n Enter the follwing Choices\n');


fprintf('1) For evaluation of double integral on ROI where\n y1 is a
variable limit of integration as a function of x\n and y2 is a constant limit
of Integration\n');
fprintf('2) For evaluation of double integral on ROI where\n y1 is a
constant limit of integration\n and y2 is a variable limit of integration as a
function of x\n');
fprintf('3) For evaluatiom of double integral on ROI where\n y1 is a
variable limit of integration as a function of x\n and y2 is also a variable
limit of integration as a function of x\n ');

ch = input('Please Enter your choice\n ch = ');

switch ch

case 1

% Enter the limits of Integration.

x1 = input('Enter the values of lower limit of integration as a


vector\n x1 = ');

x2 = input('Enter the values of upper limit of integration as a


vector\n x2 = ');

y1 = input('Enter the values of lower limit of integration as a


cell array of function handles\n y1 = ');

y2 = input('Enter the values of upper limit of integration as a


vector\n y2 = ');

len = length(x1);

for i = 1: len

Qvalues(i) = integral2(f,x1(i),x2(i),y1{i},y2(i));

end

y1str = cellfun(@func2str,y1,'UniformOutput', false);

for i = 1:len

fprintf('\n\n The value of Double Integral is %.5f when x1 is


%.5f , x2 is %.5f, y1 is %s and y2 is %.5f\n', Qvalues(i),x1(i), x2(i),
y1str{i}, y2(i));

end

case 2

% Enter the limits of Integration.

x1 = input('Enter the values of lower limit of integration as a


vector\n x1 = ');
5

x2 = input('Enter the values of upper limit of integration as a


vector\n x2 = ');

y1 = input('Enter the values of lower limit of integration as a


vector\n y1 = ');

y2 = input('Enter the values of upper limit of integration as a


cell array of function handles\n y2 = ');

len = length(x1);

for i = 1: len

Qvalues(i) = integral2(f,x1(i),x2(i),y1(i),y2{i});

end

y2str = cellfun(@func2str,y2,'UniformOutput', false);

for i = 1:len

fprintf('\n\n The value of Double Integral is %.5f when x1 is


%.5f , x2 is %.5f, y1 is %.5f and y2 is %s\n', Qvalues(i),x1(i), x2(i), y1(i),
y2str{i});

end

case 3

% Enter the limits of Integration.

x1 = input('Enter the values of lower limit of integration as a


vector\n x1 = ');

x2 = input('Enter the values of upper limit of integration as a


vector\n x2 = ');

y1 = input('Enter the values of lower limit of integration as a


cell array of function handles\n y1 = ');

y2 = input('Enter the values of upper limit of integration as a


cell array of function handles\n y2 = ');

len = length(x1);

for i = 1: len

Qvalues(i) = integral2(f,x1(i),x2(i),y1{i},y2{i});

end

y1str = cellfun(@func2str,y1,'UniformOutput', false);

y2str = cellfun(@func2str,y2,'UniformOutput', false);

for i = 1:len
6

fprintf('\n\n The value of Double Integral is %.5f when x1 is


%.5f , x2 is %.5f, y1 is %s and y2 is %s\n', Qvalues(i),x1(i), x2(i),
y1str{i}, y2str{i});

end

end
end

Let us now, test this program for the following double integrals.

Integral Number 1

Run the program as follows and get the desired result.

Please enter the Integrand as Anonymous Function with independent variable x


and y
f(x,y) = @(x,y) x + (2*y)

Enter the follwing Choices


1) For Evaluating a Double Integral over a Rectangular Region.
2) For Evaluating a Double Integral over a Non Rectangular Regions
7

Enter Your Choice


ch = 1
Enter the values of lower limit of integration as a vector
x1 = [2 5 7]
Enter the values of upper limit of integration as a vector
x2 = [4 8 12]
Enter the values of lower limit of integration as a vector
y1 = [1 3 9]
Enter the values of upper limit of integration as a vector
y2 = [2 7 11]

The value of Double Integral is 12.00000 when x1 is 2.00000 , x2 is 4.00000, y1 is


1.00000 and y2 is 2.00000

The value of Double Integral is 198.00000 when x1 is 5.00000 , x2 is 8.00000, y1 is


3.00000 and y2 is 7.00000

The value of Double Integral is 295.00000 when x1 is 7.00000 , x2 is 12.00000, y1


is 9.00000 and y2 is 11.00000

In this way, we have obtained the value of above double integral for various
limits of integration.
8

Integral Number 2

Run the program as follows and get the desired result

Please enter the Integrand as Anonymous Function with independent variable x


and y
f(x,y) = @(x,y) 2.*x .*sin(y)

Enter the follwing Choices


1) For Evaluating a Double Integral over a Rectangular Region.
2) For Evaluating a Double Integral over a Non Rectangular Regions

Enter Your Choice


ch = 2

Enter the follwing Choices


1) For evaluation of double integral on ROI where
y1 is a variable limit of integration as a function of x
9

and y2 is a constant limit of Integration


2) For evaluation of double integral on ROI where
y1 is a constant limit of integration
and y2 is a variable limit of integration as a function of x
3) For evaluatiom of double integral on ROI where
y1 is a variable limit of integration as a function of x
and y2 is also a variable limit of integration as a function of x
Please Enter your choice
ch = 2
Enter the values of lower limit of integration as a vector
x1 = [0 3 4]
Enter the values of upper limit of integration as a vector
x2 = [1 5 7]
Enter the values of lower limit of integration as a vector
y1 = [0 9 18]
Enter the values of upper limit of integration as a cell array of function handles
y2 = {@(x) power(x,2) @(x) power(x,1) @(x) power(x,3)}

The value of Double Integral is 0.15853 when x1 is 0.00000 , x2 is 1.00000, y1 is


0.00000 and y2 is @(x)power(x,2)

The value of Double Integral is -6.68943 when x1 is 3.00000 , x2 is 5.00000, y1 is


9.00000 and y2 is @(x)power(x,1)
10

The value of Double Integral is 21.99446 when x1 is 4.00000 , x2 is 7.00000, y1 is


18.00000 and y2 is @(x)power(x,3)

In this way, we have obtained the value of above mentioned double integral for
various limits of integration.

1.2 AVERAGE VALUE OF FUNCTION OF TWO VARIABLES

We know from Calculus courses that the average value of function of two
variables f (x, y) over a region R (for example, a thin plate covering R) is equal to
the integral over the region divided by the area of R.

Here,
Area of R = (x2-x1) * (y2-y1)

Let us now, write an interactive program in Matlab which will find for the average
values of entered function of two variables f(x, y) at entered values of limits of
integration.
11

The program will also display the mean or average of set of average values of
function and their standard deviation. And will display a bar chart of average
values of function f(x, y) versus area.

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

% Please Enter the two variable function

f = input('Please enter the Integrand as Anonymous Function with independent


variable x and y \n f(x,y) = ');

% Enter the limits of Integration, each vector should be of same length.

x1 = input('Enter the values of lower limit of integration as a vector\n x1 =


');

x2 = input('Enter the values of upper limit of integration as a vector\n x2 =


');

y1 = input('Enter the values of lower limit of integration as a vector\n y1 =


');

y2 = input('Enter the values of upper limit of integration as a vector\n y2 =


');

len = length(x1);

% Compute the values

for i = 1:len

Area(i) = ( x2(i) - x1(i)) .* (y2(i) - y1(i));

Qvalues(i) = integral2(f,x1(i),x2(i),y1(i),y2(i));

Avgvaluesoff(i) = Qvalues(i)./Area(i);

fprintf('\n\n');

fprintf('The average Value of Entered function is %.3f when Area is %.3f\


n\n ', Avgvaluesoff(i), Area(i));

end
12

% Find the average value and standard deviation.

Averageofavgvalues = mean(Avgvaluesoff);

Stdeviation = std(Avgvaluesoff);

fprintf('\n\nThe average value of average values of f is %.5f and the standard


deviation of this set of average values is %.5f\n', Averageofavgvalues,
Stdeviation)

bar(Area,Avgvaluesoff, 'g' ,'edgecolor', 'r')

title(['Average values of function f(x,y) = ', func2str(f)]);

xlabel('Areas');

Let us now use the above program to find the average value of function

f(x,y) = xsin2(xy)

When, the region of integration is [0 pi] * [0 pi]

Run the program as follows and get the desired result.

Please enter the Integrand as Anonymous Function with independent variable x


and y
f(x,y) = @(x,y) x.*(power(sin(x.*y),2))
Enter the values of lower limit of integration as a vector
x1 = [0 0 0]
13

Enter the values of upper limit of integration as a vector


x2 = [pi 1.5*pi 2*pi]
Enter the values of lower limit of integration as a vector
y1 = [0 0 0]
Enter the values of upper limit of integration as a vector
y2 = [pi 1.5*pi 2*pi]

The average Value of Entered function is 0.784 when Area is 9.870

The average Value of Entered function is 1.178 when Area is 22.207

The average Value of Entered function is 1.570 when Area is 39.478

The average value of average values of f is 1.17724 and the standard deviation of
this set of average values is 0.39296
14

Average values of function f(x,y) = @(x,y)x.*(power(sin(x.*y),2))


1.6

1.4
X 22.21
Y 1.178
1.2

0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30 35 40 45 50
Areas

1.3 Applications of Double Integrals

Double Integrals have many applications in the field of engineering sciences,


economics and psychology.

Let us now consider these applications.


15

Application Number 1.

We take our first practical application from Electromagnetism.

Suppose that a square plate is situated in the space defined by


-3m <= x <= 3 and -3m <= y <= 3m.
The charge density is defined by 4y2 µC/m2.
Now, our task is to find the total charge on plate using double integral.
The total charge Q will be given by the following double integral.

Let us compute the value of this double integral at various limits of integration by
writing an interactive program in Matlab.

So open the Matlab editor and write the following program.


clc;
clear all;
close all;

p = input('Please enter the Integrand which is surface charge density as


Anonymous Function with independent variables x and y \n p = ');

% Enter the limits of Integration, each vector should be of same length.


16

x1 = input('Enter the values of lower limit of integration as a vector\n x1 =


');

x2 = input('Enter the values of upper limit of integration as a vector\n x2 =


');

y1 = input('Enter the values of lower limit of integration as a vector\n y1 =


');

y2 = input('Enter the values of upper limit of integration as a vector\n y2 =


');

len = length(x1);

for i = 1: len

Qvalues(i) = integral2(p,x1(i),x2(i),y1(i),y2(i));

end

for i = 1:len

fprintf('\n\n The total charge Q is %.7f micro Coulombs when x1 is %.5f x2


is %.5f y1 is %.5f and y2 is %.5f\n\n', Qvalues(i),x1(i), x2(i), y1(i),
y2(i));

end

Run the program as follows and get the desired result.

Please enter the Integrand which is surface charge density as Anonymous


Function with independent variables x and y
p = @(x,y)(4.*y.^2 ).* power(10,-6)
Enter the values of lower limit of integration as a vector
x1 = [-3 -3 -3]
Enter the values of upper limit of integration as a vector
17

x2 = [3 7 10]
Enter the values of lower limit of integration as a vector
y1 = [-3 -3 -3]
Enter the values of upper limit of integration as a vector
y2 = [3 7 10]

The total charge Q is 0.0004320 micro Coulombs when x1 is -3.00000 x2 is


3.00000 y1 is -3.00000 and y2 is 3.00000

The total charge Q is 0.0049333 micro Coulombs when x1 is -3.00000 x2 is


7.00000 y1 is -3.00000 and y2 is 7.00000

The total charge Q is 0.0178013 micro Coulombs when x1 is -3.00000 x2 is


10.00000 y1 is -3.00000 and y2 is 10.00000

Application Number 2

We take our second application of double integrals from economics, and we shall
study the profit function.
18

A car manufacturer estimates that when x-units of a particular car are sold
domestically and y-units of the same car are sold to foreign countries. Then, the
profit in dollars is given by.

P(x, y) = (x - 30) (70 + 5x - 4y) + (y - 40) (80 -6x +7y)

Now, our task is to find the total profit


When
x-varies from 100-125 units
And
y-varies from 70-89 units

The total profit will be given by the following double-integral.

To evaluate this double integral, we shall write an interactive program in Matlab.


19

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

P = input('Please enter the integrand which is production function as


Anonymous function with two variables x and y\n P(x,y) = ');

% Please Enter the limits of Integration.

x1 = input('Enter the lower limit of x-units car sold as a vector\n x1 = ');

x2 = input('Enter the upper limit of x-units car sold as a vector\n x2 = ');

y1 = input('Enter the lower limit of y-units car sold as a vector\n y1 = ');

y2 = input('Enter the upper limit of y-units car sold as a vector\n y2 = ');

% Find the length

len = length(x1);

% Evaluate the double Integral.

for i = 1:len

Pvalues(i) = integral2(P,x1(i),x2(i),y1(i),y2(i));

fprintf('\nThe total profit is %.2f $ when x varies from %.2f to %.2f and
y varies from %.2f to %.2f\n\n', Pvalues(i), x1(i),x2(i),y1(i),y2(i));
end

Run the program as follows and get the desired result.


20

Please enter the integrand which is production function as Anonymous function


with two variables x and y
P(x,y) = @(x,y)(x-30).*(70+5*x-4*y)+(y-40).*(80-6*x+7*y)
Enter the lower limit of x-units car sold as a vector
x1 = [100 100 100]
Enter the upper limit of x-units car sold as a vector
x2 = [125 135 150]
Enter the lower limit of y-units car sold as a vector
y1 = [70 70 70]
Enter the upper limit of y-units car sold as a vector
y2 = [89 99 110]

The total profit is 11825837.50 $ when x varies from 100.00 to 125.00 and y
varies from 70.00 to 89.00

The total profit is 27878497.50 $ when x varies from 100.00 to 135.00 and y
varies from 70.00 to 99.00

The total profit is 63600000.00 $ when x varies from 100.00 to 150.00 and y
varies from 70.00 to 110.00

Application Number 3:
21

We take our third application from Psychology.

Suppose that in a psychology experiment, x-units of stimulus A and y units of


stimulus B are applied to a subject, and whose enactment or response on a
certain job is then calculated by the function

E(x, y) = 10 + xyexp (1-x2-y2)

Now, suppose that if

x-varies between 0 and 1


And
y-varies between 0 and 3

Then, our task is to find the average value of subject’s response to the stimuli.

We know from Calculus courses that this average value will be equal to
22

Let us now write, an interactive program in Matlab which will compute the above
average value.

The program will also display the mean or average of set of average values of
function and their standard deviation. And will display a bar chart of average
values of function E(x, y) versus area.

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

% Please Enter the two variable function

E = input('Please enter the Integrand which is enactment function of the


subject as Anonymous Function with independent variables x and y \n E = ');
23

% Enter the limits of Integration, each vector should be of same length.

x1 = input('Enter the values of lower limit of integration of x-units of


stimulus A as a vector\n x1 = ');

x2 = input('Enter the values of upper limit of integration of x-units of


stimulus A as a vector\n x2 = ');

y1 = input('Enter the values of lower limit of integration of y-units of


stimulus B as a vector\n y1 = ');

y2 = input('Enter the values of upper limit of integration of y-units of


stimulus B as a vector\n y2 = ');

len = length(x1);

for i = 1:len

Area(i) = ( x2(i) - x1(i)) .* (y2(i) - y1(i));

Evalues(i) = integral2(E,x1(i),x2(i),y1(i),y2(i));

Avgvaluesoff(i) = Evalues(i)./Area(i);

fprintf('\n\n');

fprintf('The average Value of Entered function is %.7f when x-units vary


from %.5f to %.5f and y-units vary from %.5f to %.5f\n\n ', Avgvaluesoff(i),
x1(i),x2(i),y1(i),y2(i));

end

% Find the average value and standard deviation.

Averageofavgvalues = mean(Avgvaluesoff);

Stdeviation = std(Avgvaluesoff);

fprintf('\n\nThe average value of average values of E is %.7f and the standard


deviation of this set of average values is %.7f\n', Averageofavgvalues,
Stdeviation)

bar(Area,Avgvaluesoff, 'g' ,'edgecolor', 'r')

title(['Average values of Enactment Function f(x,y) = ', func2str(E)]);

xlabel('Areas');
24

Run the program as follows and get the desired result.

Please enter the Integrand which is enactment function of the subject as


Anonymous Function with independent variables x and y
E = @(x,y) 10 + ((x.*y).*exp(1-(x.^2)-(y.^2)))
Enter the values of lower limit of integration of x-units of stimulus A as a vector
x1 = [0 0 0 ]
Enter the values of upper limit of integration of x-units of stimulus A as a vector
x2 = [1 2 3]
Enter the values of lower limit of integration of y-units of stimulus B as a vector
y1 = [0 0 0 ]
Enter the values of upper limit of integration of y-units of stimulus B as a vector
y2 = [3 4 5]

The average Value of Entered function is 10.1431725 when x-units vary from
0.00000 to 1.00000 and y-units vary from 0.00000 to 3.00000

The average Value of Entered function is 10.0833904 when x-units vary from
0.00000 to 2.00000 and y-units vary from 0.00000 to 4.00000
25

The average Value of Entered function is 10.0452991 when x-units vary from
0.00000 to 3.00000 and y-units vary from 0.00000 to 5.00000

The average value of average values of E is 10.0906207 and the standard


deviation of this set of average values is 0.0493357

Average values of Enactment Function f(x,y) = @(x,y)10+((x.*y).*exp(1-(x. 2 )-(y. 2 )))


12
X8
Y 10.08
10

0
3 8 15
Areas
26

Application Number 4

We take our next application from Economics.

Suppose that a manufacturer has modeled its output by a Cobb-Douglas


production function as follows.

Q (K, L) = 50K3/5L2/5
Where

K is the monthly capital investment (in units of $1000), and L is the number of
monthly labor hours.
Now, suppose that monthly capital investment varies between $10,000 and
$12,000, while monthly use of labor varies between 2800 and 3200 worker-hours.
Find the monthly output for the manufacturer.
27

To achieve this task we shall write an interactive program in Matlab, which will
find for us the average monthly output for different variations of L and K.

The program will also display the mean or average of set of average values of
function and their standard deviation. And will display a bar chart of average
values of function Q (K, L) versus area.

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

% Please Enter Cobb-Douglas Production function.

Q = input('Please enter the Cobb-Douglas production function as an Anonymous


Function with independent variables K & L \n Q(K,L) = ');

% Enter the limits of integration.

K1 = input('Enter the lower limit of Capital K as a vector\n K1 = ');

K2 = input('Enter the upper limit of capital K as a vector\n K2 = ');

L1 = input('Enter the lower limit of Labour L as a vector\n L1 = ');

L2 = input('Enter the upper limit of Labour L as a vector\n L2 = ');

len = length(K1);

% K1 and K2 in units $1000


28

K1units1000doll = K1./1000;

K2units1000doll = K2./1000;

% Find the values and display the result.

for i = 1:len

Area(i) = ( K2units1000doll(i) - K1units1000doll(i)) .* (L2(i) - L1(i));

Qvalues(i) =
integral2(Q,K1units1000doll(i),K2units1000doll(i),L1(i),L2(i));

AvgvaluesofQ(i) = Qvalues(i)./Area(i);

fprintf('\n\n');

fprintf('The average Value of Entered function is %.7f units when K vary


from %.5f $ to %.5f $ and L vary from %.5f worker-hours to %.5f worker-hours \
n\n ', AvgvaluesofQ(i), K1(i),K2(i),L1(i),L2(i));

end

% Find the average value and standard deviation.

Averageofavgvalues = mean(AvgvaluesofQ);

Stdeviation = std(AvgvaluesofQ);

% Display

fprintf('\n\nThe average value of average values of Q(K,L) is %.7f and the


standard deviation of this set of average values is %.7f\n',
Averageofavgvalues, Stdeviation)

% Display the Bar Graph

bar(Area,AvgvaluesofQ, 'g' ,'edgecolor', 'r')

title(['Average values of Production Function Q(x,y) = ', func2str(Q)]);

xlabel('\bf Areas');

Run the program as follows and get the desired result.


29

Please enter the Cobb-Douglas production function as an Anonymous Function


with independent variables K & L
Q(K,L) = @(K,L) 50 *((power(K,3/5).* power(L,2/5)))
Enter the lower limit of Capital K as a vector
K1 = [10000 10000 10000 10000 10000 10000]
Enter the upper limit of capital K as a vector
K2 = [12000 14000 16000 18000 20000 22000]
Enter the lower limit of Labour L as a vector
L1 = [2800 2800 2800 2800 2800 2800]
Enter the upper limit of Labour L as a vector
L2 = [3200 3400 3600 3800 4000 4200]

The average Value of Entered function is 5181.2319971 units when K vary from
10000.00000 $ to 12000.00000 $ and L vary from 2800.00000 worker-hours to
3200.00000 worker-hours

The average Value of Entered function is 5525.5472262 units when K vary from
10000.00000 $ to 14000.00000 $ and L vary from 2800.00000 worker-hours to
3400.00000 worker-hours
30

The average Value of Entered function is 5863.9334492 units when K vary from
10000.00000 $ to 16000.00000 $ and L vary from 2800.00000 worker-hours to
3600.00000 worker-hours

The average Value of Entered function is 6197.4205220 units when K vary from
10000.00000 $ to 18000.00000 $ and L vary from 2800.00000 worker-hours to
3800.00000 worker-hours

The average Value of Entered function is 6526.7840081 units when K vary from
10000.00000 $ to 20000.00000 $ and L vary from 2800.00000 worker-hours to
4000.00000 worker-hours

The average Value of Entered function is 6852.6244604 units when K vary from
10000.00000 $ to 22000.00000 $ and L vary from 2800.00000 worker-hours to
4200.00000 worker-hours

The average value of average values of Q(K,L) is 6024.5902772 and the standard
deviation of this set of average values is 625.1107449
31

Average values of Production Function Q(x,y) = @(K,L)50*((power(K,3/5).*power(L,2/5)))


7000

6000 X 8000
Y 6197
5000

4000

3000

2000

1000

0
800 2400 4800 8000 12000 16800
Areas

Application Number 5

We take our last application of double integrals from Physics.

We know that

In 1900, Max Planck succeeded in deriving an exponential model by using natural


exponential function which shows that how the intensity of black body radiation
32

varies with temperature and wavelength. This model matched remarkably well
with experimental intensity distribution curves.

The following is the result

I (λ, T) = 2πhc2/λ5 (ehc/λkT - 1) (Planck’s Radiation Law)

Let us now, write a program which will find for us the average value of this
function

When

Wavelength lambda varies from

1e-7 to 1e-6 in micro meter

And

Temperature Varies from

100 to 2000 Kelvin


33

We shall achieve this by writing an interactive program in Matlab.

So open the Matlab editor and write the following program.

clc;
clear all;
close all;

syms I(lamda, Temp)

% Define the Constants...

h = 6.626e-34; % Planck's Constant

c = 2.998e8; % Speed of light

k = 1.38066e-23; % Boltzmann's Constant.

% I = input('Please Enter the Intensity Function as an Anonymous Function with


independent variables lamda and Temp\n I(lamda,Temp)');

K = (h * c) ./ (lamda .* k .* Temp);

I = (2 * pi * h * c^2) ./ ((lamda.^5) .* (exp(K) - 1));

lamda1 = input('Enter the lower limit of Wavelength lamda in micrometers\n


lamda1 = ');

lamda2 = input('Enter the upper limit of Wavelength lamda in micrometers\n


lamda2 = ');
34

Temp1 = input('Enter the lower limit of Temperature in Kelvin\n Temp1 = ');

Temp2 = input('Enter the upper limit of Temperature in Kelvin\n Temp2 = ');

len = length(lamda1);

for i = 1:len

Area(i) = ( lamda2(i) - lamda1(i)) .* (Temp2(i) - Temp1(i));

Ivalues(i) = int(int(I,lamda, lamda1(i),lamda2(i)),Temp,


Temp1(i),Temp2(i));

AvgvaluesofI(i) = Ivalues(i)./Area(i);

fprintf('\n\n');

fprintf('The average Value of Entered function is %e when lamda vary from


%e to %e and temperature vary from %.4f to %.4f \n\n ', AvgvaluesofI(i),
lamda1(i),lamda2(i),Temp1(i),Temp2(i));

end

Run the program as follows and get the desired result.

Enter the lower limit of Wavelength lamda in micrometers


lamda1 = [1e-7 1e-7 1e-7 1e-7 1e-7 1e-7]
Enter the upper limit of Wavelength lamda in micrometers
lamda2 = [1e-6 2e-6 3e-6 4e-6 5e-6 6e-6]
Enter the lower limit of Temperature in Kelvin
Temp1 = [100 100 100 100 100 100]
Enter the upper limit of Temperature in Kelvin
35

Temp2 = [2000 2500 3000 3500 4000 4500]

The average Value of Entered function is 6.859062e+09 when lamda vary from
1.000000e-07 to 1.000000e-06 and temperature vary from 100.0000 to
2000.0000

The average Value of Entered function is 1.210689e+11 when lamda vary from
1.000000e-07 to 2.000000e-06 and temperature vary from 100.0000 to
2500.0000

The average Value of Entered function is 2.673163e+11 when lamda vary from
1.000000e-07 to 3.000000e-06 and temperature vary from 100.0000 to
3000.0000

The average Value of Entered function is 4.177683e+11 when lamda vary from
1.000000e-07 to 4.000000e-06 and temperature vary from 100.0000 to
3500.0000
36

The average Value of Entered function is 5.899102e+11 when lamda vary from
1.000000e-07 to 5.000000e-06 and temperature vary from 100.0000 to
4000.0000

You might also like