# Thread: calculation of ratio with random error

1. ## calculation of ratio with random error

I have trouble solving a problem assigned to us for class and I dont even know how to start. The problem goes as follows: We look at a guitar string and its frets (numerated from fret 0 (the whole string) to fret 12 (half). The string is 600 mm long. Now the frets are arranged such that the ratio from fret n / fret n+1 = 2^(1/12). (The following setup was created by me, it might therefore be wrong.) So the position of fret n (denoted by a_0):

$a_n = 600 \mdot (2^{-\frac{1}{12}})^n$

Here's the catch. Now in an experiment we measure the position of all frets. We will by by that have a random measurement error and get:

$a'_n = a_n + \epsilon_n$ where $\epsilon_n \in [-0.5,0.5]$

Now I am supposed to explain why the average of all the ratios:

$\frac{1}{12}\sum_0^{11}\frac{a'_n}{a'_{n+1}}$

improves my accuracy by a factor 3-4. I get the intition but to state numbers, I tried to solve this filling in what I know but even MATLAB only gives me unreadable results on this. Furthermore I am expected to explain why this only derives from $2^{-1/12}$ by no more than 0.0000004.

Any ideas? Thanks a lot, I am lost on this.

2. Originally Posted by raphw
I have trouble solving a problem assigned to us for class and I dont even know how to start. The problem goes as follows: We look at a guitar string and its frets (numerated from fret 0 (the whole string) to fret 12 (half). The string is 600 mm long. Now the frets are arranged such that the ratio from fret n / fret n+1 = 2^(1/12). (The following setup was created by me, it might therefore be wrong.) So the position of fret n (denoted by a_0):

$a_n = 600 \mdot (2^{-\frac{1}{12}})^n$

Here's the catch. Now in an experiment we measure the position of all frets. We will by by that have a random measurement error and get:

$a'_n = a_n + \epsilon_n$ where $\epsilon_n \in [-0.5,0.5]$

Now I am supposed to explain why the average of all the ratios:

$\frac{1}{12}\sum_0^{11}\frac{a'_n}{a'_{n+1}}$

improves my accuracy by a factor 3-4. I get the intition but to state numbers, I tried to solve this filling in what I know but even MATLAB only gives me unreadable results on this. Furthermore I am expected to explain why this only derives from $2^{-1/12}$ by no more than 0.0000004.

Any ideas? Thanks a lot, I am lost on this.
Write $a'_n=a_n+\varepsilon_n$, where $\varepsilon_n \sim U(-0.5,0.5)$ for $n=1, .., 12$ and $\varepsilon_0=0$.

Now expand

$\displaystyle \frac{1}{12}\sum_0^{11}\dfrac{a'_n}{a'_{n+1}}=\dfr ac{1}{12}\sum_0^{11}\dfrac{a_n+\varepsilon_n}{a_{n +1}+\varepsilon_{n+1}}$

upto the terms linear in $\varepsilon_i,\ i=1,..n$.

Now estimate the error (or rather the standard error of the estimate).

CB

3. Hello CaptainBlack,
thank you for your answer. However, this is exactly where I have problems. I already expanded my formula an tried to get the Epsilons out. But all the resulting squares make it hard to find a result. I put this whole thing into MATLAB:

Code:
clear;clc;

% a : The true values for the frats
% ar: (1) The true values for the ratios (2) tratios distorted by +0.5 (3)
% the ratios distorted by -0.5 (4/5) crossed ratios (6/7) alternating
% ratios
% ar_maxmin : the extreme values of the ratios
% avg : the average of the ratios with respect to the calculation done for
% ar
% rerror : the deviation of the ratios to the 12th squareroot of 2

a = zeros(3,13);
for i = 1:13
a(1,i) = 600*(2^(-1/12))^(i-1);
a(2,i) = a(1,i) + 0.5;
a(3,i) = a(1,i) - 0.5;
end

ar = zeros(6,12);

for i = 1:12
ar(1,i) = a(2,i)/a(2,i+1);
ar(2,i) = a(3,i)/a(3,i+1);
ar(3,i) = a(2,i)/a(3,i+1);
ar(4,i) = a(3,i)/a(2,i+1);
ar(5,i) = a(2 + mod(i,2),i)/a(2 + mod(i+1,2),i+1);
ar(6,i) = a(2 + mod(i+1,2),i)/a(2 + mod(i,2),i+1);
end

ar_maxmin = [max(ar,[],2) min(ar,[],2) max(ar,[],2)-min(ar,[],2)];
avg = mean(ar,2)
rerror = abs([2^(1/12); 2^(1/12); 2^(1/12); 2^(1/12); 2^(1/12); 2^(1/12)] - avg);

clear i;
what gives me approximatly the same results that i need. However, I see no way of solving that by pure theory. I also tried to approximate the result by getting rid of some of the terms and deriving a higher number to find an upper bound of the error but I solved that the error would not be higher then 6000 mm (surprise...!) what does not really lead me anywhere. Could you therefore be a little more spesific? Im not lazy, promised, I just cannot see what you mean. Thank you!

4. Originally Posted by CaptainBlack
Write $a'_n=a_n+\varepsilon_n$, where $\varepsilon_n \sim U(-0.5,0.5)$ for $n=1, .., 12$ and $\varepsilon_0=0$.

Now expand

$\displaystyle \frac{1}{12}\sum_0^{11}\dfrac{a'_n}{a'_{n+1}}=\dfr ac{1}{12}\sum_0^{11}\dfrac{a_n+\varepsilon_n}{a_{n +1}+\varepsilon_{n+1}}$

upto the terms linear in $\varepsilon_i,\ i=1,..n$.

Now estimate the error (or rather the standard error of the estimate).

CB
Originally Posted by raphw
Hello CaptainBlack,
thank you for your answer. However, this is exactly where I have problems. I already expanded my formula an tried to get the Epsilons out. But all the resulting squares make it hard to find a result. I put this whole thing into MATLAB: ....
$\dfrac{a_n+\varepsilon_n}{a_{n+1}+\varepsilon_{n+1 }}=\dfrac{a_n(1+\frac{\varepsilon_n}{a_n})}{a_{n+1 }(1+\frac{\varepsilon_{n+1}}{a_{n+1}})}
\approx \dfrac{a_n}{a_{n+1}}\left( 1+\frac{\varepsilon_n}{a_n} \right)\left(1-\frac{\varepsilon_{n+1}}{a_{n+1}} \right)}
$

............... $
= \dfrac{a_n}{a_{n+1}}\left[1+\frac{\varepsilon_n}{a_n}-\frac{\varepsilon_{n+1}}{a_{n+1}} +O(\varepsilon^2) \right]=2^{1/12}\left[1+\frac{\varepsilon_n}{a_n}-\frac{\varepsilon_{n+1}}{a_{n+1}} +O(\varepsilon^2) \right]$

So ignoring second degee terms in $\varepsilon$ we have the original sum is a telescoping sum in the $\varepsilon$s so:

$\displaystyle \frac{1}{12}\sum_0^{11}\dfrac{a'_n}{a'_{n+1}}=2^{1/12}+\frac{2^{1/12}}{12}\left[\frac{\varepsilon_0}{a_0}-\frac{\varepsilon_{12}}{a_{12}} \right]$

hence this sum has expectation $2^{1/12}$ and standard deviation:

$\dfrac{2^{1/12}}{12\times \sqrt{12}\times a_{12}}\approx 8.5 \times 10^{-5}$

(here we are using the fact that the SD of a RV uniform on an interval of length $1$ is $1/\sqrt{12}$, and that $\varepsilon_0=0$)

The details of the above you will need to check.

CB

5. Thanks a ton!