#6781: Library access to ecl
-------------------------+--------------------------------------------------
Reporter: nbruin | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-feature
Component: symbolics | Keywords:
Reviewer: | Author:
Merged: |
-------------------------+--------------------------------------------------
Comment(by nbruin):
the new patch (which should apply cleanly against 4.1.1) provides enough
interface to communicate with ecl via strings.
as proof of concept, there is also a routine to parse CONSes into python
lists. Assuming there is an appropriate Maxima image, this interface can
already be used to communicate with Maxima. Example session:
{{{
sage: from sage.libs.ecl import *
sage: init_ecl()
sage:
sage: ecl_eval("(require 'asdf)");
;;; Loading #P"/usr/local/sage/4.1.1/local/lib/ecl-9.4.1/asdf.fas"
;;; Loading #P"/usr/local/sage/4.1.1/local/lib/ecl-9.4.1/cmp.fas"
;;; Loading #P"/usr/local/sage/4.1.1/local/lib/ecl-9.4.1/sysfun.lsp"
sage: ecl_eval('(load "%s")'%(SAGE_ROOT+"/local/lib/maxima/maxima.fasb"))
;;; Loading "/usr/local/sage/4.1.1/local/lib/maxima/maxima.fasb"
<ECL: #P"/usr/local/sage/4.1.1/local/lib/maxima/maxima.fasb" >
sage: ecl_eval('(in-package :maxima)')
<ECL: #<"MAXIMA" package> >
sage:
sage: #There is a maxima macro to ease expression parsing
sage: string_to_object("#$x^2$")
<ECL: (MEVAL* '((MEXPT) $X 2)) >
sage:
sage: #we can also execute maxima routines
sage: L=ecl_eval('($integrate #$x^2$ #$x$)')
sage: L
<ECL: ((MTIMES SIMP) ((RAT SIMP) 1 3) ((MEXPT SIMP) $X 3)) >
sage: #rudimentary parsing of ECL constructs into python
sage: L.python()
[[<ECL: MTIMES >, [<ECL: SIMP >, <ECL: NIL >]],
[[[<ECL: RAT >, [<ECL: SIMP >, <ECL: NIL >]],
[<ECL: 1 >, [<ECL: 3 >, <ECL: NIL >]]],
[[[<ECL: MEXPT >, [<ECL: SIMP >, <ECL: NIL >]],
[<ECL: $X >, [<ECL: 3 >, <ECL: NIL >]]],
<ECL: NIL >]]]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6781#comment:2>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---