[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LIterate programming with calc (help)
From: |
Fraga, Eric |
Subject: |
Re: LIterate programming with calc (help) |
Date: |
Mon, 24 Oct 2022 07:56:58 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Sunday, 23 Oct 2022 at 14:15, Ypo wrote:
> Is it possible to express in a calc block some basic operations with
> variables and non-predefined units?
> Why A*c won't show an arithmetic result, but ~: A c ~?
I've never managed to get calc blocks define variables. The equations
you have typed in are "equations" in the mathematical sense, not
assignment statements.
> Is it possible to work with the "$" unit?
$ means something specific in calc (cannot remember what). I use "USD"
instead, for instance, and it works fine.
The following single line calc block does do what you want:
#+begin_src calc
solve([a = 300 m, b = 300 m, Area = a*b, cost = 1 (USD/m^2), z = Area*cost],
[a, b, Area, cost, z])
#+end_src
#+results:
: [a = 300 m, b = 300 m, Area = 90000 m^2, cost = USD / m^2, z = 90000 USD]
--
: Eric S Fraga, with org release_9.5.5-966-g88c85d in Emacs 29.0.50