emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: How to do a sum of products in a table?
Date: Fri, 14 Jun 2013 17:13:24 +0200	[thread overview]
Message-ID: <87mwqs7mjv.fsf@pank.home> (raw)
In-Reply-To: m2d2ron5r1.fsf@polytechnique.org


Hi Alan,

> I'm grading an exam, and I'm trying to use org instead of Numbers to
> tabulate the results. For each student, I'll input how well he answered
> to the question, and his grade will be (sum of mark * coefficient),
> where each question has a different coefficient (in Numbers I was using
> the SUMPRODUCT function).
>
> Is there a way to do this in org mode?

Sure, but please provide an example.  E.g. is each student a column?
Or is the dotproduct of two vectors where mark is just one

Here's a prtty simple example

|   | nr. | score     | score |
|---+-----+-----------+-------|
| # |   1 | [1, 2, 3] |   4.2 |
| # |   2 | [3, 4, 5] |   7.8 |
#+TBLFM: $4=$3*[.3, .6, .9]

It would probably be nicer to have the weighting matrix externally
defined.  Perhaps you can use #+CONSTANTS or the remote function.  If
you prefer you can also let each

A more advance example is given in the manual:

  http://orgmode.org/org.html#Advanced-features

     |---+---------+--------+--------+--------+-------+------|
     |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
     |---+---------+--------+--------+--------+-------+------|
     | ! |         |     P1 |     P2 |     P3 |   Tot |      |
     | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
     | ^ |         |     m1 |     m2 |     m3 |    mt |      |
     |---+---------+--------+--------+--------+-------+------|
     | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
     | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
     |---+---------+--------+--------+--------+-------+------|
     |   | Average |        |        |        |  25.0 |      |
     | ^ |         |        |        |        |    at |      |
     | $ | max=50  |        |        |        |       |      |
     |---+---------+--------+--------+--------+-------+------|
     #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f

Refer to

  http://orgmode.org/org.html#The-spreadsheet

–Rasmus

-- 
Hooray!

  reply	other threads:[~2013-06-14 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14 14:09 How to do a sum of products in a table? Alan Schmitt
2013-06-14 15:13 ` Rasmus [this message]
2013-06-14 16:49   ` Alan Schmitt
2013-06-14 17:34     ` Rasmus
2013-06-14 18:53       ` Alan Schmitt

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=87mwqs7mjv.fsf@pank.home \
    --to=rasmus@gmx.us \
    --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).