Number::Uncertainty - An object-orientated uncertainty object


Number-Uncertainty documentation  | view source Contained in the Number-Uncertainty distribution.

Index


NAME

Top

Number::Uncertainty - An object-orientated uncertainty object

SYNOPSIS

Top

  $obj = new Number::Uncertainty ( Value => $value );

  $obj = new Number::Uncertainty ( Value => $value,
                                   Error => $error_bar );

  $obj = new Number::Uncertainty ( Value => $value,
                                   Lower => $lower_error_bar,
				   Upper => $upper_error_bar );

  $obj = new Number::Uncertainty ( Value => $value,
                                   Min   => $minimum_value,
				   Max   => $maximum_value );

  $obj = new Number::Uncertainty ( Value => $value,
                                   Bound => 'lower' );				   

  $obj = new Number::Uncertainty ( Value => $value,
                                   Bound => 'upper' );

DESCRIPTION

Top

Stores information about a value and its error bounds.

REVISION

Top

$Id: Uncertainty.pm,v 1.4 2005/10/26 20:13:57 cavanagh Exp $

METHODS

Top

Constructor

new

Create a new instance from a hash of options

  $object = new Number::Uncertainty( %hash );

returns a reference a Number::Uncertainty object. 'Value' is the sole mandatory agruement.

Accessor Methods

value

Sets or gets the value of the number

   $obj->value( $val );
   $val = $obj->value();

error

Sets or gets the value of the error

   $obj->error( $err );
   $err = $obj->error();

lower

Sets or gets the value of the lower error value

   $obj->lower( $lower );
   $lower = $obj->lower();

upper

Sets or gets the value of the upper error value

   $obj->upper( $upper );
   $upper = $obj->upper();

min

Sets or gets the value of the minimum value

   $obj->lower( $min );
   $min = $obj->min();

max

Sets or gets the value of the maximum value

   $obj->max( $max );
   $max = $obj->max();

bound

Flag to say whether the value() is an upper or lower bound

   $obj->bound( 'upper' );
   $obj->bound( 'lower' );
   $obj->bound( undef );
   $flag = $obj->bound();

General Methods

configure

Configures the object, takes an options hash as an argument

  $obj->configure( %options );

Does nothing if the array is not supplied.

Operator Overloading

These operators are overloaded:

""

When the object is used in a string context it is stringify'ed.

==

When the object is equated then we do a comparison and find whether the two values are within the error bounds.

!=

When the object is equated then we do a comparison and find whether the two values are within the error bounds.

greater_than
less_than
*

When the object is multiplied.

COPYRIGHT

Top

AUTHORS

Top

Alasdair Allan <aa@astro.ex.ac.uk>,


Number-Uncertainty documentation  | view source Contained in the Number-Uncertainty distribution.