axiom-math
[Top][All Lists]
Advanced

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

[Axiom-math] Re: trigs and factor


From: Martin Rubey
Subject: [Axiom-math] Re: trigs and factor
Date: Thu, 9 Dec 2004 12:36:15 +0100

Dear Constantine,

1. Please send your questions to axiom-math. I'll get them, don't worry.

2.

 > Please send me some examples of functions defined in separate files, etc.
 > The documentation does not seem to be clear on this topic and some concrete
 > examples would be very helpful.

Hm. This depends what you want. If you want .input files, I'm of no help
here. Only: .input files are simply interpreted, just as you would type your
commands at the prompt.

If you want .spad files, i.e., if you want to write packages, domains or
categories, these are compiled, and indeed, the axiom book is a little short in
this regard.

It would be very helpful if you gave an example of what you want to
achieve. Something like: I want a function, that given this and that produces
this and that. Another function does this and the third one that.

 > For example if you have a script calling several functions, which in turn
 > call others, and so on, amounting in the end to dozens or hundreds (or more)
 > functions. Then do you have to have the same number of reads in the original
 > script file: 

yes. I suppose you can also write

)read fun1.input fun2.input,......but I didn't try.

 > Is there no way that axiom can "search" for these files in the current
 > directory and "read them in" automatically, in the same way that it reads in
 > its own built in functions ?? This is what Matlab is doing.

I don't think so.

 > With regard to the above, please expand on the possibilities of using
 > domains - some example files will be very helpful - thanks.

 > > If your operations are reusable, you might prefer "packages". These group
 > > together operations that work for any domain in a specified category. If >
 > > you are interested, I'll expand.

A package look as follows:

)abbrev package TEST TestThisAndThat
--- this tells the compiler that TEST is the abbrevation of TestThisAndThat
--- (it is compulsory to give such an abbreviation)
--- and that you are going to define a package (not a domain, not a category)

TestThisAndThat(R:IntegralDomain): Exports == Implementation where
--- here you tell the compiler, that the package is about integral domains.
--- This "parametrization" is what makes packages interesting.


    Exports == with
      double: R -> R
--- this is a function from R to R. Note that R may be *any* integral domain
--- this is the "public" part

    Implementation == add
      double p == 2*p
--- here we define the function. We have to make sure that we only use
--- operations that are available for *any* integral domain
--- this is the "private" part.

Is this something you want to use?

Martin





reply via email to

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