Wikifunctions:Type proposals/Value with error
Summary
Two rational numbers representing the value and the error.
Uses
To represent and handle causal (Gaussian) errors and their propagation in mathematical operations. This type would be useful primarily in science for calculations involving measured quantities, involving error propagation.
Structure
It should consist in two values of type Z19677: the value (here represented with key ZnnnK1) and the error (here represented with key ZnnnK2). The error should be interpreted as a causal error.
Example values
15.6 ± 0.3
{
"type": "Value with error",
"value": {
"type": "Rational number",
"sign": "positive",
"numerator": {
"type": "Natural number",
"value": "156"
},
"denominator": {
"type": "Natural number",
"value": "10"
}
},
"error": {
"type": "Rational number",
"sign": "positive",
"numerator": {
"type": "Natural number",
"value": "3"
},
"denominator": {
"type": "Natural number",
"value": "10"
}
}
}
|
{
"Z1K1": "Znnn",
"ZnnnK1": {
"Z1K1": "Z19677",
"Z19677K1": "Z16660",
"Z19677K2": {
"Z1K1": "Z13518",
"Z13518K1": "156"
},
"Z19677K3": {
"Z1K1": "Z13518",
"Z13518K1": "10"
}
},
"ZnnnK2": {
"Z1K1": "Z19677",
"Z19677K1": "Z16660",
"Z19677K2": {
"Z1K1": "Z13518",
"Z13518K1": "3"
},
"Z19677K3": {
"Z1K1": "Z13518",
"Z13518K1": "10"
}
}
}
|
Validator
The validator ensures that:
- both values are valid
- the error is positive (or zero)
Identity
Two values with error are the same if both the values and the errors are the same.
Converting to code
Python
As a Dictionary containing the value and the error (in the form of Fractions).
JavaScript
As an Object containing the value and the error.
Display function
The display function should first display the value in decimal representation, then the character "±" and then the error, also in decimal representation. Further discussion is needed on how to handle the number of meaningful digits.
Read function
It should just read the two values as two rationals.
Alternatives
Values could be of type Z20838, but it seems to me that there is building consensus that Z19677 should be viewed as the default type for scientific calculations.
Comments
Support as proposer. Dv103 (talk) 19:27, 11 April 2025 (UTC)- I'm not sure we need this (yet?) given that Z6010 has the lower and upper bounds which effectively express uncertainties. --99of9 (talk) 13:39, 7 April 2026 (UTC)
- The main difference would be that the errors of this type have the semantic of casual error, while the errors of Wikidata quantity (Z6010) are maximal errors. Dv103 (talk) 05:50, 12 May 2026 (UTC)
- Can you suggest examples of where we need to express or work with casual errors (that couldn't be done with a Z6010 object)? Also, if we did want to go down this route, why do we limit the error to be symmetric? --99of9 (talk) 05:57, 12 May 2026 (UTC)
- Casual error are the standard in science; most of the scientific measurement are expressed with random error. The main difference between random and maximum error is in the error propagation rules, so this type would actually behave differently from Wikidata quantities in mathematical operations.
- The error is symmetric because most of the tyme, the casual errof is symmetric, but it's also true that in some niche areas of science, asymmetric random error is used. Perhaps it's something we can think of.
- I was also thinking to add also the systematic error, in order to have a more complete scientific error handling, and so we would better differentiate this type from Wikidata quantities. Dv103 (talk) 06:06, 12 May 2026 (UTC)
- My guess is that some of the values in Wikidata that use upper and lower bounds are actually using scientific measurement errors to get them. I'm not sure if they go for one- two- or three- sigma (which are you expecting here by the way?). But in any case, we could still use a Z6010 object to represent a value with a scientific error. We'd just need to send it to the right error-propagating function when multiplying or otherwise manipulating. --99of9 (talk) 06:20, 12 May 2026 (UTC)
- By "casual" and "maximal", do you mean "random" and "systematic"? I've edited the proposal to use those. ("Random" is the idiomatic English adjective for things relating to chance, and it prevents confusion with the term "causal".) YoshiRulz (talk) 20:41, 27 July 2026 (UTC)
- No, with "causal" I meant normal gaussian errors, while "maximal" errors indicated the maximum possible error. Both random and systematic errors can be gaussian or systematic. Dv103 (talk) 20:59, 27 July 2026 (UTC)
- Can you suggest examples of where we need to express or work with casual errors (that couldn't be done with a Z6010 object)? Also, if we did want to go down this route, why do we limit the error to be symmetric? --99of9 (talk) 05:57, 12 May 2026 (UTC)
- The main difference would be that the errors of this type have the semantic of casual error, while the errors of Wikidata quantity (Z6010) are maximal errors. Dv103 (talk) 05:50, 12 May 2026 (UTC)
- Question how are negative errors handled? Feeglgeef (talk) 22:53, 11 May 2026 (UTC)
- What are negative errors? Dv103 (talk) 05:47, 12 May 2026 (UTC)
- For example, 1 +- -1. Feeglgeef (talk) 09:24, 12 May 2026 (UTC)
- This should not be a valid value. Dv103 (talk) 09:30, 12 May 2026 (UTC)
- For example, 1 +- -1. Feeglgeef (talk) 09:24, 12 May 2026 (UTC)
- What are negative errors? Dv103 (talk) 05:47, 12 May 2026 (UTC)
Oppose, I think Z6010 should be sufficient --Ameisenigel (talk) 08:29, 12 May 2026 (UTC)
Comment The two kinds of error propagation are far too easy to confuse as it is; forcing people to choose between a pair of nearly-identical Types before each calculation will not help. How is the distinction made in quantity-typed Wikidata statements? A particular qualifier? YoshiRulz (talk) 20:28, 27 July 2026 (UTC)