Physical quantity with units Constructor: - PhysicalQuantity(|value|, |unit|), where |value| is a number of arbitrary type and |unit| is a string containing the unit name. - PhysicalQuantity(|string|), where |string| contains both the value and the unit. This form is provided to make interactive use more convenient. PhysicalQuantity instances allow addition, subtraction, multiplication, and division with each other as well as multiplication, division, and exponentiation with numbers. Addition and subtraction check that the units of the two operands are compatible and return the result in the units of the first operand. A limited set of mathematical functions (from module Numeric) is applicable as well: sqrt -- equivalent to exponentiation with 0.5. sin, cos, tan -- applicable only to objects whose unit is compatible with 'rad'.

Definition at line 37 of file PhysicalQuantities.py.

## Public Member Functions | |

def | __abs__ |

def | __add__ |

def | __cmp__ |

def | __div__ |

def | __init__ |

def | __mul__ |

def | __neg__ |

def | __nonzero__ |

def | __pos__ |

def | __pow__ |

def | __rdiv__ |

def | __repr__ |

def | __rpow__ |

def | __rsub__ |

def | __str__ |

def | __sub__ |

def | convertToUnit |

def | cos |

def | inBaseUnits |

def | inUnitsOf |

def | isCompatible |

def | sin |

def | sqrt |

def | tan |

## Public Attributes | |

unit | |

value | |

## Private Member Functions | |

def | _sum |

## Static Private Attributes | |

__radd__ = __add__ | |

__rmul__ = __mul__ | |

tuple | _number = re.compile('[+-]?[0-9]+(\\.[0-9]*)?([eE][+-]?[0-9]+)?') |

The documentation for this class was generated from the following file:

- ScientificPython-2.4.11/Scientific/Physics/PhysicalQuantities.py

Generated by Doxygen 1.6.0 Back to index