Interface MeasuredQuantity<Q extends Quantity<Q>>


public interface MeasuredQuantity<Q extends Quantity<Q>>
A measured physical quantity with associated uncertainty.

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 Details

    • getValue

      Quantity<Q> getValue()
      Returns the central (best estimate) value of this measurement.
      Returns:
      the measured value
    • getUncertainty

      Quantity<Q> getUncertainty()
      Returns the absolute uncertainty (±).

      This is the standard uncertainty (1σ) or expanded uncertainty (kσ) depending on the confidence level.

      Returns:
      the uncertainty in the same units as the value
    • 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

      MeasuredQuantity<Q> subtract(MeasuredQuantity<Q> other)
      Subtracts another measured quantity.

      Uncertainty propagation: σ_z = √(σ_x² + σ_y²)

      Parameters:
      other - the quantity to subtract
      Returns:
      the difference with propagated uncertainty
    • multiply

      MeasuredQuantity<Q> multiply(Real scalar)
      Multiplies by a scalar (exact, no uncertainty).

      Uncertainty propagation: σ_z = |scalar| × σ_x

      Parameters:
      scalar - the exact multiplier
      Returns:
      the product with scaled uncertainty
    • multiply

      default MeasuredQuantity<Q> multiply(double scalar)
      Multiplies by a scalar (exact, no uncertainty).
      Parameters:
      scalar - the exact multiplier
      Returns:
      the product with scaled uncertainty
    • multiply

      <R extends Quantity<R>> MeasuredQuantity<?> multiply(MeasuredQuantity<R> other)
      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

      MeasuredQuantity<Q> divide(Real scalar)
      Divides by a scalar (exact, no uncertainty).

      Uncertainty propagation: σ_z = σ_x / |scalar|

      Parameters:
      scalar - the exact divisor
      Returns:
      the quotient with scaled uncertainty
    • divide

      default MeasuredQuantity<Q> divide(double scalar)
      Divides by a scalar (exact, no uncertainty).
      Parameters:
      scalar - the exact divisor
      Returns:
      the quotient with scaled uncertainty
    • divide

      <R extends Quantity<R>> MeasuredQuantity<?> divide(MeasuredQuantity<R> other)
      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

      MeasuredQuantity<Q> to(Unit<Q> targetUnit)
      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

      boolean overlaps(MeasuredQuantity<Q> other)
      Returns true if this measurement overlaps with another within uncertainties.
      Parameters:
      other - the other measurement
      Returns:
      true if confidence intervals overlap
    • isConsistentWith

      boolean isConsistentWith(MeasuredQuantity<Q> other)
      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

      Real getStandardizedDifference(MeasuredQuantity<Q> other)
      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