units.mac temperature conversion



Whatever the other merits of the file "units.mac"  (which seem to have no
author), this piece of code is, as you demonstrate, nonsense.

Maxima simply cannot do much the way this file tries.    0*anything is a
(dimensionless) 0.
The units of "anything" are lost.

Also since 1*anything   does not involve multiplication, the rule on "*" is
lost as well.

 
There are a number of papers on computing with units, automatically. 
I suppose they make each scalar into a pair, e.g. [0, degreesfahrenheit] and
compute with that.

I think the failure of the .mac file to have any documentation suggests you
shouldn't use it.
RJF


> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Edward A. Romana
> Sent: Sunday, November 25, 2007 2:04 PM
> To: maxima at math.utexas.edu
> Subject: units.mac temperature conversion
> 
> ~~~
> 
> How can the temperature conversion part of units.mac be made to work.
> 
> (%i1) matchdeclare(freeofdegreefahrenheit, freeof(degreefahrenheit));
> tellsimpafter(freeofdegreefahrenheit*degreefahrenheit,
> (freeofdegreefahrenheit+459.67)*degreekelvin/1.8) ;
> 
> matchdeclare(freeofdegreecelsius   , freeof(degreecelsius));
> tellsimpafter(freeofdegreecelsius*degreecelsius,
>              (freeofdegreecelsius+273.15)*degreekelvin) ;
> (%o1) done 
> (%o2) [*rule1,simptimes]
> (%o3) done
> (%o4) [*rule2,*rule1,simptimes]       
>  
> (%i5) 100*degreefahrenheit;           /* test, convert 100 F to K */ 
> (%o5) 310.9277777777778*degreekelvin  /* ok */     
> 
> (%i7) 1*degreefahrenheit;             /* fail */    
> (%o7) degreefahrenheit
> 
> (%i8) 0*degreefahrenheit;              /* fail */
> (%o8) 0
> 
> 
> 
> Thanks
> Ed
> 
> ~~~
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>