chenmich / Quantities

Physical quantity calculating is a python library for physical quantity calculation. It can determine the type and the corresponding unit of the result of the calculation of the two physical quantities, and also provides the corresponding unit conversion method. Developers can also provide new physical quantities, physical quantity types, and corresponding units by simply subclassing the three classes. The class library supports the SI unit system. Of course, it also has some commonly used non-SI units, such as feet, inches, celsius_degree, fahrenheit_degree, and so on.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

The Physical Quantities Calculating class library is developed in the Python 3.8.5 environment and is a class library that handles the calculating of physical quantities and the conversion of the measurement units. This library is fully close to the concept of physical quantity, and emphasizes the relationship between physical quantities. Automatically generate a new quantity after calculation, which is closer to the domain knowledge of quantity calculation. It can also handle unit conversion between SI unit.

Feature

  • There is only a simple interface for the arithmetic calculation of physical quantities and the selection of measurement units.
  • New types of physical quantities are automatically generated for calculation and automatic unit conversion.
  • It can handle most of the SI unit system units and non-SI unit system units selected by the SI unit system. For example, the minute, hour, day, month, and year of time, etc.
  • By simply subclassing the base class method, new physical quantities and their units of measurement can be easily generated for easy expansion.
  • Use Identity to express the concept of unitless quantity

Install

install from PyPi

pip install Physical-Quantity-calculating

download source from github

Quantities

Version

current version: 0.1.0

Documentation

Documentation

Usage

import quantities as pq
l = pq.Length(33)
t = pq.Time(11)
v = l / t
print(v.value)
print(v.current_unit.express_by_SI_base())

print()
a = v / t
print(a.value)
print(a.current_unit.express_by_SI_base())

The results after running the program are as follows:

3.0
('m/s', 'm/s')

0.2727272727272727
('m\\cdot s^{-2}', 'm·s<sup>-2</sup>')

('km\\cdot s^{-2}', 'km·s<sup>-2</sup>')

('MN\\cdot m', 'MN·m')
('Mkg\\cdot m^{2}\\cdot s^{-2}', 'Mkg·m<sup>2</sup>·s<sup>-2</sup>')

About

Physical quantity calculating is a python library for physical quantity calculation. It can determine the type and the corresponding unit of the result of the calculation of the two physical quantities, and also provides the corresponding unit conversion method. Developers can also provide new physical quantities, physical quantity types, and corresponding units by simply subclassing the three classes. The class library supports the SI unit system. Of course, it also has some commonly used non-SI units, such as feet, inches, celsius_degree, fahrenheit_degree, and so on.

License:MIT License


Languages

Language:Python 100.0%