JADE v6.1

Package com.dautelle.physics

Provides support for physical quantities, automatic error calculation (including numeric errors), and dimension-checking done in the form of class-type checking.

See:
          Description

Class Summary
Acceleration This class represents the rate of change of velocity with respect to time.
AmountOfSubstance This class represents the number of elementary entities (molecules, for example) of a substance.
Angle This class represents the figure formed by two lines diverging from a common point.
AngularAcceleration This class represents the rate of change of angular velocity with respect to time.
AngularVelocity This class represents the rate of change of angular displacement with respect to time.
Area This class represents the extent of a planar region or of the surface of a solid measured in square units.
CatalyticActivity This class represents a catalytic activity.
Constants This class defines fundamental physical constants in their symbolic form.
DataAmount This class represents a measure of data amount.
DataRate This class represents the speed of data-transmission.
Duration This class represents a period of existence or persistence.
ElectricCapacitance This class represents an electric capacitance.
ElectricCharge This class represents an electric charge.
ElectricConductance This class represents an electric conductance.
ElectricCurrent This class represents the amount of electric charge flowing past a specified circuit point per unit time.
ElectricInductance This class represents an electric inductance.
ElectricPotential This class represents an electric potential or electromotive force.
ElectricResistance This class represents an Electric Resistance.
Energy This class represents the capacity of a physical system to do work.
Force This class represents a quantity that tends to produce an acceleration of a body in the direction of its application.
Frequency This class represents the number of times a specified phenomenon occurs within a specified interval.
Illuminance This class represents an illuminance.
Length This class represents the extent of something along its greatest dimension or the extent of space between two objects or places.
LuminousFlux This class represents a luminous flux.
LuminousIntensity This class represents the luminous flux density per solid angle as measured in a given direction relative to the emitting source.
MagneticFlux This class represents a magnetic flux.
MagneticFluxDensity This class represents a magnetic flux density.
Mass This class represents the measure of the quantity of matter that a body or an object contains.
Power This class represents the rate at which work is done.
Pressure This class represents a force applied uniformly over a surface.
Quantity This class represents a measurable amount.
Quantity.Factory This inner-class represents the ObjectFactory producing Quantity instances.
Quantity.Value This inner class represents a mutable image of an imutable Quantity.
QuantityFormat This class provides the interface for formatting and parsing quantities.
RadiationDoseAbsorbed This class represents the amount of energy deposited per unit of mass.
RadiationDoseEffective This class represents the effective (or "equivalent") dose of radiation received by a human or some other living organism.
RadioactiveActivity This class represents a radioactive activity.
Scalar This class represents a dimensionless quantity.
SolidAngle This class represents the angle formed by three or more planes intersecting at a common point.
Temperature This class represents the degree of hotness or coldness of a body or an environment.
Torque This class represents the moment of a force.
Velocity This class represents a distance traveled divided by the time of travel.
Volume This class represents the amount of space occupied by a three-dimensional object or region of space, expressed in cubic units.
VolumetricDensity This class represents a mass per unit volume of a substance under specified conditions of pressure and temperature.
 

Package com.dautelle.physics Description

Provides support for physical quantities, automatic error calculation (including numeric errors), and dimension-checking done in the form of class-type checking.

  1. Physical quantities:

    This package contains more than 40 predefined quantities with specific methods (e.g. Angle.sin(), Scalar.log()) and constants (e.g. Velocity.SPEED_OF_LIGHT, Mass.PROTON, Constants.µ0). The appropriate quantity sub-class is automatically instantiated when needed.

    Quantity classes support derivation, making the framework easily extendable. For example:

    
            // Derives from top Quantity class.
            public class MagneticDipoleMoment extends Quantity {
                private final static Factory FACTORY = new Factory(SI.AMPERE.multiply(SI.METER.pow(2))) {
                    protected Quantity create() {
                       return new MagneticDipoleMoment();
                    }
                };
            }
    
            // Derives from quantities other than the Quantity class.
            public class Altitude extends Length {
                private final static Factory FACTORY = new Factory(SI.METER.alternate("meter_height")) {
                    protected Quantity create() {
                       return new Altitude();
                    }
                };
            };
    Note: Mapping of the predefined quantities occurs automatically when the library is initialized If the framework is extended (e.g. new quantity sub-classes) the application has to make sure that the new classes are initialized to ensure proper unit registration.

  2. Error calculations:

    Quantities take into account measurement errors as well as numeric errors. The default QuantityFormat outputs only the decimal digits being exact. For example:

              Length   x = (Length)   Quantity.valueOf(1, SI.METER);
              Velocity v = (Velocity) Quantity.valueOf(0.01, SI.METER.divide(SI.SECOND));
              Duration t = (Duration) Quantity.valueOf(1, SI.MICRO(SI.SECOND));
              for (int i=0; i < 10000000; i++) {
                  x = (Length) x.add(v.multiply(t));
              }
              System.out.println(x);
    
              > 1.10000000 m
    The exact value is guaranteed to be in the range: ]1.09999999 m, 1.10000001 m[. The same calculation using double would have printed
              > 1.099999999392253
    with no idea on the accuracy of this result.

  3. Dimension checking:

    The system unit of a quantity determinates its class. For example, Quantity.valueOf("1 µm") and Quantity.valueOf("1.2 ft") return a Length instance (both "µm" and "ft" units are derived from SI.METER).

    Multiple physical models are supported (e.g. Standard, Relativistic, High-Energy, Quantum and Natural). The current model defines the conversions being allowed as well as the default units to output quantities. For example:

            final Quantity x = Length.valueOf(1, NonSI.INCH);
            System.out.println(x); // Default standard model, length are stated in meters.
            LocalContext.enter();
            try {
                RelativisticModel.select(); // Selects the relativistic model.
                System.out.println(x); // Lengths are stated in second.
                Quantity y = x.add(Duration.valueOf("2.3 µs")); // Length and Duration can be added.
                Mass m = Mass.massOf(Quantity.valueOf("12 GeV")); // Energy is compatible with mass (E=mc2)
            } finally {
               LocalContext.exit();
            }
            > 0.02540000000000000 m
            > 8.47252801803306E-11 s

    Custom units for quantity output is allowed. For example:

            Length x = (Length) Quantity.valueOf(123, SI.CENTI(SI.METER));
            Length.showAs(NonSI.INCH); // Context-local.
            System.out.println(x);
    
            > 48.42519685039370 in


JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.