emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Maxima persistence between code blocks


From: Eric S Fraga
Subject: Re: [O] Maxima persistence between code blocks
Date: Thu, 28 Apr 2011 11:56:39 +0100
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

Derek Thomas <address@hidden> writes:

> I'm interested in using org-mode with babel to organize my maxima
> code.  Am I correct in my reading of ob-maxima.el that the babel
> module for maxima doesn't support persistent variables between code
> blocks?  

Correct, basically.

> If so, this seems like a severe limitation.

There are solutions (see below), but their suitability will depend on
*your* use case.  What specifically can you not do currently that you
would like to do (or do more easily)?

> I did some
> searching and found this guide
> (http://www.math.utexas.edu/pipermail/maxima/2010/021027.html) for
> setting up a local maxima "server".  
>
> I'm trying to implement an org
> interface to this process, but my elisp skills are extremely
> rudimentary.  If anyone has any suggestions or recommendations for
> code that does something similar, that would be great.  Thanks,

For org + babel, the more appropriate solution might be to add session
support for maxima.  In principle, this should be possible as one can
have a maxima inferior process; there is no need to re-invent the wheel
as described above basically.  However, I am not sure how to go about
doing this.  I'll investigate when I have some time (but am not
promising anything soon unfortunately) but maybe you could have a look.
Check out other babel languages that provide session support (R?).

In the meantime, there are two alternatives, which I use all the time,
which may help: code tangling =(info "(org) Extracting source code")=
and noweb =(info "(org) Noweb reference syntax")=.  I use the latter
frequently:

--8<---------------cut here---------------start------------->8---

#+srcname: units
#+begin_src maxima
h: 3600*s$
day: 24*h$
#+end_src

#+srcname: unitstest
#+begin_src maxima :results output :exports results :noweb yes
<<units>>
solution: solve([m = 2*day], [m]),numer$
print(solution);
#+end_src

#+results: unitstest
: [m = 172800 s] 

--8<---------------cut here---------------end--------------->8---

Note the =<<units>>= reference in the latter code block.

HTH,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



reply via email to

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