Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dimensional analysis
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Programming languages == Dimensional correctness as part of [[type checking]] has been studied since 1977.<ref>{{cite journal |last=Gehani |first=N. |year=1977 |title=Units of measure as a data attribute |journal=Comput. Lang. |volume=2 |issue=3 |pages=93–111 |doi=10.1016/0096-0551(77)90010-8}}</ref> Implementations for Ada<ref>{{cite journal |last=Gehani |first=N. |date=June 1985 |title=Ada's derived types and units of measure |journal=Software: Practice and Experience |volume=15 |issue=6 |pages=555–569 |doi=10.1002/spe.4380150604 |s2cid=40558757}}</ref> and C++<ref>{{cite journal |last1=Cmelik |first1=R. F. |last2=Gehani |first2=N. H. |date=May 1988 |title=Dimensional analysis with C++ |journal=IEEE Software |volume=5 |issue=3 |pages=21–27 |doi=10.1109/52.2021 |s2cid=22450087}}</ref> were described in 1985 and 1988. Kennedy's 1996 thesis describes an implementation in [[Standard ML]],<ref>{{cite thesis |first=Andrew J. |last=Kennedy |title=Programming languages and dimensions |type=Phd |date=April 1996 |publisher=University of Cambridge |id=UCAM-CL-TR-391 |issn=1476-2986 |volume=391 |url=http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-391.html}}</ref> and later in [[F Sharp (programming language)|F#]].<ref>{{cite book |last=Kennedy |first=A. |title=Central European Functional Programming School. CEFP 2009 |publisher=Springer |year=2010 |isbn=978-3-642-17684-5 |editor-last=Horváth |editor-first=Z. |series=Lecture Notes in Computer Science |volume=6299 |pages=268–305 |chapter=Types for Units-of-Measure: Theory and Practice |citeseerx=10.1.1.174.6901 |doi=10.1007/978-3-642-17685-2_8 |editor2-last=Plasmeijer |editor2-first=R. |editor3-last=Zsók |editor3-first=V.}}</ref> There are implementations for [[Haskell]],<ref>{{cite journal |last=Gundry |first=Adam |date=December 2015 |title=A typechecker plugin for units of measure: domain-specific constraint solving in GHC Haskell |url=http://adam.gundry.co.uk/pub/typechecker-plugins/typechecker-plugins-2015-07-17.pdf |url-status=live |journal=SIGPLAN Notices |volume=50 |issue=12 |pages=11–22 |doi=10.1145/2887747.2804305 |archive-url=https://web.archive.org/web/20170810000458/http://adam.gundry.co.uk/pub/typechecker-plugins/typechecker-plugins-2015-07-17.pdf |archive-date=2017-08-10}}</ref> [[OCaml]],<ref>{{cite book |last1=Garrigue |first1=J. |title=28ièmes Journées Francophones des Langaeges Applicatifs, Jan 2017, Gourette, France |last2=Ly |first2=D. |year=2017 |language=fr |chapter=Des unités dans le typeur |id=hal-01503084 |chapter-url=https://www.math.nagoya-u.ac.jp/~garrigue/papers/ocamldim.pdf |archive-url=https://web.archive.org/web/20201110105231/https://www.math.nagoya-u.ac.jp/~garrigue/papers/ocamldim.pdf |archive-date=2020-11-10 |url-status=live}}</ref> and [[Rust (programming language)|Rust]],<ref>{{cite web |last=Teller |first=David |date=January 2020 |title=Units of Measure in Rust with Refinement Types |url=https://yoric.github.io/post/uom.rs/}}</ref> Python,<ref>{{cite web |last=Grecco |first=Hernan E. |date=2022 |title=Pint: makes units easy |url=https://pint.readthedocs.io/en/stable/}}</ref> and a code checker for [[Fortran]].<ref>{{cite web |date=2018 |title=CamFort: Specify, verify, and refactor Fortran code |url=https://camfort.github.io/ |publisher=University of Cambridge; University of Kent}}</ref><ref>{{cite book |last1=Bennich-Björkman |first1=O. |title=Proceedings of the 11th ACM SIGPLAN International Conference on Software Language Engineering |last2=McKeever |first2=S. |date=2018 |isbn=978-1-4503-6029-6 |pages=121–132 |chapter=The next 700 unit of measurement checkers |doi=10.1145/3276604.3276613 |s2cid=53089559}}</ref><br /> Griffioen's 2019 thesis extended Kennedy's [[Hindley–Milner type system]] to support Hart's matrices.<ref>{{harvnb|Hart|1995}}</ref><ref>{{cite thesis |first=P. |last=Griffioen |title=A unit-aware matrix language and its application in control and auditing |publisher=University of Amsterdam |year=2019 |url=https://pure.uva.nl/ws/files/42206706/Thesis.pdf |archive-url=https://web.archive.org/web/20200221072448/https://pure.uva.nl/ws/files/42206706/Thesis.pdf |archive-date=2020-02-21 |url-status=live |hdl=11245.1/fd7be191-700f-4468-a329-4c8ecd9007ba}}</ref> McBride and Nordvall-Forsberg show how to use [[dependent type]]s to extend type systems for units of measure.<ref>{{cite book |last1=McBride |first1=Conor |url= |title=Advanced Mathematical and Computational Tools in Metrology and Testing XII |last2=Nordvall-Forsberg |first2=Fredrik |date=2022 |publisher=World Scientific |isbn=9789811242380 |series=Advances in Mathematics for Applied Sciences |pages=331–345 |chapter=Type systems for programs respecting dimensions |doi=10.1142/9789811242380_0020 |author-link=Conor McBride |chapter-url=https://strathprints.strath.ac.uk/76626/1/McBride_etal_amctmtxii2021_type_systems_for_programs_respecting_dimensions.pdf |archive-url=https://web.archive.org/web/20220517115417/https://strathprints.strath.ac.uk/76626/1/McBride_etal_amctmtxii2021_type_systems_for_programs_respecting_dimensions.pdf |archive-date=2022-05-17 |url-status=live |s2cid=243831207}}</ref> Mathematica 13.2 has a function for transformations with quantities named NondimensionalizationTransform that applies a nondimensionalization transform to an equation.<ref>{{Cite web |title=NondimensionalizationTransform—Wolfram Language Documentation |url=https://reference.wolfram.com/language/ref/NondimensionalizationTransform.html.en |access-date=2023-04-19 |website=reference.wolfram.com}}</ref> Mathematica also has a function to find the dimensions of a unit such as 1 J named UnitDimensions.<ref>{{Cite web |title=UnitDimensions—Wolfram Language Documentation |url=https://reference.wolfram.com/language/ref/UnitDimensions.html.en |access-date=2023-04-19 |website=reference.wolfram.com}}</ref> Mathematica also has a function that will find dimensionally equivalent combinations of a subset of physical quantities named DimensionalCombations.<ref>{{Cite web |title=DimensionalCombinations—Wolfram Language Documentation |url=https://reference.wolfram.com/language/ref/DimensionalCombinations.html.en |access-date=2023-04-19 |website=reference.wolfram.com}}</ref> Mathematica can also factor out certain dimension with UnitDimensions by specifying an argument to the function UnityDimensions.<ref name=":0">{{Cite web |title=UnityDimensions—Wolfram Language Documentation |url=https://reference.wolfram.com/language/ref/UnityDimensions.html.en |access-date=2023-04-19 |website=reference.wolfram.com}}</ref> For example, you can use UnityDimensions to factor out angles.<ref name=":0" /> In addition to UnitDimensions, Mathematica can find the dimensions of a QuantityVariable with the function QuantityVariableDimensions.<ref>{{Cite web |title=QuantityVariableDimensions—Wolfram Language Documentation |url=https://reference.wolfram.com/language/ref/QuantityVariableDimensions.html.en |access-date=2023-04-19 |website=reference.wolfram.com}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)