Physics::Unit

Physics::Unit module can manipulate physics units and dimensions.
Download

Physics::Unit Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Chris Maloney
  • Publisher web site:
  • http://search.cpan.org/~klortho/Physics-Unit-0.04/lib/Physics/Unit.pm

Physics::Unit Tags


Physics::Unit Description

Physics::Unit module can manipulate physics units and dimensions. Physics::Unit module can manipulate physics units and dimensions.SYNOPSIS use Physics::Unit ':ALL'; # exports all util. function names # Define your own units $ss = new Physics::Unit('furlong / fortnight', 'ff'); # Print the expanded representation of a unit print $ss->expanded, "n"; # Convert from one to another print 'One ', $ss->name, ' is ', $ss->convert('mph'), " miles per hourn"; # Get a Unit's conversion factor print 'Conversion factor of foot is ', GetUnit('foot')->factor, "n";This module allows for the representation of physical quantities with encapsulated units.A Unit is defined by three things: a list of names, a conversion factor, and a dimensionality vector. From the dimensionality, a type can be derived (usually).There are two main types of Unit objects: named and anonymous. Named Unit objects are constant. Anonymous Unit objects, however, can dynamically change.Objects of class Unit define units of measurement that correspond to physical quantities. This module allows you to manipulate these units, generate new derived units from other units, and convert from one unit to another. Each unit is defined by a conversion factor and a dimensionality vector.The conversion factor is a floating point number that specifies how this unit relates to a reference unit of the same dimensionality.The dimensionality vector holds a list of integers - each of which records the power of a base unit in this unit.For example, consider the unit of speed, "miles per hour". This has a dimensionality of (Distance / Time), or of (Distance ^ 1 * Time ^ -1). So this unit's dimensionality vector has a 1 in the place corresponding to Distance, and a -1 in the place corresponding to Time.The reference unit for speed is "meters per second" (since meter is the base unit corresponding to Distance, and second is the base unit corresponding to Time). Therefore, the conversion factor for the unit "miles per hour" is 0.44704, since 1 mph equals 0.44704 meters / sec. Requirements: · Perl


Physics::Unit Related Software