Physical units/CalDims
From HaskellWiki
< Physical units(Difference between revisions)
m (corrected days per year and result of the related calculation) |
|||
| (9 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
| - | + | CalDims is a flexible and easy to use calculation tool that has support for units. | |
| - | ==The calculator's features== | + | == The calculator's features == |
* Support for user defined basic units and derrived units | * Support for user defined basic units and derrived units | ||
* user defined functions | * user defined functions | ||
| - | |||
| - | |||
* built-in feature to simplify units | * built-in feature to simplify units | ||
* easy unit-conversion | * easy unit-conversion | ||
| - | == | + | == Example session == |
| - | + | <haskell> | |
| - | * a | + | > # A bird is moving 1 meter per second, how far will it be in 2 hours? |
| - | * | + | > 1m/s * 2h | m |
| + | 7200 m | ||
| + | > # A 60 Watt electric light is burning 2 hours a day. How much energy is consumed in one week? | ||
| + | > 60 W * 2 h / d * 7 d | J | ||
| + | 3024000 J | ||
| + | > # What's that in Watt hours? | ||
| + | > 60 W * 2 h / d * 7 d | W h | ||
| + | 840 W h | ||
| + | > #How much is it in a year (we derrive `year` first) | ||
| + | > year := 365 d | ||
| + | ok. | ||
| + | > 60 W * 2 h / d * 1 year | W h | ||
| + | 43799.99999999999 W h | ||
| + | > # Bits and bytes are not defined. We do so: | ||
| + | > \u bit | ||
| + | ok, but an object has changed | ||
| + | > byte := 8 bit | ||
| + | ok, but an object has changed | ||
| + | > kbyte := 1024 byte | ||
| + | ok. | ||
| + | > mbyte := 1024 kbyte | ||
| + | ok. | ||
| + | > 2 mbyte | - | ||
| + | 16777216 bit | ||
| + | > 2 mbyte | kbyte | ||
| + | 2048 kbyte | ||
| + | </haskell> | ||
| + | == Sources == | ||
| + | Sources are availables at HackageDB: | ||
| + | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/caldims | ||
| - | |||
| - | + | [[Category:Applications]] | |
| + | [[Category:Mathematics]] | ||
Current revision
CalDims is a flexible and easy to use calculation tool that has support for units.
1 The calculator's features
- Support for user defined basic units and derrived units
- user defined functions
- built-in feature to simplify units
- easy unit-conversion
2 Example session
> # A bird is moving 1 meter per second, how far will it be in 2 hours? > 1m/s * 2h | m 7200 m > # A 60 Watt electric light is burning 2 hours a day. How much energy is consumed in one week? > 60 W * 2 h / d * 7 d | J 3024000 J > # What's that in Watt hours? > 60 W * 2 h / d * 7 d | W h 840 W h > #How much is it in a year (we derrive `year` first) > year := 365 d ok. > 60 W * 2 h / d * 1 year | W h 43799.99999999999 W h > # Bits and bytes are not defined. We do so: > \u bit ok, but an object has changed > byte := 8 bit ok, but an object has changed > kbyte := 1024 byte ok. > mbyte := 1024 kbyte ok. > 2 mbyte | - 16777216 bit > 2 mbyte | kbyte 2048 kbyte
3 Sources
Sources are availables at HackageDB: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/caldims
