emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Maxima persistence between code blocks
@ 2011-04-27 18:08 Derek Thomas
  2011-04-28 10:56 ` Eric S Fraga
  0 siblings, 1 reply; 2+ messages in thread
From: Derek Thomas @ 2011-04-27 18:08 UTC (permalink / raw)
  To: emacs-orgmode

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?  If so, this seems like a severe limitation.  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,

Derek

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

* Re: Maxima persistence between code blocks
  2011-04-27 18:08 Maxima persistence between code blocks Derek Thomas
@ 2011-04-28 10:56 ` Eric S Fraga
  0 siblings, 0 replies; 2+ messages in thread
From: Eric S Fraga @ 2011-04-28 10:56 UTC (permalink / raw)
  To: Derek Thomas; +Cc: emacs-orgmode

Derek Thomas <derekcthomas@gmail.com> 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)

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

end of thread, other threads:[~2011-04-28 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 18:08 Maxima persistence between code blocks Derek Thomas
2011-04-28 10:56 ` Eric S Fraga

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