emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Yet another literate programming application


From: Alan Schmitt
Subject: Re: [O] Yet another literate programming application
Date: Mon, 29 Jul 2013 18:30:54 +0200
User-agent: mu4e 0.9.9.5; emacs 24.3.1

address@hidden writes:

> Alan Schmitt <address@hidden> 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 via email to

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