emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Gilles Charron <gilles.charron@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Interaction between org tables and embedded calc
Date: Thu, 23 Aug 2012 10:45:46 -0600	[thread overview]
Message-ID: <87sjbd4kw5.fsf@gmx.com> (raw)
In-Reply-To: <loom.20120821T144735-273@post.gmane.org> (Gilles Charron's message of "Tue, 21 Aug 2012 13:21:41 +0000 (UTC)")

Gilles Charron <gilles.charron@gmail.com> writes:

> Hi,
>
>   I recently discovered the beauty of emacs embedded calc.  Works great inside
> org files for note taking with math & engineering related content.   
>
> I've been trying to get org tables and embedded calc to coordinate with each
> other using assigned variables however it appears that embedded calc uses some
> sort of namespace for storing variables.  Below is a sample of what I'm trying
> to do:
>
> Let's say I need to calculate something - I'll assign it to an embedded calc
> variable:
>
> myVariable := 1 + 0.5 =>  1.5
>
> Now, embedded calc knows about "myVariable" .  Next I would like to use this
> variable inside a org table (like offset all elements in a column with
> "myVariable"):
>
> | Data | Corrected Data (-myVariable) |
> | 0    | should yield -1.5            |
> | 1    | should yield -0.5            |
> | 2    | should yield  0.5            |
>
> I've been trying to use calc-eval along with evalv however they don't appear to
> resolve "myVariable".   
>
> Reading though the embedded calc documentation:
>
>
> "The assignment operator `a := 17' does not actually do anything by itself. But
> Embedded Mode recognizes it and marks it as a sort of file-local definition of
> the variable."
>
> How can I access these "file-local definitions" through "calc-eval" or org
> tables?  Essentially, I'm looking for an equivalent of org properties
> "$PROP_propertyName" which can be accessed in org tables.  
>

This is an interesting question but to the extent that you're asking how
to resolve an embedded calc variable from general calc execution I think
this is more of a calc than an Org-mode question, and should be sent to
the calc mailing list.

>
> I would also like the ability to read from an org table and use the
> content later in a embedded math equation:
>
> | Data |
> |------|
> | 1    |
> | 2    |
> | 3    |
> |------|
> | 6    |
> #+TBLFM: @5$1=vsum(@I..II)
>
> Would like to read the results (6) and use it in a equation:
>
> MoreProcessing := $result + 1.234
>
> How would one go about doing this?
>

Assuming you know the syntax to specify vectors in embedded calc, you
could use a code block to read the table from Org-mode and output the
calc vector syntax into your document.

Best,

>
>
> Thanks!
> Gilles
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

      reply	other threads:[~2012-08-23 17:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21 13:21 Gilles Charron
2012-08-23 16:45 ` Eric Schulte [this message]

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87sjbd4kw5.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gilles.charron@gmail.com \
    --subject='Re: Interaction between org tables and embedded calc' \
    /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

Code repositories for project(s) associated with this inbox:

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).