-
Notifications
You must be signed in to change notification settings - Fork 0
Convert frequency offset to freqcd form #11
Comments
Using dataset27 as an example, compare the results from method 1 and method 2: print((1/(1+bob_freq)-1)) # 1.408126167778967e-05
print((-bob_freq)/(1 + bob_freq)) # 1.4081261677757226e-05
print(alice_freq) # 1.4081094847240294e-05 Notice that results from two expressions in method 1 are quite near, but much different from method 2. This is because the frequency convergency test in our pfind doesn't go to exact 1 but a float number very near to 1. In this dataset: print((1 + alice_freq) * (1 + bob_freq)) # 0.9999999998331718 If we correct for this in method 1, compare the results: print((0.9999999998331718/(1+bob_freq)-1)) # 1.4081094847240294e-05
print((0.9999999998331718-1-bob_freq)/(1 + bob_freq)) # 1.4081094847190168e-05
print(alice_freq) # 1.4081094847240294e-05 Now the first expression in method 1 gives the same value as method 2, while the second method lost some accuracy (but very small). In summary, the major accuracy loss is from the near-1 result in the frequency convergency test. The loss from the calculation (multiplication /division of float number) is much less compare with it. |
To illustrate more on the comparasion of accuracy loss between the two expressions in method 1, we can perform the following calculation: import numpy as np
for bob_freq in np.geomspace(1e-5, 1e-10, 6):
print((1/(1+bob_freq)-1))
print((-bob_freq)/(1 + bob_freq))
print()
# -9.999900001056439e-06
# -9.99990000099999e-06
# -9.99998999939855e-07
# -9.99999000001e-07
# -9.99999900663795e-08
# -9.999999000000099e-08
# -9.999999828202988e-09
# -9.999999900000002e-09
# -1.000000082740371e-09
# -9.99999999e-10
# -1.000000082740371e-10
# -9.999999999e-11 Up to around 1e-14, we still hold the accuracy. In this way, we can say that the calculation does not remove a lot of accuracy. |
Method 1: calculate directly from original frequency offset by running$\frac{1}{1 + \Delta f'} - 1$ or $-\frac{\Delta f'}{1 + \Delta f'}$
pfind(alice, bob)
and perform the calculationMethod 2: obtain the result from
pfind(bob, alice)
and convert the time offset result accordinglyWe need to quantify which method has less error.
The text was updated successfully, but these errors were encountered: