Re: Rule writing for handling temperatures
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1519] Re: Rule writing for handling temperatures
- From: ianc (Ian Collier)
- Date: Wed, 21 Jun 1995 21:34:09 -0400
- Organization: Wolfram Research, Inc
In article <3s5kiv$5hs at news0.cybernetics.net>, REECE_D
<REECE+_D%A1%Electromagnetic_Sciences at mcimail.com> wrote:
> I have what I think is a simple question that I can't figure out. How
> do I write a set of rules that I can apply to an expression to convert
> between the temperature scales? I want to be able to change 0 dC to 273 dK
> and 459.67 dR as well as realizing 1 dC/W is the same as 1 dK/W which is
> 9/5 dR/W. Any ideas would be appreciated.
>
> The braoder question is has aonyone written the sets of rules necessary
> to handle both metric and english units?
>
> Thanks in advance,
> Daryl
Miscellaneous`Units`, one of the standard Mathematica packages
distributed with every copy of Mathematica, is already able to
convert between degrees Celsius, Centigrade, Fahrenheit, Kelvin
and Rankine as well as performing many other unit conversions.
In[1]:=
Needs["Miscellaneous`Units`"]
In[2]:=
ConvertTemperature[ 135, Kelvin, Rankine]
Out[2]=
243
It would not be hard to extend it to deal with any other temperature
scales if you needed to do so.
I hope this helps.
--Ian
----------------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
----------------------------------------------------------------
Tel (217) 398-0700 Fax (217) 398-0747 ianc at wri.com
Wolfram Research Home Page http://www.wri.com/
----------------------------------------------------------------