axiom-developer
[Top][All Lists]
Advanced

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

Re: [SAGEdev] [Axiom-developer] Sage on MathAction


From: Martin Rubey
Subject: Re: [SAGEdev] [Axiom-developer] Sage on MathAction
Date: 16 Aug 2006 22:14:45 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Dear William,

unfortunately, I don't have all the answers. But, anyway, that's what I know:

>     -- Could you give me an example that illustrates "exec"'ing the
>        contents of a text file from within Axiom?  (This sort of thing
>        is used by SAGE when input lines are huge.)

This one is very easy. You just write the functions into a file "myfile.input",
and then say

)read myfile.input

or

)re myfile.input

at the axiom prompt. Here is a real life example: the following is a file I
currently use. it reads a file called "stripped" from my harddisk and does some
computations. Note that it reads another input file itself. To minus signs mean
"comment", a close parenthesis in the first column means "system command", "_"
is the line continuation character.

-- getsloane.input ---------------------------------------------------------
)re guess2.input

-- get next sequence
-- we assume that f is a TextFile containing sequences in the format
-- A120493 ,1,2,3,4,

coerceINT(s: String): Integer == integer(PARSE_-INTEGER(s)$Lisp)

coerceLINT(r: String): List Integer ==
        map(c +-> coerceINT c, split(r, char(","))$String)_
          $FiniteLinearAggregateFunctions2(String, List String, Integer, _
                                           List Integer)

-- transforms a list into a SUP
makef(l:List INT):SUP INT == 
  reduce(_+, [monomial(e, n)$SUP(INT) for e in l for n in 0..#l])

-- we return the list of integers [1,2,3,4]
getSequence!(f: TextFile): List Integer ==
   r:String := readLine!(f)$TextFile
   r := delete(r, 1..8)
   coerceLINT(r)

f := open("stripped")$TextFile

repeat (l := getSequence!(f); n := #l; r := min(30, n); _
        if # guessADE(l, safety==(n-r)::NNI, debug==true) > 0 then output l)

-- getsloane.input ---------------------------------------------------------

>     -- If X is an Axiom variable, is there a way to ask the Axiom command
>        line for a list of function that take X as the first argument?

I doubt it, but that might be doable. However, what would you need this for?
Very likely, there will be very many operations taking an integer as first
argument, for example.

>     -- Is there a way to get a list of all the types that are defined
>        in a given Axiom session?

Yes, this is possible. Enter

)what domain

to get all domains,

)wh cat

to get all categories,

)wh pack

to get all packages

)wh op

to get all operations,

)wh th

to get all things.

Again, the lists are quite long.

>     -- Is there a way to change the prompts, i.e., to be much more
>        difficult to confuse with valid output?

I think this is unneccessary given axioms ability to speak in various
modes. For example, say

)set tex on
)set algebra off

to get a feeling for it.



I think, the truly interesting thing will be how to deal with axioms type
system. I once wrote a wrapper for polymake which was not difficult. The
tedious bit however is, that you have to decide for each function which type it
should have in axiom, and, since axiom is not perfect, many types are
missing. (Eg., there is no type for graphs)

Note, furthermore, that in axiom the displayed output does not nearly capture
everything of the internal datastructure. Using output as input works only for
those types that have ConvertibleTo(InputForm). Well that makes 57 Domains,
which is quite OK, I guess..

(To see them, use HyperDoc: click Browse, enter KONVERT, click Constructors,
enter INFORM, click Domains.)

Martin





reply via email to

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