1
$\begingroup$

I have the following matlab function:

function y=par(x,s) %parabolic density function with basis = 2s y=0*x; ind=-s

This function implements

$y_s(x) = \begin{cases} \frac{3}{4s^3}(s^2-x^2) & \text{if } -s

The area under the parabola is always one. I tested it with the following matlab procedure:

s = 0.5:0.1:100.5; for i=1:length(s)     q =  quad(@(x)par(x,s(i)),-s(i),s(i)); end 

q is always 1 here.

btw. quad is a matlab function to evaluate the integral. Here it calculates $q = \int_{-s}^s y_s(x)\,dx$.

Can somebody explain to me why it is always one ?

  • 0
    How much calculus do you know?2012-11-09

2 Answers 2

3

The integral of the function is $1$, which is the area under the parabola:

$\displaystyle\int_{-s}^s\frac{3}{4s^3}(s^2-x^2)dx= \frac{3}{4s^3}\left(\int_{-s}^{s}s^2dx-\int_{-s}^{s}x^2dx \right) =\frac{3}{4s^3}\left(2ss^2-2\int_{0}^{s}x^2dx \right)= \\ =\displaystyle\frac{3}{4s^3}\left(2s^3-2\frac{s^3}{3}\right)=1$

1

It may help to rewrite your integrand as

$ y_s(x) = \frac{3}{4s^3}(s^2 - x^2) = \frac 1s \frac 34 \left( 1 - \left( \frac xs \right)^2 \right). $

Now, let's first consider the case $s = 1$, which simplifies the integrand to

$ y_1(x) = \frac 34 (1 - x^2), $

which is to be integrated from $-1$ to $1$. From high school calculus, I'm sure you'll remember that

$ \int_0^1 x^2 \,dx = \frac 13 $

which implies that

$ \int_0^1 (1 - x^2) \,dx = 1 - \frac 13 = \frac 23 $

and thus, since $(-x)^2 = x^2$,

$ \int_{-1}^1 (1 - x^2) \,dx = 2 \cdot \frac 23 = \frac 43. $

Multiply that by $\frac 34$, and you get $1$.

Now, what about $s \ne 1$? The rewritten integrand has a factor of $\frac 1s$ in front of it, so the height of the parabola is divided by a factor of $s$. On the other hand, the argument $x$ is also divided by $x$, which effectively multiplies the width of the parabola (and, not coincidentally, the range over which it is integrated) by $s$. Those two effects cancel out, leaving the area unchanged.

In fact, we can generalize this result: for any function $f$ integrable on $[a,b]$ and any non-zero constant $s$,

$\begin{aligned} \int_a^b f(x) dx &= \frac 1s \int_{sa}^{sb} f\left(\frac xs\right) \,dx \\ &= \int_{sa}^{sb} \frac 1s f\left(\frac xs\right) \,dx . \end{aligned}$