Defines the class for physical quantities.

Constructors

Properties

Methods

Constructors

Properties

unit: Unit.Unit

The units attached to the value

value: number

The value of the quantity

Methods

  • Convert this quantity to another set of units. Will throw an error if dimensions do not match.

    Parameters

    • newUnit: Unit.Unit

      The unit to convert to

    Returns Quantity.Quantity

    An equivalent quantity with new units

  • Divide this quantity by another and return the quotient.

    Parameters

    • other: Quantity.Quantity

      Another quantity (any dimension)

    • exponent: number = 1

      An optional exponent to apply on the other quantity

    Returns Quantity.Quantity

    The quotient, with combined units (some may cancel)

  • Raise this quantity to an exponent and return the power.

    Parameters

    • exponent: number

      The exponent to raise this unit to

    Returns Quantity.Quantity

    The power, with appropriate units

  • Multiply this quantity by a constant scalar factor and return the result.

    Parameters

    • factor: number

      Any scalar value

    Returns Quantity.Quantity

    A scaled quantity with the same units

  • Multiply this quantity by another and return the product.

    Parameters

    • other: Quantity.Quantity

      Another quantity (any dimension)

    • exponent: number = 1

      An optional exponent to apply on the other quantity

    Returns Quantity.Quantity

    The product, with combined units (some may cancel)

  • Generate valid LaTeX code representing this quantity.

    Returns string

    A valid LaTeX equation

MMNEPVFCICPMFPCPTTAAATR