# Math Help - My hardware and software fails to calculate this.

1. ## My hardware and software fails to calculate this.

Clock A has a frequency of 10MHz. It has a stability of 2*10^-11.
Clock B has a frequency of 10MHz. It has perfect stability, and does not drift. This is our reference.

The clocks are synchronized, and triggered simultaneously.

How many years before clock A has become asynchronous by 10MHz relative to clock B?

The problem is that my software (MS Excel) and calculator cannot calculate this. MS Excel rounds the number when dealing with 2*10^-11, and my calculator overflows.

I was hoping somebody whom has the tools to do it can do this calculation. I am getting pretty frustrated trying to convert to pHz and uHz and all sorts to try to prevent the rounding of the numbers in Excel.

Kind regards,
Marius

2. ## Re: My hardware and software fails to calculate this. Help!

Did you try WolframAlpha? It has infinite precision for all practical purposes, and it's a great tool for those tricky calculations that are at the edge of numerical stability on standard software.

Example, type in "sqrt(2 * 10^-11)" and it will give you the right approximation to any accuracy you like (by clicking "more digits").

3. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by king.oslo
Clock A has a frequency of 10MHz. It has a stability of 2*10^-11.
Clock B has a frequency of 10MHz. It has perfect stability, and does not drift. This is our reference.

The clocks are synchronized, and triggered simultaneously.

How many years before clock A has become asynchronous by 10MHz relative to clock B?

The problem is that my software (MS Excel) and calculator cannot calculate this. MS Excel rounds the number when dealing with 2*10^-11, and my calculator overflows.

I was hoping somebody whom has the tools to do it can do this calculation. I am getting pretty frustrated trying to convert to pHz and uHz and all sorts to try to prevent the rounding of the numbers in Excel.

Kind regards,
Marius
I doubt Excel has any trouble representing and manipulating these numbers, there is a difference between the display precision and the internal precision/accuracy. Reformat your cells to use scentific notation and 15 decimal places.

Also what exactly do you mean by stability here?

CB

4. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by CaptainBlack
I doubt Excel has any trouble representing and manipulating these numbers, there is a difference between the display precision and the internal precision/accuracy. Reformat your cells to use scentific notation and give 15 decimal places.

Also what exactly do you mean by stability here?

CB
Stability. The maximium deviation from the year before.

Excel can display 30 decimal places. This is not the problem. The problem is that excel round my numbers.M

5. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by king.oslo
Stability. The maximum deviation from the year before.

Excel can display 30 decimal places. This is not the problem. The problem is that excel round my numbers.M
What calculation are you asking it to make?

(Excel operates with double precision floating point which has ~15 digits of precision and with exponents upto ~+/-500)

CB

6. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by CaptainBlack
What calculation are you asking it to make?

(Excel operates with double precision floating point which has ~15 digits of precision and with exponents upto ~+/-500)

CB
I post my excel document for your evaluation.

As you can see, Clock A speed relative to Clock B (+-Hz) at the end of year 2 is given as 10 000 000.000400000000000000000000000000. I expected it to be 10000000.000400000000004.

If the result is 10 000 000.000400000000000000000000000000, as excel appears to suggest, then I expect it to calculate 10 000 000.000200000000000000000000000000 - 10 000 000 to .0002, rather than 0.000199999660253525.

Originally Posted by Bacterius
Did you try WolframAlpha? It has infinite precision for all practical purposes, and it's a great tool for those tricky calculations that are at the edge of numerical stability on standard software.

Example, type in "sqrt(2 * 10^-11)" and it will give you the right approximation to any accuracy you like (by clicking "more digits").
I tried it first time today. It looks alright, I think. Thank you for that.

I am unsure how to enter my question as an equation, so I tried using excel and my calculator to work it out practically. See the attachment, and you understand what I mean.

Thanks.

Marius

7. ## Re: My hardware and software fails to calculate this. Help!

then I expect it to calculate 10 000 000.000200000000000000000000000000 - 10 000 000 to .0002, rather than 0.000199999660253525.
This is not going to happen on Excel because of how floating-point arithmetic works. Since it's in binary, and on a limited number of bits, approximations have to be made for most reals, which is the reason you will get this kind of unintuitive answer. To be able to handle this kind of calculation you will need an arbitrary precision calculator (such as WolframAlpha). Or, you could of course deal with it and accept that 0.0001999999.... is equal to 0.0002, but this may not be acceptable if you intend to do more calculations with this result because the initially tiny error could quickly cascade into a huge error (because of nonlinear feedback).

8. ## Re: My hardware and software fails to calculate this. Help!

How is my question formulated so that Wolfram Alpha can find how many years which must pass before clock A has drifted one second (10MHz) relative to clock B, like I attempted with my excel calculations?

9. ## Re: My hardware and software fails to calculate this. Help!

You are right, it is an iterative method which would be difficult and time-consuming to feed to Wolfram Alpha, so it's probably not the best option.

However observing your spreadsheet, the actual process you are going through to calculate the final relative clock positions is:

RESULT = 0
for i going from 1 to 1936, RESULT = RESULT + (10000000 + 0.0002 * i - 10000000)

(if that makes sense)
Which actually simplifies to:

RESULT = 0
for i going from 1 to 1936, RESULT = RESULT + 0.002 * i

This is a simple sum which can be fed into Wolfram Alpha (don't think I have an obsession with it, it's just very useful!), and the result comes up as 375.0032. Compare it against the result obtained from Excel (which is incorrect btw): 375.002562969923.

Now that you know the actual sum to obtain your result, it should be fairly easy to find the amount of years needed for the clocks to drift 1 second apart.

10. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by king.oslo
I post my excel document for your evaluation.

As you can see, Clock A speed relative to Clock B (+-Hz) at the end of year 2 is given as 10 000 000.000400000000000000000000000000. I expected it to be 10000000.000400000000004.

If the result is 10 000 000.000400000000000000000000000000, as excel appears to suggest, then I expect it to calculate 10 000 000.000200000000000000000000000000 - 10 000 000 to .0002, rather than 0.000199999660253525.
That looks plausible given that you only have ~15 significant digits in your calculations.

But why are you trying to do this numerically?

You appear to have a model for the frequency of clock A:

$\frac{df_A}{dt}=\rho f_A(t)$

which integrates up to:

$f_A(t)=f_A(0) e^{\rho t}$

and so if the rate after 1 year is $2\times 10^{-11}$ the rate at the start we have:

$\rho \approx 2.000000165461 \times 10^{-11}$

Column D then appears to be:

$D(t)=\int_0^t (f_A(t)-f_B)\; dt$

which for $\rho t \ll 1$ may be approximated as

$D(t) \approx f_B \frac{\rho t^2}{2}$

Also, and I might be mistaken here, but you appear to be confusing seconds and years in the spreadsheet, in particular in column D.

CB

11. ## Re: My hardware and software fails to calculate this. Help!

Originally Posted by CaptainBlack
That looks plausible given that you only have ~15 significant digits in your calculations.

But why are you trying to do this numerically.

CB
Because I am lack knowledge of maths required to do it in any other way.M

12. ## Re: My hardware and software fails to calculate this.

Inspired by Captain Black and Bacterius, I gave it some more effort.

First let me explain some of the changes. When looking up the datasheet for the clock, i found that the stability over 1 year was not 2E-11, but actually 2E-9! I also changed the value from 10 000 000Hz to 10MHz (because It looked more promising whilst playing with the numbers). Please look at what I came up with:

$D(t)=\int_0^t (10MHz*1.000000002^t)-(10MHz)\; dt$

And after 223610 years:

definite integral - Wolfram|Alpha

My interpretation: that after 223610 years, clock A (starting at 10MHz) will have drifted maximum +-10MHz (1 second) from clock B which also has a frequency of 10MHz.

Do you agree?

Thanks so much.

Kind regards,
Marius