[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Variable table length
From: |
Nick Dokos |
Subject: |
Re: [O] Variable table length |
Date: |
Mon, 03 Jun 2013 15:15:14 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Marcin Borkowski <address@hidden> writes:
> Dnia 2013-06-03, o godz. 16:32:20
> Michael Brand <address@hidden> napisaĆ(a):
>
>> Hi Marcin
>>
>> On Mon, Jun 3, 2013 at 3:38 PM, Michael Brand
>> <address@hidden> wrote:
>> > I would use one row per payback and manually add/remove rows until
>> > the last row is the only one with a different sign for the floating
>> > loan.
>>
>> Forgot to mention that if you don't need all the intermediate steps
>> per payback rate then you can of course simply use the annuity
>> functions from Emacs Calc:
>> (info "(calc) Related Financial Functions")
>> or
>> http://www.gnu.org/software/emacs/manual/html_node/calc/Related-Financial-Functions.html
>
> Thanks, I am aware of that - but what I want is actually a table (I'm
> teaching an introductory course in financial mathematics).
>
Use babel perhaps? Not sure what your inputs are and what your table
should look like but you could use something like this to produce a
skeleton table of the right length and a set of column formulas (nb:
fake ones used below), then C-C C-c on the #+tblfm: line to calculate
the rest of the table:
--8<---------------cut here---------------start------------->8---
#+begin_src sh :results raw :var n=20
echo "#+name: amorttable"
echo "|month | interest | principal | balance |"
for i in $(seq 1 $n)
do
echo "| $i ||||"
done
echo '#+tblfm: $2 = 2 * $1 :: $3 = 3 * $1 :: $4 = 4 * $1'
#+end_src
--8<---------------cut here---------------end--------------->8---
--
Nick