emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Manuel Schneckenreither <manuel.schnecki@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Table formula references
Date: Thu, 30 Mar 2017 10:38:20 +0200	[thread overview]
Message-ID: <8760irgnwj.fsf@uibk.ac.at> (raw)

Hi,

I'd like to use following formula on like this:

  | t | y_t | y_{t+1} |
  |---+-----+---------|
  | 1 | 115 |         |
  | 2 | 121 |         |
  | 3 | 118 |         |
  | 4 | 127 |         |

  $4 = \sum_{\tau=0}^{@#-2}{0.9^{\tau} * y_{@#-2-\tau}}
  

So that's a simple sum, which just iterates over the values and uses the
index for power and to get the value of y_{4-\tau}. So @5$3 should be
0.9^0*127 + 0.9^1*118 + 0.9^2*121 + 0.9^3*115. Shouldn't be too hard I
though, but I couldn't figure it out how to implement it using
org-spreadsheets.

As I need the index I tried using subscr with no success. I can
obviously generate the list of rows used for the calculation using
@2$1..@2$#. However, as soon as I use an elsip function in the formula I
struggle with the representation of the list:

#+TBLFM: $3='(mapcar '1+ (@2$1..@2$#))

shows following debug output:

   Substitution history of formula
   Orig:   '(mapcar '1+ (@2$1..@2$3))
   $xyz->  '(mapcar '1+ (@2$1..@2$3))
   @r$c->  '(mapcar '1+ (#("1" 0 1 (fontified t line-prefix #("******* " 0 7 (face org-indent)) wrap-prefix #("******* " 0 8 (face org-indent)) face org-table)) #("115" 0 3 (fontified t line-prefix #("******* " 0 7 (face org-indent)) wrap-prefix #("******* " 0 8 (face org-indent)) face org-table))))
   $1->    '(mapcar '1+ (#("1" 0 1 (fontified t line-prefix #("******* " 0 7 (face org-indent)) wrap-prefix #("******* " 0 8 (face org-indent)) face org-table)) #("115" 0 3 (fontified t line-prefix #("******* " 0 7 (face org-indent)) wrap-prefix #("******* " 0 8 (face org-indent)) face org-table))))
   Result: #ERROR
   Format: NONE
   Final:  #ERROR

Is there a simple way to do it? Do I need to go over elsip functions,
and if so. How can I properly use a list?

I couldn't find a way on the web.


Best regards

Manuel

             reply	other threads:[~2017-03-30  8:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30  8:38 Manuel Schneckenreither [this message]
2017-04-02 17:11 ` Table formula references Michael Brand
2017-04-02 17:31   ` Manuel Schneckenreither
     [not found] <70b5bcd88f86475cbce6f0a5b1cde9c9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-03-30 16:15 ` Eric S Fraga
  -- strict thread matches above, loose matches on Subject: below --
2017-03-30  8:37 Manuel Schneckenreither

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=8760irgnwj.fsf@uibk.ac.at \
    --to=manuel.schnecki@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 public 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).