[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10554: 24.0.92; No units specified (dimensionless quantities in Emac

From: Jay Belanger
Subject: bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc)
Date: Fri, 20 Jan 2012 10:48:39 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

> I would always consider the concept of "converting part of a units
> expression" to be not the main rule to follow here,

If 45 mi/hr is on the stack, and "u c" is called with new units km, what
should happen?  

> but the exception if nothing else works because it is, in general, not
> unique which unit should be used for the remainder, if one converts,
> say, pc^2 into gal.

If volume is converted to volume, there should be no remainder.

> On the other hand, if an expression can be converted to a
> dimensionless number, this involves no ambiguity.

But what if you ask Calc to convert a units expression into a
dimensionless number when it can't be so converted?
Using a system name ("si", "cgs", etc.) as an output unit, as you did
before, solves this problem.  If the expression is dimensionless, then
all units will cancel out.  If the expression is not unitless, then any
left over units will be given in the requested unit system.

>> I suppose you mean /try/ to obtain a dimensionless number.
>> Calc could have a command that will convert an expression to a
>> dimensionless number, if possible, or leave it unchanged, if it cannot
>> be converted to a dimensionless number.  I'm not sure that "u c" should
>> do such branching, but then I'm not sure this behavior is what you
>> meant.
> I assume that currently "u c" needs to branch already if this
> command needs to perform a partial conversion in the sense discussed
> above.

Perhaps I used the wrong word when I said "branch", I meant that Calc
would have to look at the result it computes,  and then decide whether
to return that or return the original expression.  Currently Calc doesn't
do anything like that when it converts units.

> Calc already defines the dimensionless fine structure constant alpha
> as a unit. If one has the expression "7 eV / J", one can convert it
> to alphas via "u c alpha". Yet if one first simplifies this with
> "u s", one just gets a dimensionless number 1.21e-18. This number
> cannot be converted anymore to alphas because Calc is missing an old
> unit.

If you try to convert it to alpha, you can use "1" as a default old
unit and you can give it "alpha" as a new unit.  (Since "1" can't be
used as an output unit, it isn't obvious that it can be used an
an input unit.  Perhaps that's what this discussion is about.)

> This illustrates to me once more that it would be most natural to
> interpret dimensionless numbers as quantities that have the unit
> "1", though this unit is not spelled out explicitly.

That makes sense, and is what happens when you use "1" as the old
(input) unit when converting a plain number to alphas.  The problem with
using "1" as a new (output) unit is that to be consistent with how it
treats other units, choosing an output unit of "1" should be a no-op.  
Going back to converting 45 mi/hr with new units "km", what currently
happens is that (mi/hr)/km is converted to 1.609344 / hr, so the result
of the entire conversion will be 45*(1.609344 / hr)*km.  If instead the
new units are "1", then all that will happen is the expression on the
stack will be divided by 1 and multiplied by 1.  It doesn't seem to me
that the dimensionless unit "1" should be handled differently than other
units.  (Granted, currently an output unit of 1 does give an error, but
since it would be a no-op I doubt the user intended to give it anyhow.)

> Then plain numbers can be converted to alphas without problem. If,
> on the other hand, one wanted to convert a plain number to some
> "dimensional unit" like "m", the concept of partial conversion
> implies that the expression remains unchanged because we would get
> something like "m / m". Note that conversion of "7 alpha" to "m"
> already gives the dimensionless number 0.051.

Right.  That's how it currently works, and plain numbers can be
converted to alphas.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]