emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Evan Misshula <evanmisshula@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Gary Oberbrunner <garyo@oberbrunner.com>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Fwd: run python from org, draft
Date: Fri, 29 Mar 2013 14:33:37 -0400	[thread overview]
Message-ID: <CAPV3Zjz7WkwNBVeSr5S82cXFGyQm_6AyzsnO2OKLbL=3OjHnmw@mail.gmail.com> (raw)
In-Reply-To: <871uayrvju.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3116 bytes --]

Org-mode version 8.0-pre (release_8.0-pre-203-g993e3e @
/home/evan/Documents/org/elisp/org-mode/lisp/)
GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of
2013-03-21 on evan-Dell-System-Inspiron-N7110 [2 times]

I installed the patched version.  It does hold session definition:

#+name: second-deriv-function
#+begin_src python :session  :results output :exports code
  def diff2(f, x, h=1E-6):
        """Function that takes the second derivative"""
        r=(f(x-h)-2*f(x)+f(x+h))/float(h*h)
        return r

#+end_src
#+RESULTS: second-deriv-function

Now let's write a target function, say $g(t)=t^{-6}$:
#+name: target-funtion
#+begin_src python :session :results output :exports code
  def g(t):
      """well behaved target function"""
      return t**(-6)

#+end_src

#+RESULTS: target-funtion

Now let's define the second derivative and evaluate it at $t=1.2$

#+name: evaluating-the-target
#+begin_src python :session  :results output :exports both
  t=1.2
  d2g = diff2(g,t)
  print "g''(%f)=%f" % (t, d2g)
#+end_src

#+RESULTS: evaluating-the-target
:
: >>> g''(1.200000)=9.767798

But it does not appear to support named session:

Works with a named session.
#+begin_src python :session foo
  x = 9
  x
#+end_src

#+RESULTS:
: None

#+begin_src python :session foo
  x
#+end_src

#+RESULTS:

Thanks,

Evan



On Fri, Mar 29, 2013 at 12:59 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
> > Am 29.03.2013 17:20, schrieb Eric Schulte:
> >
> >> A valid opinion, in fact I think I defended that point of view myself,
> >
> > Hi Eric,
> >
> > so, if I'm saying: let's make things considerably easier, working right
> from the spot,
> > why not try that?
> >
> > What I need still is a specification, what :session and the other header
> arguments shall do.
> > Presently they do quite different things. Also can't read a bulk of
> mails to figure out some guessing.
> >
> > Please write a specification and with the help of the other guys let's
> have some tiny and
> > effective ob-python.
> >
>
> Sorry, I'm not going to do this work for you.  If you want to take a
> shot at re-working ob-python, then you're welcome to.  However, I would
> recommend first reading through some of the history which lead to its
> current state, and fully understanding what that current state is (which
> at a minimum means reading and digesting the relevant documentation).
>
> > Let's see of we need more lines than ob-emacs-lisp.el :)
> >
>
> You will. :)
>
> Best of luck,
>
> >
> > Cheers
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>
>


-- 
Evan Misshula
Doctoral Student (Criminal Justice)
CUNY John Jay
"Let us reform our schools, and we shall find little reform needed in our
prisons."
       John Ruskin, Unto This Last, essay 2 (1862)
       English critic, essayist, & reformer (1819 - 1900)

"Instruction does much, but encouragement does everything." Johann Wolfgang
Von Goethe
www.snrg-nyc.org

[-- Attachment #2: Type: text/html, Size: 4174 bytes --]

  reply	other threads:[~2013-03-29 18:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 21:55 run python from org, draft Andreas Röhler
     [not found] ` <CAFChFyjZyxcnH1_jSWEUgXNkvJ0c3F8f4ojQa_EtPov2TjtziQ@mail.gmail.com>
2013-03-29 12:11   ` Fwd: " Gary Oberbrunner
2013-03-29 14:47     ` Andreas Röhler
2013-03-29 14:57       ` John Hendy
2013-03-29 15:09         ` Eric Schulte
2013-03-29 15:29           ` Andreas Röhler
2013-03-29 16:20             ` Eric Schulte
2013-03-29 16:49               ` Andreas Röhler
2013-03-29 16:59                 ` Eric Schulte
2013-03-29 18:33                   ` Evan Misshula [this message]
2013-03-29 18:50                     ` Eric Schulte
2013-03-29 19:04                       ` Evan Misshula
     [not found]             ` <CAFChFyhRbz6hh-NyOZTfdKJcTPh=F3J=07k2fR9p+A9Wig_pRA@mail.gmail.com>
2013-03-29 20:10               ` Fwd: " Gary Oberbrunner
2013-03-29 20:58                 ` Andreas Röhler
2013-03-31 20:04                   ` Gary Oberbrunner
2013-03-29 15:35           ` John Hendy
     [not found]             ` <CAFChFyhOrPVS2E5CE9H2+zX5TFV4D-themQbjx2DaSx-WmG14g@mail.gmail.com>
2013-03-29 20:11               ` Fwd: " Gary Oberbrunner
2013-03-29 15:50           ` John Hendy
2013-03-29 16:23             ` Eric Schulte
2013-03-29 16:47               ` Eric Schulte
2013-03-29 19:06                 ` Andreas Röhler
2013-03-29 20:04                 ` Andreas Röhler
2013-03-29 19:59           ` Gary Oberbrunner
2013-03-29 20:15             ` Andreas Röhler
2013-03-29 20:25             ` Eric Schulte
2013-03-29 20:45               ` Gary Oberbrunner
2013-03-29 21:13                 ` Eric Schulte

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='CAPV3Zjz7WkwNBVeSr5S82cXFGyQm_6AyzsnO2OKLbL=3OjHnmw@mail.gmail.com' \
    --to=evanmisshula@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=garyo@oberbrunner.com \
    --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).