734. Output the formula

$$
I_{1}^{\hbar}=(b-a) \frac{\sum_{i=1}^{n} \varphi\left(x_{i}\right)}{n}
$$

where $x_{i}=a+(b-a) r_{i}$, for estimating the definite integral $l=\int_{a}^{b} \varphi(x) \mathrm{d} x$.
Solution. Let us introduce a random variable $X$, uniformly distributed over the integration interval $(a, b)$ with density $f(x)=1/(b-a)$. Then the mathematical expectation is

$$
M[\varphi(X)]=\int_{a}^{b} \varphi(x) f(x) \mathrm{d} x=\frac{1}{b-a} \int_{a}^{b} \varphi(x) \mathrm{d} x
$$

## Therefore

$$
\int_{a}^{b} \varphi(x) \mathrm{d} x=(b-a) M[\varphi(X)]
$$

By replacing the mathematical expectation $M[\varphi(X)]$ with its estimate—the sample mean—we obtain an estimate of the desired integral

$$
I_{i}^{*}=(b-a) \cdot \frac{\sum_{i=1}^{n} \varphi\left(x_{i}\right)}{n}
$$

where $x_{i}$ are the possible values of $X$. Since the random variable $X$ is uniformly distributed over the interval $(a, b)$ with density $f(x)=1/(b-a)$, the $x_{i}$ are generated by the formula $\frac{1}{b-a} \int_{a}^{x_{i}} \mathrm{d} x=r_{i}$ (see s3, rule 2). Hence, $x_{l}=a+(b-a) r_{l}$, where $r_{l}$ is a random number.