emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Yet another literate programming application
Date: Mon, 29 Jul 2013 18:30:54 +0200	[thread overview]
Message-ID: <m2r4ehtjk1.fsf@polytechnique.org> (raw)
In-Reply-To: <87k3k9o3vu.fsf@gmail.com>

schulte.eric@gmail.com writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Or rather, I should say a literate algebra and calculating application:
>> http://calca.io/
>>
>
> If this is appealing, it may be worth checking out the "Embedded Mode"
> of Emacs calc [1].  From what I can tell on the calc.io website, Emacs
> calc provides the same functionality, but Emacs calc has the benefits of
> (1) it is open source meaning you can confirm calculations and your
> answers (in my opinion a must for any peer reviewed publication), and
> (2) it may be embedded in *any* type of file.

Embedded calc mode is amazing, thanks for the link! It does not seem as
intuitive to work with equations (I've tried doing the Functions and
Solving Equations examples in calc), and there are funny results with
spaces in names. If someone knows how to do the even/odd example in
calc, please let me know. Here is what I got so far:

* Variables

#+BEGIN_SRC calc

m := 42

b := 1000

m x + b => 42 x + 1000

mass of earth := 5.972e24 kg

mass of moon := 7.34767309e22 kg

mass of earth / (mass of moon) => earth / moon

#+END_SRC

* Functions

#+BEGIN_SRC calc

eq := f = 1.8 c + 32

ceq := solve(eq, c) => c = f / 1.8 - 17.7777777778

subst(eq, c, 20) => f = 68.

subst(ceq, f, 100) => c = 37.7777777778

even(n) := n = 0 ? true : odd(n - 1)

odd(n) := n = 1 ? true : even(n - 1)

#+END_SRC

Thanks again for pointing me to how great calc can be,

Alan

  reply	other threads:[~2013-07-29 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 12:56 Yet another literate programming application Alan Schmitt
2013-07-29 14:08 ` Eric Schulte
2013-07-29 16:30   ` Alan Schmitt [this message]
2013-07-29 16:57     ` Eric Schulte
2013-07-29 18:00       ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r4ehtjk1.fsf@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).