Hello Bill,
> There is very a little documentation available in Sage about how the
> conversion from Sage internal format to some external format (such as
> used when calling Axiom). This happens automatically when you write
> something like
>
> sage: axiom(x^2+1)
>
> without including the 'quotes'. In this case Sage parses the expression
>
> x^2+1
>
> and creates a native polynomial object. Then the 'axiom' function must
> now recursively process this Sage expression until it finds objects
> and operations near the bottom of the tree that it knows how to
> interpret as Axiom objects and operations. Most of the coding that
> accomplishes this is outside of the 'axiom.py' interface itself,
> distributed over several other Python classes. As far as I know
> William Stein is still the best source for how this conversion works.
> He has said that "really it is very simple" and I guess I do
> understand parts of it, but you should expect to spend some time to
> re-discover how it works sufficiently well in order to improve it.
I don't think the interfaces are as much "magic" as you make them out
to be. If you're interested in converting object from Sage to
Axiom/FriCAS, then there are really only two methods you need to worry
about -- _axiom_ and _axiom_init_. _axiom_init_ method just returns a
string used to construct self in Axiom. For example, say we have
class Foo(SageObject):
def __init__(self, n):
self.n = int(n)
def _axiom_init_(self):
return str(self.n)
Then I can do
sage: a = Foo(2); a
<class '__main__.Foo'>
sage: axiom(a)
2
sage: axiom(a).type()
PositiveInteger
For more compilcated things, the _axiom_ method takes in an Axiom
interface object and returns self constructed in Axiom.
class Foo(SageObject):
def __init__(self, n):
self.n = int(n)
def _axiom_(self, axiom):
return axiom(str(self.n))
This behaves the same as above.
The Macualay2 interface in sage/interfaces/macaulay2.py has some good
examples of moving objects back and forth between systems.
Anyway, I did some work on the Axiom interface today such as
doctesting it, removing broken code, adding tab completion, etc. You
can see my changes at http://trac.sagemath.org/sage_trac/ticket/4028 .
Things like the online help didn't work with either the fricas spkg
or just on a local copy, but I'd be more than happy to help adding
that functionality (as well as anything else).
--Mike
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---