0

Is there a formula to compute the natural logarithm of a number in Org-Mode spreadsheet? For example, to compute ln(1), Excel or Calc formula is =ln(1), what would it be in Org-Mode?

The result should be 0 as ln(1)=0.

1
  • @NickD thanks for correcting the typo.
    – crocefisso
    Feb 20 at 23:52
1

You can either use the calc syntax or the elisp syntax.

| x | calc syntax | elisp syntax |
|---+-------------+--------------|
| 1 |           0 |       0.0000 |
| 2 |      0.6931 |       0.6931 |
#+TBLFM: $2=log($1);n4::$3='(log $1);N%.4f

Notice that the output format of the calc syntax depends on the ~/.emacs.d/calc.el parameters.

(plist-put org-calc-default-modes 'calc-language 'latex)
(plist-put org-calc-default-modes  'calc-symbolic-mode t)

| x | calc syntax | elisp syntax |   |
|---+-------------+--------------+---|
| 1 | 0           |       0.0000 |   |
| 2 | \ln{2}      |       0.6931 |   |
#+TBLFM: $2=log($1);n4::$3='(log $1);N%.4f
0

Well, actually =ln(1) works in org-table, I just tested it. I didn't know because I didn't find it in the documentation...

3
  • 1
    Did you check the Calc documentation? C-h i g (calc) Log TAB
    – NickD
    Feb 20 at 14:23
  • When I mentioned calc in the question I was thinking about libre office Calc. Now thanks to you I just discovered The GNU Emacs Calculator. Thank you!
    – crocefisso
    Feb 21 at 0:01
  • I hope you have a lot of fun with it! The Org mode spreadsheet uses calc underneath the covers, so in addition to the calc docs, you should read the Org mode spreadsheet docs as well.
    – NickD
    Feb 21 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.