emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] How to combine Lisp style and Calc style Table Formula together?


From: stardiviner
Subject: [O] How to combine Lisp style and Calc style Table Formula together?
Date: Mon, 09 Apr 2018 10:42:41 +0800
User-agent: mu4e 1.0; emacs 27.0.50

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I try to display table columns value like 10000 with format "1.0e+4". So I use 
function (format "%1.1e" $1).

Here is my org table:

|    n | Algorithm A (n) | Algorithm B (4n + 8) | Algorithm C (n^{2}) | 
Algorithm D (2n^{2}+1) | Algorithm E (2n^{2}+3n+1) | Algorithm F (n^{3}) |
|------+-----------------+----------------------+------------------+---------------------+------------------------+------------------|
|    1 |         1.0e+00 |              1.2e+01 |                1 |            
       3 |                      6 |                1 |
|    2 |         2.0e+00 |              1.6e+01 |                4 |            
       9 |                     15 |                8 |
|    3 |         3.0e+00 |              2.0e+01 |                9 |            
      19 |                     28 |               27 |
|   10 |         1.0e+01 |              4.8e+01 |              100 |            
     201 |                    231 |             1000 |
|  100 |         1.0e+02 |              4.1e+02 |            10000 |            
   20001 |                  20301 |          1000000 |
| 1000 |         1.0e+03 |              4.0e+03 |          1000000 |            
 2000001 |                2003001 |       1000000000 |
#+TBLFM: $2='(format "%1.1e" (string-to-number $1))::$3='(format "%1.1e" (+ (* 
(string-to-number $1) 4) 
8))::$4=$1*$1::$5=2*($1*$1)+1::$6=2*($1*$1)+3*$1+1::$7=$1*$1*$1

I want to apply $2 formula to all of resting columns.
Org info only has Calc and Lisp style. But don't have how to combine them 
together.

I don't know what's the (format "%1.1e" ..) function corresponding operator 
under Calc.

- -- 
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrK0yEACgkQG13xyVro
msOs3Qf9GFFmhQ2N5ZERpGhfqLaqphD62oCz1cjP4MzYQ9GaXyFkPrZkysflU5GL
iXGNK7fjVJP4mi8yCY4P5IdIcKALaZphiRDoQ1H8ItuLomryc2ZXEIaMs1PV/yri
6iriNmgbcNC6CDKGyEo2magg/Ii1jZkS+w+Q2Lh+s0jxBNfW1TnwlZ7VAj6Sn7pg
fLj9osAJAIOMEZnKsR5ZInxZFHSliYRfeATAC/0m7tE1zAYwwY0OfCRAM31CP5b3
d5peQysyoUh12sZfavWkc+tDnD9cKj0f7lyGVKz9c2swgm81pVTrDfNQsD0flutE
j+qRwNwkV5qdgCmWEj/4ocnBPulPGQ==
=mzOu
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]