Interface MeasuredQuantity<Q extends Quantity<Q>>
Represents a measurement as a central value with uncertainty bounds, following ISO/IEC Guide 98-3 (GUM) standards. Uncertainty propagation is automatic through mathematical operations.
Example Usage:
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionadd(MeasuredQuantity<Q> other) Adds another measured quantity.default MeasuredQuantity<Q> divide(double scalar) Divides by a scalar (exact, no uncertainty).Divides by a scalar (exact, no uncertainty).<R extends Quantity<R>>
MeasuredQuantity<?> divide(MeasuredQuantity<R> other) Divides by another measured quantity.doubleReturns the confidence level (e.g., 0.95 for 95%).default doubleReturns the coverage factor k.Returns the relative uncertainty as a fraction.Returns the number of standard deviations between this and another measurement.Returns the absolute uncertainty (±).getValue()Returns the central (best estimate) value of this measurement.booleanisConsistentWith(MeasuredQuantity<Q> other) Returns true if this measurement is consistent with another.default MeasuredQuantity<Q> multiply(double scalar) Multiplies by a scalar (exact, no uncertainty).Multiplies by a scalar (exact, no uncertainty).<R extends Quantity<R>>
MeasuredQuantity<?> multiply(MeasuredQuantity<R> other) Multiplies by another measured quantity.booleanoverlaps(MeasuredQuantity<Q> other) Returns true if this measurement overlaps with another within uncertainties.subtract(MeasuredQuantity<Q> other) Subtracts another measured quantity.Converts this measurement to another unit.Returns a concise string representation.Returns a string representation with relative uncertainty.Returns a string representation in scientific notation.
-
Method Details
-
getValue
-
getUncertainty
-
getRelativeUncertainty
Real getRelativeUncertainty()Returns the relative uncertainty as a fraction.Relative uncertainty = |uncertainty / value|
- Returns:
- the relative uncertainty (dimensionless)
-
getConfidenceLevel
double getConfidenceLevel()Returns the confidence level (e.g., 0.95 for 95%).Common levels:
- 0.683 (68.3%) → 1ÃÆ’
- 0.954 (95.4%) → 2ÃÆ’
- 0.997 (99.7%) → 3ÃÆ’
- Returns:
- the confidence level between 0 and 1
-
getCoverageFactor
default double getCoverageFactor()Returns the coverage factor k.For normal distributions: k ≈ 1 for 68%, k ≈ 2 for 95%, k ≈ 3 for 99.7%
- Returns:
- the coverage factor
-
add
Adds another measured quantity.Uncertainty propagation: ÃÆ’_z = √(ÃÆ’_x² + ÃÆ’_y²)
- Parameters:
other- the quantity to add- Returns:
- the sum with propagated uncertainty
-
subtract
Subtracts another measured quantity.Uncertainty propagation: ÃÆ’_z = √(ÃÆ’_x² + ÃÆ’_y²)
- Parameters:
other- the quantity to subtract- Returns:
- the difference with propagated uncertainty
-
multiply
Multiplies by a scalar (exact, no uncertainty).Uncertainty propagation: ÃÆ’_z = |scalar| × ÃÆ’_x
- Parameters:
scalar- the exact multiplier- Returns:
- the product with scaled uncertainty
-
multiply
Multiplies by a scalar (exact, no uncertainty).- Parameters:
scalar- the exact multiplier- Returns:
- the product with scaled uncertainty
-
multiply
Multiplies by another measured quantity.Uncertainty propagation: ÃÆ’_z/z = √((ÃÆ’_x/x)² + (ÃÆ’_y/y)²)
- Type Parameters:
R- the other quantity type- Parameters:
other- the quantity to multiply by- Returns:
- the product with propagated uncertainty
-
divide
Divides by a scalar (exact, no uncertainty).Uncertainty propagation: ÃÆ’_z = ÃÆ’_x / |scalar|
- Parameters:
scalar- the exact divisor- Returns:
- the quotient with scaled uncertainty
-
divide
Divides by a scalar (exact, no uncertainty).- Parameters:
scalar- the exact divisor- Returns:
- the quotient with scaled uncertainty
-
divide
Divides by another measured quantity.Uncertainty propagation: ÃÆ’_z/z = √((ÃÆ’_x/x)² + (ÃÆ’_y/y)²)
- Type Parameters:
R- the other quantity type- Parameters:
other- the quantity to divide by- Returns:
- the quotient with propagated uncertainty
-
to
Converts this measurement to another unit.Both value and uncertainty are converted.
- Parameters:
targetUnit- the target unit- Returns:
- the measurement in the new unit
-
toScientificNotation
String toScientificNotation()Returns a string representation in scientific notation.Format: "value ± uncertainty unit (confidence%)" Example: "10.0 ± 0.2 m (95%)"
- Returns:
- the formatted string
-
toPercentageNotation
String toPercentageNotation()Returns a string representation with relative uncertainty.Format: "value unit ± percentage%" Example: "10.0 m ± 2.0%"
- Returns:
- the formatted string
-
toIntervalNotation
String toIntervalNotation()Returns a concise string representation.Format: "value [lower, upper] unit" Example: "10.0 [9.8, 10.2] m"
- Returns:
- the formatted string
-
overlaps
Returns true if this measurement overlaps with another within uncertainties.- Parameters:
other- the other measurement- Returns:
- true if confidence intervals overlap
-
isConsistentWith
Returns true if this measurement is consistent with another.Consistency check: |x - y| ≤ k√(ÃÆ’_x² + ÃÆ’_y²)
- Parameters:
other- the other measurement- Returns:
- true if measurements are consistent
-
getStandardizedDifference
Returns the number of standard deviations between this and another measurement.Also known as normalized distance or z-score.
- Parameters:
other- the other measurement- Returns:
- the number of standard deviations
-