Error propagation when using modulus operator

Click For Summary
The discussion revolves around error propagation when using the modulo operator in calculations involving angles. The user is calculating the angle theta using the arctan function and then applying a modulo operation to adjust the range from [-π, π] to [0, 2π]. They seek confirmation on their error propagation formula for sigma_theta and whether modifications are needed after changing the range. Additionally, they inquire about handling cases where A equals zero, which complicates the error calculation due to the denominator becoming infinite. The conversation highlights the importance of understanding the implications of the modulo operation and the behavior of the arctan function in relation to error propagation.
TheCanadian
Messages
361
Reaction score
13
Sorry if the answer is very simple, but I just had a question regarding error propagation when using a modulo operator in intermediate steps. For example, I have ## \theta = arctan(\frac {A}{B}) ## and then I do ## \theta ## % ##2\pi## (modulo ##2\pi##). This gives me an answer between ## [0,2\pi] ## instead of ##[-\pi,\pi]##. This new answer in this new range is the answer I want. Now, when I calculate ## \sigma_{\theta} ##, I get:

## \sigma_{\theta} = \frac{A/B * \sqrt{ (\sigma_{A}/A)^2 + (\sigma_{B}/B)^2}}{1 + (A/B)^2} ##

Firstly, I just want to confirm: is there anything wrong with my equation for ## \sigma_{\theta} ##?

Secondly, since I change theta itself from ##[-\pi,\pi]## to ## [0,2\pi] ##by arithmetic operations, is there any modifications to ## \sigma_{\theta} ## in this case?

Thirdly, this is just a general error propagation question (sorry, I'm a novice), but if you have constant noise (i.e. a constant error), in the computation of A/B such that ## \sigma_A = \sigma_B = 2 ##, then you have ## \sigma_{A/B} = \frac{A}{B}\sqrt{ (2/A)^2 + (2/B)^2}##, but if A = 0, then A/B = 0, but in that case, the denominator in the square root for error goes to infinity but the numerator still has 0...so how does one approach computing the error in such as case? Is ## \sigma_{A/B} = \frac{1}{B}\sqrt{ (2)^2}## valid in such a case (I just multiplied by A/A)?

Please let me know if I have any mistakes. Any advice is appreciated!
 
Last edited:
Mathematics news on Phys.org
TheCanadian said:
Sorry if the answer is very simple, but I just had a question regarding error propagation when using a modulo operator in intermediate steps. For example, I have ## \theta = arctan(\frac {A}{B}) ## and then I do ## \theta % 2\pi ##. This gives me an answer between ## [0,2\pi] ## instead of ##[-\pi,\pi]##. This new answer in this new range is the answer I want. Now, when I calculate ## \sigma_{\theta} ##, I get:

## \sigma_{\theta} = \frac{A/B * \sqrt{ (\sigma_{A}/A)^2 + (\sigma_{B}/B)^2}}{1 + (A/B)^2} ##

Firstly, I just want to confirm: is there anything wrong with my equation for ## \sigma_{\theta} ##?

Secondly, since I change theta itself from ##[-\pi,\pi]## to ## [0,2\pi] ##by arithmetic operations, is there any modifications to ## \sigma_{\theta} ## in this case?

Thirdly, this is just a general error propagation question (sorry, I'm a novice), but if you have constant noise (i.e. a constant error), in the computation of A/B such that ## \sigma_A = \sigma_B = 2 ##, then you have ## \sigma_{A/B} = \frac{A}{B}\sqrt{ (2/A)^2 + (2/B)^2}##, but if A = 0, then A/B = 0, but in that case, the denominator goes to infinity but the numerator still has 0...so how does one approach computing the error in such as case?

Please let me know if I have any mistaken. Any advice is appreciated!
Part of your LaTeX is broken, and I can't figure out how to correct it. In the next-to-last paragraph you have this: \frac{A/B * \sqrt{ (2/A)^2 + (2/B)^2}, which is malformed, due to missing several braces. What is it supposed to be? Should it agree with what you have in the 2nd paragraph?
 
Mark44 said:
Part of your LaTeX is broken, and I can't figure out how to correct it. In the next-to-last paragraph you have this: \frac{A/B * \sqrt{ (2/A)^2 + (2/B)^2}, which is malformed, due to missing several braces. What is it supposed to be? Should it agree with what you have in the 2nd paragraph?
I believe I fixed it. Is the error still appearing?
 
Mark44 said:
Part of your LaTeX is broken, and I can't figure out how to correct it. In the next-to-last paragraph you have this: \frac{A/B * \sqrt{ (2/A)^2 + (2/B)^2}, which is malformed, due to missing several braces. What is it supposed to be? Should it agree with what you have in the 2nd paragraph?

Also, if A < 0, then wouldn't ##σ_{A/B}## be negative, too? How exactly does that make sense (if I didn't mess up the formula).
 
TheCanadian said:
I believe I fixed it. Is the error still appearing?
It looks OK now.

TheCanadian said:
Sorry if the answer is very simple, but I just had a question regarding error propagation when using a modulo operator in intermediate steps. For example, I have ## \theta = arctan(\frac {A}{B})## and then I do ##\theta % 2\pi## (modulo 2πi). This gives me an answer between [0,2π] instead of [−π,π] . This new answer in this new range is the answer I want.
I'm not sure if this is valid. Since ##\theta = arctan(A/B)##, ##\theta## will naturally be an angle in the interval (−π/2, π/2), as that is the principal domain for the tangent function, to make it one-to-one, and thus invertible. Also, because you're taking the arctan of A/B, B can't be zero (implying that ##\theta## is −π/2 or π/2.
TheCanadian said:
Now, when I calculate ## \sigma_{\theta} ##, I get:

## \sigma_{\theta} = \frac{A/B * \sqrt{ (\sigma_{A}/A)^2 + (\sigma_{B}/B)^2}}{1 + (A/B)^2} ##

Firstly, I just want to confirm: is there anything wrong with my equation for ##\sigma_{\theta}## ?
 
Mark44 said:
It looks OK now.

I'm not sure if this is valid. Since ##\theta = arctan(A/B)##, ##\theta## will naturally be an angle in the interval (−π/2, π/2), as that is the principal domain for the tangent function, to make it one-to-one, and thus invertible. Also, because you're taking the arctan of A/B, B can't be zero (implying that ##\theta## is −π/2 or π/2.

Ahh yes. Sorry, this was done using a software package. Essentially, based on the sign of A and B, it will compute the angle for the proper quadrant in the interval [-##\pi##,##\pi##] and if B == 0, then there is an extra statement saying it is simply equal to −π/2 (or π/2). It is a simple arithmetic operation (e.g. +- 2##\pi##) depending on the sign of A and B. Based on this additional information, is there anything I should be looking into in my procedure? Errors in the functions themselves should be considered since they're based on series expansions, but is it wrong to assume these errors are also negligible for errors on A or B being approximately 2 (i.e. ##\sigma_{A (or B)} ≈ 2##, so much higher than the errors on the series expansions)?
 
Last edited:
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
1
Views
659
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K