# How to compute ln in Org-Mode spreadsheet

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.

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

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


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...

• Did you check the Calc documentation? C-h i g (calc) Log TAB 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! 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. Feb 21 at 2:27