We have solved the given integral using Monte-Carlo method.
Calculations are done in MATLAB. (code attached)
Value of the integral for different run of the code.
MATLAB
code:
function Monte_carlo
u1=0.6931;
u2=7.6009;
k=0.25;
N=4000;
n=10000; % number random numbers;
h = @(y) (u2-u1)./(k*(1-(1/N)*exp((u2-u1)*y+u1)));
y=rand(1,n);
Integral=sum(h(y))/n;
fprintf('\n\nValue of the integral using %g random numbers is:
%g\n\n',n,Integral);
end
het, we are interested in evaluating I-&'+(u) dx . det, us consider n rondom variables xi such that, Xi ~ 160,1) (unitor distribution 7 method, I can be approximated as Ursing Monte-Carlo IⓇ + +(x3) W5 \ § - for the given Limation, we have H6w) = n(ne) M . I = f(u) du. 14 =0. ų = 7.6009 k = 0.25. N = 4000 tet, y u= (14-14) J + 4 i du = (-4,) du ulųų yloli *1=, ali i na wanang du
Command Window >> Monte carlo Value of the integral using 10000 random numbers is: 30.3815 >> Monte_carlo Value of the integral using 10000 random numbers is: 30.5073 >> Monte_carlo Value of the integral using 10000 random numbers is: 30.4635 >> Montecarlo Value of the integral using 10000 random numbers is: 30.4008 >> Monte Carlo Value of the integral using 10000 random numbers is: 30.3976