Numeric error propagation: Difference between revisions

m
added whitespace before the TOC (table of contents), added other whitespace and highlighting to the task's preamble.
m (→‎{{header|REXX}}: added the REXX language.)
m (added whitespace before the TOC (table of contents), added other whitespace and highlighting to the task's preamble.)
Line 1:
{{task}}
 
If f, a, and b are values with uncertainties σ<sub>f</sub>, σ<sub>a</sub>, and σ<sub>b</sub>. and c is a constant; then if f is derived from a, b, and c in the following ways, then σ<sub>f</sub> can be calculated as follows:
If &nbsp; '''f''', &nbsp; '''a''', &nbsp; and &nbsp; '''b''' &nbsp; are values with uncertainties &nbsp; σ<sub>f</sub>, &nbsp; σ<sub>a</sub>, &nbsp; and &nbsp; σ<sub>b</sub>, &nbsp; and &nbsp; '''c''' &nbsp; is a constant;
<br>then if &nbsp; '''f''' &nbsp; is derived from &nbsp; '''a''', &nbsp; '''b''', &nbsp; and &nbsp; '''c''' &nbsp; in the following ways,
<br>then &nbsp; σ<sub>f</sub> &nbsp; can be calculated as follows:
 
:;Addition/Subtraction
:* If &nbsp; f = a &plusmn; c, &nbsp; or &nbsp; f = c &plusmn; a &nbsp; then &nbsp; '''σ<sub>f</sub> = σ<sub>a</sub>'''
:* If &nbsp; f = a &plusmn; b &nbsp; then &nbsp; '''σ<sub>f</sub><sup>2</sup> = σ<sub>a</sub><sup>2</sup> + σ<sub>b</sub><sup>2</sup>'''
 
:;Multiplication/Division
:* If &nbsp; f = ca &nbsp; or &nbsp; f = ac &nbsp; &nbsp; &nbsp; then &nbsp; '''σ<sub>f</sub> = |cσ<sub>a</sub>|'''
:* If &nbsp; f = ab &nbsp; or &nbsp; f = a / b &nbsp; then &nbsp; '''σ<sub>f</sub><sup>2</sup> = f<sup>2</sup>( (σ<sub>a</sub> / a)<sup>2</sup> + (σ<sub>b</sub> / b)<sup>2</sup>)'''
 
:;Exponentiation
:* If &nbsp; f = a<sup>c</sup> &nbsp; then &nbsp; '''σ<sub>f</sub> = |fc(σ<sub>a</sub> / a)|'''
 
 
:Caution:
::This implementation of error propagation does not address issues of dependent and independent values. &nbsp; It is assumed that &nbsp; '''a''' &nbsp; and &nbsp; '''b''' &nbsp; are independent and so the formula for multiplication should not be applied to &nbsp; '''a*a''' &nbsp; for example. &nbsp; See &nbsp; [[Talk:Numeric_error_propagation|the talk page]] &nbsp; for some of the implications of this issue.
 
:Caution:
::This implementation of error propagation does not address issues of dependent and independent values. It is assumed that a and b are independent and so the formula for multiplication should not be applied to a*a for example. See [[Talk:Numeric_error_propagation|the talk page]] for some of the implications of this issue.
 
;Task details:
Line 20 ⟶ 25:
# Given coordinates and their errors:<br>x1 = 100 &plusmn; 1.1<br>y1 = 50 &plusmn; 1.2<br>x2 = 200 &plusmn; 2.2<br>y2 = 100 &plusmn; 2.3<br> if point p1 is located at (x1, y1) and p2 is at (x2, y2); calculate the distance between the two points using the classic pythagorean formula:<br> '''d = &radic;((x1 - x2)<sup>2</sup> + (y1 - y2)<sup>2</sup>)'''
# Print and display both '''d''' and its error.
 
 
;References:
* [http://casa.colorado.edu/~benderan/teaching/astr3510/stats.pdf A Guide to Error Propagation] B. Keeney, 2005.
* [[wp:Propagation of uncertainty|Propagation of uncertainty]] Wikipedia.
 
 
;Cf.:
* [[Quaternion type]]
<br><br>
 
=={{header|Ada}}==