emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to combine Lisp style and Calc style Table Formula together?
@ 2018-04-09  2:42 stardiviner
  2018-04-09 16:46 ` Thierry Banel
  0 siblings, 1 reply; 3+ messages in thread
From: stardiviner @ 2018-04-09  2:42 UTC (permalink / raw)
  To: org-mode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to combine Lisp style and Calc style Table Formula together?
  2018-04-09  2:42 How to combine Lisp style and Calc style Table Formula together? stardiviner
@ 2018-04-09 16:46 ` Thierry Banel
  2018-04-10  0:35   ` [SOLVED] " stardiviner
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Banel @ 2018-04-09 16:46 UTC (permalink / raw)
  To: emacs-orgmode

Try this:
$2=$1;%1.1e

Le 09/04/2018 04:42, stardiviner a écrit :
> -----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-----
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [SOLVED] Re: How to combine Lisp style and Calc style Table Formula together?
  2018-04-09 16:46 ` Thierry Banel
@ 2018-04-10  0:35   ` stardiviner
  0 siblings, 0 replies; 3+ messages in thread
From: stardiviner @ 2018-04-10  0:35 UTC (permalink / raw)
  To: Thierry Banel; +Cc: emacs-orgmode

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


Thierry Banel <tbanelwebmin@free.fr> writes:

> Try this:
> $2=$1;%1.1e
>

Thanks, this is really great.

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

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrMBt8ACgkQG13xyVro
msPjqwf/Xh1KCCGHOUeNVcZuxHyVDOXNpdQJc5CQxfhlhU5Tvbw+fMKOFyONpjqW
kQxl5cIIpiK2ApQCGI1HKh64iZtFH2A1yJfuLfsUq5lGNn6StaaJ+2R3fEsU3xcZ
3ktrEAAA1MsgGmK7idrrBoP6zYFzXCCcZvC5zPJBTzGeu4i/BRt61Kss56n7aMda
PJM8S3Zu9imUzejmS8jnW9PNDu9JuGOnoOnzBDwdlxTSWD7CPDY1TzCxPmCmK2Uk
AzjaH6a3K294T25Jv8TFcY2pHXKtOgdwAQSMOzntrtj4Epk5eZ54dlOdj6hhiLDw
m00QC4ojvInuP2r0p6v7MtnsHw2AjQ==
=tP9F
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-10  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09  2:42 How to combine Lisp style and Calc style Table Formula together? stardiviner
2018-04-09 16:46 ` Thierry Banel
2018-04-10  0:35   ` [SOLVED] " stardiviner

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