all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Roland Winkler" <winkler@gnu.org>
To: jay.p.belanger@gmail.com
Cc: 10554@debbugs.gnu.org
Subject: bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc)
Date: Fri, 20 Jan 2012 02:34:26 -0600	[thread overview]
Message-ID: <20249.10002.733142.491623@gargle.gargle.HOWL> (raw)
In-Reply-To: <87d3afdlfz.fsf@gmail.com>

On Thu Jan 19 2012 Jay Belanger wrote:
> >>From a different perspective, I'd say that "dimensionless" is as
> > valid a unit as "kg" or "hbar / c". In that sense I'd say that there
> > should be a possibility to pass this unit "dimensionless" as an arg
> > to calc-convert-units, similar to any other unit that this function
> > should use for its final result.
> 
> Currently, if Calc is asked to convert part of a units expression, it
> will leave any unrequested units unchanged; for example, if 45 mi/hr is
> on the stack and the units conversion is called with new units m, then
> only the mi will be changed; 45 mi/hr will be converted to 72420.48 m /
> hr.  To be consistent, I would think that converting to new units 1, all
> of the units in the stack expression would be left alone.

...This might depend on whom you ask  :-)
I am speaking from a physics point of view. Other people might look
at this from a different perspective.

I would always consider the concept of "converting part of a units
expression" to be not the main rule to follow here, 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. On the other hand, if an expression can be
converted to a dimensionless number, this involves no ambiguity.
Also, I'd say that in real life one usually knows which unit an
expression has.

> > I'd say that "1" appears to be a natural choice in order to express
> > the fact that Calc should obtain a dimensionless number.
> 
> 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. I would consider this branch the last resort. If Calc
discovers earlier that an expression can be interpreted as
a dimensionless number, it should do that conversion if the user
requested the unit "1".

I just discovered what I would likewise consider an inconsistency in
the current handling of 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. However, the result of a calculation should, of course, be
independent of whether the intermediate simplification is done or
not.

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.
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.

(Alternatively, such a partial conversion could explicitly give the
unit "m / m", similar to when we have "3 m" and "4 m", and we divide
one by the other, then Calc does not simplify that automatically,
but instead we get "0.75 m / m". But such a strategy would become
rather confusing if we converted to more complicated units like
"kg m^2 / s" thus giving "kg m^2 s / s m^2 kg".)

I am confident that most physicists will agree on this.

Roland





  reply	other threads:[~2012-01-20  8:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-19  5:24 bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc) Roland Winkler
2012-01-19 21:45 ` Jay Belanger
2012-01-19 22:33   ` Roland Winkler
2012-01-20  4:53     ` Jay Belanger
2012-01-20  8:34       ` Roland Winkler [this message]
2012-01-20 16:48         ` Jay Belanger
2012-01-20 17:55           ` Roland Winkler
2012-01-20 19:10             ` Jay Belanger
2012-01-20 20:30               ` Roland Winkler
2012-01-20 20:54                 ` Jay Belanger
2012-01-20 22:10                   ` Roland Winkler
2012-01-21  0:00                     ` Jay Belanger
2012-01-21  9:24                       ` Roland Winkler
2012-01-21 14:45                         ` Jay Belanger
2012-01-21 15:12                           ` Roland Winkler
2012-01-21 15:28                             ` Jay Belanger
2012-01-21 15:42                         ` Jay Belanger
2012-01-21 16:03                           ` Roland Winkler
2012-01-20 20:36               ` Roland Winkler
2012-01-21  4:21 ` Jay Belanger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20249.10002.733142.491623@gargle.gargle.HOWL \
    --to=winkler@gnu.org \
    --cc=10554@debbugs.gnu.org \
    --cc=jay.p.belanger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.