all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa
@ 2013-05-15  3:31 Sharad Shrestha
  2013-05-15 13:26 ` Jay Belanger
  0 siblings, 1 reply; 4+ messages in thread
From: Sharad Shrestha @ 2013-05-15  3:31 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

In GNU Emacs (v24.3.1) Calc embedded mode, I'd like to perform unit simplification such that (5 N / 2 m^2) gives the result 2.5 Pa (where 1 Pa = 1 N/m^2). But I am unable to get the unit N/m^2 converted to Pa. I have the following entries before unit simplification:

\begin{equation}    
%%% a := 5 * N %%%
a \gets 5 N
\end{equation}

\begin{equation}
%%% b := 2 * m^2 %%%
b \gets 2 m^2
\end{equation}

\begin{equation}
%%% c := a / b => 2.5 * N / m^2 %%%
\evalto c \gets \frac{a}{b} \to \frac{2.50 N}{m^2}
\end{equation}

The value of "c" I am expecting after unit simplification is:

\begin{equation}
%%% c := a / b => 2.5 * Pa %%%
\evalto c \gets \frac{a}{b} \to 2.50 Pa
\end{equation}

My "Units Table" contains the following entry:

Unit    Type  Definition                  Description

 Pa       U   \frac{N}{m^2}               Pascal

Thank you for your help.

Regards,
Sharad


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa
  2013-05-15  3:31 In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa Sharad Shrestha
@ 2013-05-15 13:26 ` Jay Belanger
  2013-05-17  2:10   ` Sharad Shrestha
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Belanger @ 2013-05-15 13:26 UTC (permalink / raw)
  To: help-gnu-emacs


> In GNU Emacs (v24.3.1) Calc embedded mode, I'd like to perform unit
> simplification such that (5 N / 2 m^2) gives the result 2.5 Pa (where
> 1 Pa = 1 N/m^2). But I am unable to get the unit N/m^2 converted to
> Pa.

Calc units simplification (u s) typically doesn't combine units that
way, you'll need to use units conversion (u c) and tell Calc you want
Pa. 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa
  2013-05-15 13:26 ` Jay Belanger
@ 2013-05-17  2:10   ` Sharad Shrestha
  2013-05-17  2:49     ` Jay Belanger
  0 siblings, 1 reply; 4+ messages in thread
From: Sharad Shrestha @ 2013-05-17  2:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, May 15, 2013 6:26:27 AM UTC-7, Jay Belanger wrote:
> > In GNU Emacs (v24.3.1) Calc embedded mode, I'd like to perform unit
> 
> > simplification such that (5 N / 2 m^2) gives the result 2.5 Pa (where
> 
> > 1 Pa = 1 N/m^2). But I am unable to get the unit N/m^2 converted to
> 
> > Pa.
> 
> 
> 
> Calc units simplification (u s) typically doesn't combine units that
> 
> way, you'll need to use units conversion (u c) and tell Calc you want
> 
> Pa.

For a static assignment such as shown below, I can easily change units (in both directions) between N/m^2 and Pa by using the units conversion command (u c):

\begin{equation}
%%% dd1 := 8 * N / m^2 %%%
dd1 \gets \frac{8 N}{m^2}
\end{equation}

This type of units conversion works even when I include the Evaluates-To operator (=>):

\begin{equation}
%%% ee1 := 6 * N / m^2 => 6 * N / m^2 %%%
\evalto ee1 \gets \frac{6 N}{m^2} \to \frac{6 N}{m^2}
\end{equation}

 However, what I am trying to do is create a "live" calculation sheet such as shown below:

\begin{equation}
%%% aa1 := 10 * N %%%
aa1 \gets 10 N
\end{equation}

\begin{equation}
%%% bb1 := 2 * m^2 %%%
bb1 \gets 2 m^2
\end{equation}

\begin{equation}
%%% cc1 := aa1 / bb1 => 5 * N / m^2 %%%
\evalto cc1 \gets \frac{aa1}{bb1} \to \frac{5 N}{m^2}
\end{equation}

I can change the values assigned to aa1 and bb1, and the value of cc1 is updated automatically.  However, the units conversion command (u c) has not have any effect when I try to convert the units of cc1 (fron N/m^2 to Pa).  Is there a way to perform this unit conversion?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa
  2013-05-17  2:10   ` Sharad Shrestha
@ 2013-05-17  2:49     ` Jay Belanger
  0 siblings, 0 replies; 4+ messages in thread
From: Jay Belanger @ 2013-05-17  2:49 UTC (permalink / raw)
  To: help-gnu-emacs


Sharad Shrestha <sharad.shrestha@gmail.com> writes:
...
> \begin{equation}
> %%% aa1 := 10 * N %%%
> aa1 \gets 10 N
> \end{equation}
>
> \begin{equation}
> %%% bb1 := 2 * m^2 %%%
> bb1 \gets 2 m^2
> \end{equation}
>
> \begin{equation}
> %%% cc1 := aa1 / bb1 => 5 * N / m^2 %%%
> \evalto cc1 \gets \frac{aa1}{bb1} \to \frac{5 N}{m^2}
> \end{equation}
>
> I can change the values assigned to aa1 and bb1, and the value of cc1
> is updated automatically.  However, the units conversion command (u c)
> has not have any effect when I try to convert the units of cc1 (fron
> N/m^2 to Pa).

Right, because cc1 is recalculated using aa1 and bb1.

> Is there a way to perform this unit conversion?

Not really.
You can fake it, to some extent, by putting the units conversion in
yourself:

uc := Pa / (N / m^2)

aa1 := 10 N

bb1 := 2 m^2

cc1 := uc aa1 / bb1 => 5 Pa

Alternatively, an algebraic units conversion function could be created,
and you could do something like

aa1 := 10 N

bb1 := 2 m^2

cc1 := uconv(aa1 / bb1, N/m^2, Pa) => 5 Pa

but I'm not sure either one is what you want.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-17  2:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15  3:31 In GNU Emacs Calc embedded mode, how to simplify unit N/m^2 to Pa Sharad Shrestha
2013-05-15 13:26 ` Jay Belanger
2013-05-17  2:10   ` Sharad Shrestha
2013-05-17  2:49     ` Jay Belanger

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.