RE: [Axiom-mail] What is gazonk*.c

2006-10-23 Thread Bill Page
On October 23, 2006 11:56 AM Themos Tsikas wrote:
 
 Try a 
 )trace SYSTEM 
 before anything else
 
 You could try 
 )set functions compile off
 which will not use the compiler for functions.

Good suggestion! Note: This option only works properly on
versions of Axiom after patch-49, circa September 2005. Prior
to that some function definitions in the interpreter required
'compile on'.

 It seems some misconfiguration is present with your C compiler.


Yes, I think so.
 
 Mine says 
 cc1: error: unrecognized command line option -fwritable-strings
 and I have 
 gcc version 4.1.0 (SUSE Linux)
 installed
 

What version of Axiom are you using? I think Axiom compiled with
newer versions of gcl should not have this problem.

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Windows: where's the documentation?

2006-10-29 Thread Bill Page
On October 29, 2006 3:45 PM Tim Daly wrote:
 
 There are two books available in the src/doc directory.
 One is the original Axiom book and the second is a tutorial.
 

On Windows that's actually

  C:\Program Files\axiom\mnt\windows\doc

And there is a link to the Axiom Book in this directory available
from the Start menu.

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Windows: where's the documentation?

2006-10-31 Thread Bill Page
On October 31, 2006 11:57 AM Tim Daly wrote:
 ... 
 All of the information in the databases can be extracted with 
 a function called asq (e.g. ask). This is a simple C function
 that should run on Windows. It can extract and print any
 information that the database knows about functions.


Yes. asq is available from the MSDOS command line on windows.
 
 Now that I think about it, it should be straightforward to connect
 asq to a browser since a C function can be used as a cgi-bin
 program. It might take a little fondling to make the output
 display well in html but that's not conceptually hard.
 
 I'll look at it.
 

Yes. That would me nice. :-)

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] How to expand a fraction (like Maple does with'expand')?

2007-01-25 Thread Bill Page
On January 23, 2007 2:02 PM Wiesner Thomas wrote:
 
 I'm sorry that i bug you with this (probably) simple
 problem:
 
 How can i do the following (from Maple) in Axiom:
 
  expand(((-r1*r2*uoff)+((r2+r1)*r3+r1*r2)*ue)/(r2*r3));
r1 uoffue r1   ue r1
  - --- + ue + - + -
  r3r2  r3
 
 I've been trying and googling for hours. I've tried MPOLY but 
 have only managed to to pull one variable in front of the
 fraction and didn't find out how to split it up completely.
 
 I found the MPOLY approach in the Rosetta pages  
 (http://wiki.axiom-developer.org/RosettaStone)
 but it doesn't do what i want.
 
 This seems to be such a simple task and I can't find out.
 
 I am writing a quit overview about CA Systems for hobby 
 electronics and want to explain some usual tasks in
 different CA Systems.
 

I would suggest the following computation:

(1) - ex1:=((-r1*r2*uoff)+((r2+r1)*r3+r1*r2)*ue)/(r2*r3)

- r1 r2 uoff + ((r2 + r1)r3 + r1 r2)ue
   (1)  --
 r2 r3
Type: Fraction Polynomial Integer

(2) - ex1::DMP([r1,ue,uoff],FRAC POLY INT)

r3 + r2  1
   (2)  --- r1 ue - -- r1 uoff + ue
 r2 r3  r3
Type: DistributedMultivariatePolynomial([r1,ue,uoff],
Fraction Polynomial Integer)

The reason why this apparently simple task might seem difficult
at first to a novice Axiom user is because Axiom is strongly-
typed. Unlike Maple (and most other CA systems) expressions in
Axiom always have some type (domain) that explicitly defines the
operations appearing in the expression. Instead of expanding
an expression within a given domain, we are often faced with
coercing (represented by the :: symbol) expressions from one
domain to another more suitable for our task.

In my opinion learning to deal with the Axiom type system is
what makes Axiom's learning curve very steep at the beginning,
but this initial investment pays off later in more sophisticated
applications.

In (2) above, the reason that the first term is not expanded
further is that Axiom does not have any domain (as far as I
know) that has

   ue r1   ue r1
   - + -
r2  r3

as separate terms.

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] how to calculate Ricci tensor from a metric tensor?

2007-03-26 Thread Bill Page
On March 26, 2007 6:07 PM Ondrej Certik wrote;
...
 Bill Page wrote: 
  Yes, isn't that the way things go in computer algebra -
  everyone seems to write their own? :-( That's a pity. If what
  you really want to do is physics, then it's a trap that many
  people have fallen into. It took me a long time to get over
  that stage.
 
 Well, it depends. You cannot stay at that, you need to get some
 real results, otherwise it's of course nonsense to create anything
 from scratch. But SymPy, besides fun (which is very important)
 also allows me to play with the differential geometry already.
 And I like it. I like to play with ideas, so I think it was not
 a lost time.


I am not against you having fun. As an end in itself and as a
by-product of something else, that is fine. But even if you do get
some novel results after building a new tool, I would argue that
in almost every case you would be further ahead if you had
invested the same amount of time in learning to properly use
(and perhaps extend) some existing system.
 
 
 To sum it up: It would be nice to have an open source alternative
 to Maple/Mathematica, that is reasonably fast (maybe written in
 C++), could be easily extended with your own ideas, would be
 callable from python and could be used in real world problems
 (as Maple/Mathematica can).

Such open source alternatives already exist, e.g. Axiom and Maxima.
They are both written in Lisp and modern Lisp implementations are
certainly reasonably fast, arguably perhaps as fast as C++. And
the Sage project demonstrates that these can be made callable from
python:

http://www.sagemath.org

At the SymPy website

http://code.google.com/p/sympy

you quote the GiNaC developers:

 ...
 Why not use CAS with its own language (like Maple / Mathematica /
 Maxima) is best described by:

http://www.ginac.de/FAQ.html#whynotmaple

 Q: What was the problem with Maple?

 A: First of all: Maple is a wonderful product. Yes, it is.
 However, when you start writing large-scale applications you
 are doomed to run into trouble with it unless you are extremely
 careful and know exactly what you are doing.

This is true of any large application in any programming language.
If you want to argue that it is a matter of degree, then I think
you are splitting hairs. Compared to advances in computer hardware,
software technology lags very far behind. It is the constraint in
any large project no matter what tools you choose.

 One important problem with Maple (and any other CAS) is the
 lack of a standardized up-to-date language. For instance, the
 concept of Object Oriented design is not present. Quite
 generally, facilities for encapsulation are poorly developed.

That is simply not true. Most standardization in programming
languages occurs by de facto adoption despite efforts by various
standards organizations. Maple has permitted coding in an
object oriented manner since release 9 (see Maple modules). It
could be easily argued that Axiom (alias ScratchPad) applied
the concepts of object-oriented design and polymorphic type
systems almost two decades before these were even recognized
as interesting programming paradigms by the rest of the
computer science and mathematics communities. So up-to-date
is largely a matter of perspective or else Axiom was and
still remains ahead of it's time.

 Maple's language is dynamically scoped and from time to time
 you find that Maple's developers messed up with that by not
 properly declaring variables to be local resulting in obscure
 (history-dependent) bugs. How are we supposed to write
 scientific software with the language even the Maple developers
 have problems to handle? Mathematica and Macsyma face the same
 problem, by the way.

Yet this is exactly the kind of problems that the designers of
Axiom were trying to avoid.


 Rather than pointing out a number of Maple's linguistical
 and structural weaknesses let us ponder about one simple
 fact. The purpose of symbolic computation is to simplify
 mathematical expressions so that we can more easily understand
 their structure or code them more efficiently for numerical
 evaluation by a computing machine.

I *very* strongly disagree with this statement as the main
purpose of symbolic computation. At best it is only one possible
purpose. Simplification is too ambiguous and subjective a concept.
What is simple and easy to understand by one person may not be
simple or easy to another. As far as I am concerned the purpose
of symbolic computation is to accurately and correctly do by
computer some of what mathematicians do when they manipulate
mathematical objects. In a very real sense all computation done
by modern digital computers is symbolic. The only distinction
that I can make between symbolic computations and numeric
computation is that the former is almost always concerned with
exact results while the later is usually concerned with
approximate results.

 Most beginners simply use their Computer Algebra tool by
 typing in some

Re: [Axiom-mail] Help in axiom

2007-04-10 Thread Bill Page

Alasdair,

Let me address your last comment first:

Quoting Alasdair McAndrew:


Please don't take my comments as overly critical; I am speaking
from a beginner's perspective.  But sometimes it's hard for
experts to see things through a beginner's, or learner's eyes. 


On the contrary, I think your views as a beginner are VERY
valuable to us. The more verbose and critical you are willing to
be (within reason of course :), the better. 



I'm sorry to keep harping on about this same issue, but I do find
it a real sticking point.  When I attempt to learn a new software
system (such as a new CAS) I spend a lot of time in the help
pages, looking at examples, seeing how things are done; reading
online tutorials and introductions.  I find help in Axiom very
hard to access.  To use HyperDoc, and to enjoy the benefits of
decent typesetting in TeXmacs, it seems I need two instances of
axiom running.  And there is no functions/commands help available
from the command line (such as there is with Maxima, Maple,
Mathematica, MuPAD etc). 


That is not quite true. There are commands like the following:

(1) - )summary
 )credits  : list the people who have contributed to Axiom

 )help command gives more information
 )quit : exit AXIOM

 )abbreviation : query, set and remove abbreviations for
 constructors
 )cd   : set working directory
 )clear: remove declarations, definitions or values
 )close: throw away an interpreter client and workspace
 )compile  : invoke constructor compiler
 )display  : display Library operations and objects in your
 workspace
 )edit : edit a file
 )frame: manage interpreter workspaces
 )history  : manage aspects of interactive session
 )library  : introduce new constructors
 )lisp : evaluate a LISP expression
 )read : execute AXIOM commands from a file
 )savesystem   : save LISP image to a file
 )set  : view and set system variables
 )show : show constructor information
 )spool: log input and output to a file
 )synonym  : define an abbreviation for system commands
 )system   : issue shell commands
 )trace: trace execution of functions
 )undo : restore workspace to earlier state
 )what : search for various things by name

--

I find the )what, )show and )display commands especially useful. 
But unfortunately in the current versions of Axiom )help is not

so helpful. :-(

I think Hyperdoc is sort of neat, but I have to admit I learnt
everything I know about Axiom without using it at all. Other
people have different opinions about it. 



And even in HyperDoc, there are very few examples.  For instance,
I was trying to find the defining polynomial of a finite field. 
I discovered that there is a command definingPolynomial, but I

couldn't find any examples on its use, nor a comprehensive help
page about it.  There are some simple examples in HyperDoc
(calculus, graphics, linear algebra etc), which is incredibly
helpful, but there doesn't seem to be this level of help
available for ALL commands, as I believe there should be. 



Yes, there should be. But Axiom is now a volunteer-based open
source project, so if there is going to be this sort of
documentation it will have to be written by these volunteers. 
Part of the implied obligation of using open source software is

the user's willingness to eventually give something back but
contributing in some manner to the project. Writing new and
improving old documentation is one way that new users can easily
contribute while they are learning Axiom at the same time. 


The Axiom Wiki

http://wiki.axiom-developer.org

is an especially easy way to contribute to this process. 


From my limited understanding, it would seem that Axiom is
superb for the development  and implementation of mathematical
algorthms (such as Martin Rubey's Guess package), but that it
would go even further, and have greater reach in the mathematical
community, with more comprehensive, and more easily accessible
help. 




+1. I agree 100%. 

Thank you for your comments. 


Regards,
Bill Page. 



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Another beginner's question: Lagrange interpolation

2007-04-12 Thread Bill Page
,Fraction Integer)

so the final result looks like this:

(11) -
LagrangeInterpolation(A,B)$PolynomialInterpolationAlgorithms(Fraction
Integer,UnivariatePolynomial(x,Fraction Integer))

 2
   (11)  - 6x  + 19x - 9
Type: UnivariatePolynomial(x,Fraction Integer)

There, that was easy! Right? ;) Well, perhaps not for the
beginner...

As you get a little more experienced with Axiom you might look
in Axiom's source code itself. In principle this source code is
supposed to consist of both code and the complete documentation
of the code. here:

http://wiki.axiom-developer.org/axiom--test--1/src/algebra

This is a searchable online copy of the source code for the
entire Axiom Library. Enter 'LagrangeInterpolation' in the
search box at the top right of the page, hit enter and you will
see all the places where LagrangeInterpolation is used in the
code. Usually there is also at least some minimal documentation
included in the code, but in this case we are out of luck - the
original Axiom developer did not even leave us any hints. The
best we get is a quite readable algorithm written in SPAD -
the Axiom library high level programming language.

LagrangeInterpolation(lx, ly) ==
#lx ^= #ly =
error Different number of points and values.
ip: P := 0
for xi in lx for yi in ly for i in 0.. repeat
pp: P := 1
xp: F := 1
for xj in lx for j in 0.. | i ^= j repeat
pp := pp * (monomial(1,1) - monomial(xj,0))
xp := xp * (xi - xj)
ip := ip + (yi/xp) * pp
ip

-

Which I think is actually quite readable, but perhaps too much
for the beginner.

Another important place to look online is the Axiom Input test
files. There are a lot of useful (but sparsely documented)
examples here:

http://wiki.axiom-developer.org/axiom--test--1/src/input

But searching for 'LagrangeInterpolation' here we are again
out of luck.

-

I am sorry that this email reply has gotten rather long, but
I wanted to illustrate the kind of help that I wish that one
day will be available on the Axiom Wiki and other Axiom
publications.

If you have any questions or comments about this please
continue.

Regards,
Bill Page.




___
Axiom-mail mailing list
[EMAIL PROTECTED]
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Another beginner's question: Lagrange interpolation

2007-04-13 Thread Bill Page

might require a significant effort. But it seems to me that in
order to write an Axiomatic z-transform package, one should be
concerned about the discrete analogues for the above domains.
This will likely have something in common with combinatorial
mathematics that is already in Axiom, e.g.

(7) - )sh CombinatorialFunction
 CombinatorialFunction(R: Join(OrderedSet,IntegralDomain),
 F: FunctionSpace R)
 is a package constructor
 Abbreviation for CombinatorialFunction is COMBF
 This constructor is not exposed in this frame.
 Issue )edit c:/Program Files/axiom/mnt/windows/../../src/algebra/COMBF.spad
 to see algebra source code for COMBF

--- Operations 
 ?**? : (F,F) - F belong? : BasicOperator - Boolean
 binomial : (F,F) - F factorial : F - F
 factorials : F - F   factorials : (F,Symbol) - F
 iibinom : List F - F iidprod : List F - F
 iidsum : List F - F  iifact : F - F
 iiperm : List F - F  iipow : List F - F
 ipow : List F - Fpermutation : (F,F) - F
 product : (F,Symbol) - F summation : (F,Symbol) - F
 operator : BasicOperator - BasicOperator
 product : (F,SegmentBinding F) - F
 summation : (F,SegmentBinding F) - F

But I hope that this does not discourage you from attempting
re-implement your Maxim z-transform code in Axiom. I really
only intend these comments as a kind of advanced warning of
where you might end up. It is entirely possible that you may
find the approach of using pattern matching rules to manipulate
Expressions adequate for your initial purposes.

 Concerning difference equations, note that SumIt by the late 
 Manuel Bronstein is now free software (I have the sources
 already). If you are familiar with these things, (google for
 the documentation), it would be great to make that available
 in axiom (some porting is needed).

I agree with Martin that making SumIt available in Axiom would be
a big step towards making it possible to write your z-transform
function in a more Axiomatic way.

 ... 
 In the long run, that is, if you are going to explore Axiom 
 seriously, it is certainly necessary to start programming in
 SPAD or Aldor.
 
 In any case, I hope you stay with us,
 

Me too.

Regards,
Bill Page.




___
Axiom-mail mailing list
[EMAIL PROTECTED]
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Spad and inductive types

2007-05-07 Thread Bill Page
On May 7, 2007 2:28 AM Martin Rubey writes:
 
 Gabriel Dos Reis writes:
 
  For concretness, here is a very classic example of inductive
  type along with a function working on expression of such type,
  written in both Haskell and New Boot.  How would you best write
  that in Spad?
 
 I'm very sorry, but I do not understand the code below.  
 Could you describe what it is supposed to do?  I guess: Expr
 is the name of the type (= domain?) you want to create, and
 it exports a single operation called eval, which returns an
 integer.  But what is MkInt, MkAdd and MkMul?  
 Perhaps you want to say that an element in Expr can be of three
 forms, namely MkInt, MkAdd or MkMul?
 
...
  --8- Begin Haskell code --8-
  data Expr = MkInt Int
| MkAdd Expr Expr
| MkMul Expr Expr
 
  eval::Expr - Int
  eval (MkInt i) = i
  eval (MkAdd x y) = (eval x) + (eval y)
  eval (MkMul x y) = (eval x) * (eval y)
  --8- End Haskell code --8---

Yes, I think what Gaby wants might be written something like this
in SPAD:

)abbrev domain EX Expr
Expr:with
eval: % - Integer
coerce: Integer - %
_+: (%,%) - %
_-: (%,%) - %
  == add
MkInt == Integer
MkAdd == Record(lAdd:%,rAdd:%)
MkMul == Record(lMul:%,rMul:%)
Rep == Union(MkInt,MkAdd,MkMul)
eval(x:%) ==
  i := x pretend Rep
  i case MkInt = i
  i case MkAdd = eval(i.lAdd) + eval(i.rAdd)
  i case MkMul = eval(i.lMul) * eval(i.rMul)
-- coerce(n) == autoCoerce(n)$Rep pretend %
-- x + y == autoCoerce([x,y]$MkAdd)$Rep pretend %
-- x * y == autoCoerce([x,y]$MkMul)$Rep pretend %



This compiles eval, but I have a problem. Obviously one would
like to create members of this domain. But I can not seem to
persuade SPAD to compile my defintions of coerce, + and *. SPAD
tells me: Cannot pretend ...

I don't understand that. Perhaps you can see a way around it?

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Spad and inductive types

2007-05-07 Thread Bill Page
Martin,

On May 7, 2007 4:14 AM you wrote:
 
 Here you go.  But I doubt somehow that Gaby had this in mind, 
 since this is quite usual stuff in Axiom (grep Rep.*Union)
 
 ...

Fantastic! Thankyou. See it again here:

http://wiki.axiom-developer.org/SandBoxInductiveType

I believe that is exactly what Gaby wanted. Yes, grep shows
some examples but not of the specific type of induction that
Gaby had in mind.

It seems that one key differences between what I wrote and
your version was:

...
Rep := Union(MkInt, MkAdd, MkMul)
...

The grep command actually shows one case where == is used, but
I have noticed before that Spad seems to treat this differently
than what I always expect but you seem to write it naturally. :-)

Now I can retire to sleep in peace.

Cheers,
Bill Page




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Spad and inductive types

2007-05-07 Thread Bill Page
On May 7, 2007 10:41 AM Gaby wrote:
 
 Martin Rubey writes:
 
 | Here you go.  But I doubt somehow that Gaby had this in 
 | mind, since this is quite usual stuff in Axiom
 (grep Rep.*Union)
 
 Thanks, Martin.
 
 I did not say I did not know how to write it.  I said I don't
 have a good way :-).  Everything I've tried to come up
 (including proposed solutions here) with looked a hack to me.

I think it would have been very useful if you had included what
you came up with in your original email. :-( Anyway, I think
your question is very useful as it stands as an example of
the difference between Spad and Boot.

 Part of the reasons is
 
   -- MkAdd == Record(lAdd:%,rAdd:%)
   -- MkMul == Record(lMul:%,rMul:%)
 
 if union are used whose fields are directly records, then
 the fields of the record must themselves have different name.
 In the Boot or Haskell case, only the data constructor name
 need to be different.

That is not an essential feature of how this must be written
in Spad. For example see my recent additional example at:

http://wiki.axiom-developer.org/SandBoxInductiveType

But I think you are right to point out a limitation of the
design of the 'Union' domain constructor in Spad (and in
Aldor).

I think there is no good reason that 'Union' is implemented
in Spad using polymorphism of coerce to create elements. For
example the following provides no method to create objects
with a specific tag, x or y (by default only objects tagged
x are created).

(1) - )sh Union(x:Integer,y:Integer)

 Union(x: Integer,y: Integer) is a domain constructor.
--- Operations 

 ?=? : (%,%) - Boolean   ?case? : (%,x) - Boolean
 ?case? : (%,y) - Booleancoerce : % - OutputForm
 construct : Integer - % construct : Integer - %
 ?.? : (%,x) - Integer   ?.? : (%,y) - Integer

In spite of this it appears that the internal representation of
'Union' does implement a proper disjunction as required by the
expected semantics.

I would prefer that Union have methods something like this:

 construct : (Integer,x) - % construct : (Integer,y) - %

but this would also require some changes in the Axiom interpreter
to work smoothly.

 I fully understand Spad is not Haskell, neither Boot, but I'm
 looking for a solution where only the toplevel data constructors
 needs to be different.

I think my example 'Expr2' at

http://wiki.axiom-developer.org/SandBoxInductiveType

satisfies your requirement, although on initial look it probably
seems more complicated than what you might like. Some of this
complication is merely interface for the Axiom interpreter. The
essential definition of the inductive type is merely given by:

Rep := Union(MkInt(Integer), MkAdd(%,%), MkMul(%,%))

The definitions of MkAdd and MkMul as named types (domains) is
sufficient to avoid the problem that this form of 'Union' is not
disjunctive.

 I have more to say later.

We're listening. :-)

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Spad and inductive types

2007-05-08 Thread Bill Page

Quoting Ralf Hemmecke:

... 
I know the definitions in aaa.as look quite lengthy, but it probably

shows how one could generically generate appropriate Aldor code
from a more concise Syntax. 


Since Aldor is already intended to be pretty concise, I don't think
it is a good idea in general to try to invent a new language and then
generate Aldor from it

 All the exports that appear are basically the

exports of the Union (OK, Union still has a few more.)

---BEGIN aaa.as
#include aldor
#include aldorio

define ET: Category == with; -- ExpressionType
Expr: ET with {
MkInt: Integer - %;


It doesn't look right to me that the MkInt constructor takes
a specific integer as a parameter while MkAdd and MkMul
take a type. 


MkAdd: (%, %) - %;
MkMul: (%, %) - %;
apply: (%, 'MkInt') - Integer;
apply: (%, 'MkAdd') - (%, %);
apply: (%, 'MkMul') - (%, %);
case: (%, 'MkInt') - Boolean;
case: (%, 'MkAdd') - Boolean;
case: (%, 'MkMul') - Boolean;


I think having 'apply' and 'case' appear as exports of Expr is
very undesirable. 


} == add {
Rep == Union(
Mkint: Integer,
Mkadd: Record(left: %, right: %),
Mkmul: Record(left: %, right: %)
);


Why not write a Union of the constructors, instead of their
representation? I.e. something like:

Rep == Union(
Mkint: MkInt,
Mkadd: MkAdd(%,%),
Mkmul: MkMul(%,%)
);



import from Rep;
MkInt(i: Integer): % == per union i;
MkAdd(x: %, y: %): % == per [Mkadd == [x, y]];
MkMul(x: %, y: %): % == per [Mkmul == [x, y]];

apply(x: %, t:'MkInt'): Integer == rep(x).Mkint;
apply(x: %, t:'MkAdd'): (%, %) == explode rep(x).Mkadd;
apply(x: %, t:'MkMul'): (%, %) == explode rep(x).Mkmul;

(x: %) case (t:'MkInt'): Boolean == rep(x) case Mkint;
(x: %) case (t:'MkAdd'): Boolean == rep(x) case Mkadd;
(x: %) case (t:'MkMul'): Boolean == rep(x) case Mkmul;


Why does this construction look so different from the
definition of Expr2 in

http://wiki.axiom-developer.org/SandBoxInductiveType ?


}
---END aaa.as

---BEGIN bbb.as
#include aldor
#include aldorio

#library EXPR aaa.ao
import from EXPR;

extend Expr: OutputType == add {
import from 'MkInt', 'MkAdd', 'MkMul';
import from Integer;
(tw: TextWriter)  (x: %): TextWriter == {
x case MkInt = tw  x.MkInt;
x case MkAdd = {
(a, b) := x.MkAdd;
tw  (  a  +  b  );
}
x case MkMul = {
(a, b) := x.MkMul;
tw  (  a  *  b  );
}
tw;
}
}



The use of case above seems very unnatural to me. Is it
possible to extend each constructor (e.g. MkInt, MkMul, etc.)
separately. 


main(): () == {
import from Integer;
e1: Expr := MkInt 1;   stdout  e1 =   e1  newline;
e2: Expr := MkInt 2;   stdout  e2 =   e2  newline;
e3: Expr := MkInt 3;   stdout  e3 =   e3  newline;
a1: Expr := MkAdd(e1, e2); stdout  a1 =   a1  newline;
m1: Expr := MkMul(a1, e3); stdout  m1 =   m1  newline;
}
main();
---END bbb.as



Ralf, these are just general comments about your approach and
aren't intended to be particularly critical. I think it is important to
try to understand how to write this efficiently in Aldor and your
work contributes greatly to this. 


Regards,
Bill Page. 



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Spad and inductive types

2007-05-08 Thread Bill Page

Quoting Ralf Hemmecke [EMAIL PROTECTED]:

... 
Bill Page wrote:

Ralf, these are just general comments about your approach and
aren't intended to be particularly critical. 


Although I felt that it was the most critical reaction on one of my
mails that I have ever experienced from you, I know that you do that
to contribute to understanding the situation. I don't feel offended. 



Good. :-) I am learning a lot from your examples. 


Please take a look at:

http://wiki.axiom-developer.org/SandBoxAldorInductiveTypes

Here I have simply re-wrote my Expr2 Spad code into Aldor. 
I really *love* the Aldor compiler. Everything important is

explicit and it showed me some very significant things that
were hidden in my Spad code - even though they work the
same. Spad does some remarkable things but some of the
most important ones too often seem hidden. 


.. Now I will have to go back and re-write my Spad code
so that it looks as nice as the Aldor result. 


By the way. Today I have learned how to include an integer
into the left or right part of Union(left: Integer, right: Integer). 
There appears only an example in the AUG, but not a formal
description. 



Please tell. I missing the example. I think this is quite important. 


Regards,
Bill Page. 



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Spad and inductive types

2007-05-09 Thread Bill Page
to 'Cross(Expr,Expr)'. That is why I say MkAdd is a type
constructor. 




import from Rep;
MkInt(i: Integer): % == per union i;
MkAdd(x: %, y: %): % == per [Mkadd == [x, y]];
MkMul(x: %, y: %): % == per [Mkmul == [x, y]];

apply(x: %, t:'MkInt'): Integer == rep(x).Mkint;
apply(x: %, t:'MkAdd'): (%, %) == explode rep(x).Mkadd;
apply(x: %, t:'MkMul'): (%, %) == explode rep(x).Mkmul;

(x: %) case (t:'MkInt'): Boolean == rep(x) case Mkint;
(x: %) case (t:'MkAdd'): Boolean == rep(x) case Mkadd;
(x: %) case (t:'MkMul'): Boolean == rep(x) case Mkmul;


Why does this construction look so different from the
definition of Expr2 in

http://wiki.axiom-developer.org/SandBoxInductiveType ?


}


I don't actually understand whether this is meant in a
positive or negative sense. I would rather call my code
a variation of yours. 


As explained above, I see major differences. 



The biggest difference probably is that you cannot produce
that what was in file bbb.as, because in an extend Expr
you would have no way to access the internal structure of
Expr. 


In

http://wiki.axiom-developer.org/SandBoxAldorInductiveTypes

I show how to use extend. 



As I understood Gaby, he wanted to define just the data
structure without any additional features like eval or
coercion to OutputForm. 


I tried to eliminate eval and coercion to OutputForm from
my example in SandBoxAldorInductiveTypes, but I ran into
problems because of the recursion and the fact that I
would have to extend the category ExprCat. Apparently
Aldor does not allow me to do this (yet, see chapter of
AUG on extend). 



To such a data structure one could add features
(= functions) later without changing or knowing the
actual representation. 


In my example I do seem to require some knowledge of the
representation (i.e. define Rep == ...). Maybe this could
be avoided if I invented some other interface. 


That is a step to avoid a lot of (if not all) mutual
recursion in the construction of the Axiom library. 



I still think that is wishful thinking. :-(

Regards,
Bill Page. 




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Spad and inductive types

2007-05-09 Thread Bill Page

Quoting Ralf Hemmecke [EMAIL PROTECTED]:


On 05/09/2007 10:02 AM, Bill Page wrote:
  ... 
  MkInt is *not* a function which when given an Integer

  returns something of type Expr. It is type *constructor*,
  that is, when given 'Int' MkInt returns a subtype of Expr. 


Before you criticize... I don't claim that I am right. What
comes is just my current understanding. 



Sorry, I do not mean to criticize. I am also only writing about my
current (provisional) understanding. 


Let me quote from
http://en.wikipedia.org/wiki/Algebraic_data_type

   Here, Empty, Leaf and Node are the constructors. Somewhat
   similar  to a function, a constructor is applied to arguments of
   an appropriate type, then yielding an instance of the data type
   to which the constructor belongs. 



I would emphasize *Somewhat similar to a function*. Yes the
Haskell definition does define the application of data constructors
to arguments of an appropriate type. 

... 
  In Spad and Aldor a type constructor is a function that
  returns a Type. 

I agree on the latter, but as you said, it is a type constructor. 
In the wikipedia article constructor sounds to me more like a

constructor in object oriented languages like Java. One creates
an instance of the type. 


Both categories and domains are types in Aldor. A constructor
can return a domain as an instance of a category. Any way you
write it

  data Expr = MkInt Integer | ... 

defines Expr as a type with members 'MkInt 1', 'MkInt 2', ... etc. 


So as in
http://lists.nongnu.org/archive/html/axiom-mail/2007-05/msg1.html
one says

eval (MkInt i) = i

i.e. the argument is an integer and not the type Integer. 


The argument of eval above is 'MkInt i'. It is not an integer. 
It is a member of the type 'MkInt Integer', which is a subtype
of Expr. 


And since

eval::Expr - Int

the input to eval should be an actual element of type Expr, not
the type Expr itself. 


I agree. 

... 
Ah, is begin to understand. Have you seen my note on the use of the

macros

Mkint == MkInt;
Mkadd == MkAdd;
Mkmul == MkMul;

? MkInt is the constructor (in the oo sense) and Mkint is just a tag. 



Yes. 

The tag Mkint corresponds to the MkInt in the above Haskell code. 
And a tag (together with the (aldor) functions MkInt, etc. is enough to

simulate the Haskell code. In the Haskell code Mkint and MkInt is
denoted by the same identifier. 


I agree. 



I still don't say that one cannot simulate Haskell's MkInt by a
Aldor domain constructor. You have shown that it works on
http://wiki.axiom-developer.org/SandBoxAldorInductiveTypes . 
But it seems to be unnecessary overhead to me. 



Maybe that is true. I have not looked at the actual generated
Lisp code. I very much doubt that it is anything as economical
as the Lisp output of Shoe (New Boot) that Gaby showed in the
email that started this thread. But I would expect that: Spad is
not Boot. 

  ... 
  in Haskell, by a kind of convenient abuse of notation

  (or polymorphism if you wish) 'MkInt' also denotes a
  function
 
MkInt: Int - MkInt Int
 
  that creates an object of type 'MkInt Int' from an object
  in 'Int'. I think this is a potential source of confusion. 


Probably I should have avoided the wording above that might
(incorrectly) be interpreted as a slur against Haskell. That is
certainly not my intent and perhaps it would have help to avoid
Gaby's reaction to my email. Really I am only talking about
how I think this concept should be written in Spad and Aldor. 



I agree that it's a source of confusion. But I must admit that
I would have written

   MkInt: Int - Expr

instead. Otherwise there would be a type mismatch in

   eval (MkInt i) = i

since MkInt(Int) is not equal to Expr. Don't you agree?


'MkInt i' is a member of the type 'MkInt Integer' which is
a subtype of Expr. The expression

eval (MkInt i) = i

only defines eval over this subtype of Expr. The complete
definition of 'eval' also requires two other definitions for
'MkAdd Expr Expr' and 'MkMul Expr Expr', respectively. 

... 
. Then

 
rep: % - Rep
 
  automatically classifies members of Expr (implements the
  pattern matching) and
 
per: Rep - %
 
  injects these subtypes into Expr. 


Unfortunately, in Aldor rep and per are macros and actually only do
some pretend. 


You are right however they also involve @. The reason is that they
must be type-safe. Assuming however that they are type-safe,
then they can be written as functions as I show above. (In fact this
is used in several places in the Axiom library.)


What you need is an actual functions union to map an element
of type MkInt(Integer) into Rep. 



Yes, union is needed in the implementation, but my point is that

  rep: % - Rep

maps elements of Expr directly into the Union. 'case' can then be
used to classify them as 'MkInt ...', 'MkAdd ...' or 'MkMul ...'. 

... 


Regards,
Bill Page. 




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http

Re: [Axiom-mail] Spad and inductive types

2007-05-09 Thread Bill Page

Quoting Ralf Hemmecke [EMAIL PROTECTED]:


Dear Bill,

I only have a comment on the following. 


I agree that it's a source of confusion. But I must admit that
I would have written

   MkInt: Int - Expr

instead. Otherwise there would be a type mismatch in

   eval (MkInt i) = i

since MkInt(Int) is not equal to Expr. Don't you agree?


'MkInt i' is a member of the type 'MkInt Integer' which is
a subtype of Expr. The expression

eval (MkInt i) = i

only defines eval over this subtype of Expr. The complete
definition of 'eval' also requires two other definitions for
'MkAdd Expr Expr' and 'MkMul Expr Expr', respectively. 


The subtype is the thing that bothers me. Not in Haskell,
but in your Aldor code on
http://wiki.axiom-developer.org/SandBoxAldorInductiveTypes

You define a domain

   MkInt(Z:IntegerNumberSystem): ExprCat == add ... 


and then you use it in

Expr: ExprCat == add {
 Rep == Union(Mkint:MkInt(Integer), ...);
 ... 
}


I don't think that construction qualifies MkInt to count as a subtype
of Expr. Note that the representations of MkInt and Expr are different. 


http://aldor.org/docs/HTML/chap7.html#5
(Although I find that section not very illuminating w.r.t. domains.)



I understand your point. For me it is still a little mysterious that
representation is involved here at all since the usual recursive
definition doesn't seem to need it. But you would agree of course
that both Expr and MkInt(Integer) are in ExprCat. The specific
representation of Expr is such that MkInt(Integer) is a subset of
that  Rep (as implemented by 'Union') and 'per' is a natural
isomorhism (Expr can be assigned the property 'canonical' as
defined in Axiom) because the Union is disjoint. So maybe I
should have said that it is a sub-type up to an isomorphism. 


Another way of saying this is that objects in Expr are such that
their representation is a Union of sub-types of Expr, recursively,
down to MkInt(Integer) which is just represented by Integer. Really
it is not so peculiar to say that an expression should be represented
in terms of it's sub-expressions. Right?

(You see, I am really just trying to convince myself by convincing
you... :-) Thank you for persisting in this discussion. 


Regards,
Bill Page. 



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Spad and inductive types

2007-05-09 Thread Bill Page

Quoting Gabriel Dos Reis [EMAIL PROTECTED]:


On Wed, 9 May 2007, Bill Page wrote:

[...]

|   ... in Haskell, by a kind of convenient abuse of notation
|   (or polymorphism if you wish) 'MkInt' also denotes a
|   function
|  
| MkInt: Int - MkInt Int
|  
|   that creates an object of type 'MkInt Int' from an object
|   in 'Int'. I think this is a potential source of confusion. 
|

| Probably I should have avoided the wording above that might
| (incorrectly) be interpreted as a slur against Haskell. 


Well, I did not interepret it as a slur against Haskell.  However, it did
appear to me to be fundamentally incorrect to miss the core ideas of
algebraic data typea and how they lead to GADT:

data Expr where
  MkInt:: Integer - Expr
  MkAdd:: Expr - Expr - Expr
  MkMul:: Expr - Expr - Expr

That is all that is needed to define more operations on values of
type Expr. 



I agree that GADT is important in the context of Haskell which has
(in principle) a complete and formal semantics. But I do not think it
is so interesting in Spad and Aldor which already has the full
machinery of abstract data types. If we want to add more operations
on a given type, we have 'add inheritance', e.g. 

  NewExpr: ExprCat with ... = Expr add ... 

and even post-facto extension of domains in Aldor. 


I can see however why this is interesting from the point of view of
Boot. If Boot could be given a formal semantics like Haskell, then
one might be much more confident of it's use to implement Spad
and therefore ultimately confidence in the semantics of Spad. 


Am I wrong in presuming this underlying motivation? But if you still
think I am just confused, please don't feel obliged to say more than
that you think so... 


Regards,
Bill Page. 



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


RE: [Axiom-mail] Enumeration

2007-05-26 Thread Bill Page
Gaby,

Enumeration is an important built-in type in Aldor, but I
Axiom I get mixed (strange) results...

On May 25, 2007 11:43 PM  Gabriel Dos Reis wrote:
 
   The Axiom Book seems to have mention of Enumeration and
 EnumerationCategory...  
 
 Did I miss something?
 

(1) - )wh domain Enumeration
 Domains --

Domains with names matching patterns:
 enumeration

   Enumeration

However:

(1) - )show Enumeration
   The )show system command is used to display information about types
  or partial types. For example, )show Integer will show
  information about Integer .

  Enumeration is not the name of a known type constructor. If you
  want to see information about any operations named Enumeration ,
  issue
   )display operations Enumeration
(1) - )show EnumerationCategory
   The )show system command is used to display information about types
  or partial types. For example, )show Integer will show
  information about Integer .

  EnumerationCategory is not the name of a known type constructor.
  If you want to see information about any operations named
  EnumerationCategory , issue
   )display operations EnumerationCategory


Yet they do seem to work as in Aldor:

(2) - Colors:=Enumeration(red,green,blue)

   (2)  Enumeration(red,green,blue)
 Type:
Domain
(3) - i:Colors:=green

   (3)  green
Type:
Enumeration(red,green,blue)
(4) -

--

Maybe there is something a little trashed in the databases?

Regards,
Bill Page.




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] A slow summation

2007-06-13 Thread Bill Page

On 6/13/07, Alasdair McAndrew wrote:

Wondering about nice little numeric exercises to help introduce
Axiom to a small group of students, I attempted to sum the first
2 reciprocals:

reduce(+,[1.0/i for i in 1..2])

This works, but is (I think) unreasonably slow; it takes over 21
seconds on my computer.  The equivalent command in Maxima
takes less than 1 second. Is there any way of encouraging Axiom
to be faster here?



It turns out that Axiom's list data type is very slow and almost
all the time is spent building the list. You can avoid this by
preallocating an arrary of sufficient size. E.g.

(1) - )set message time on

(1) - rlist:=new(2,0.0)$PrimitiveArray(Float);

 Type: PrimitiveArray Float
  Time: 0 sec

(2) - for i in 1..2 repeat rlist(i-1):=1.0/i

   Type: Void
  Time: 1.27 (EV) + 0.42 (GC) = 1.68 sec

(3) - reduce(+,rlist)

  (3)  10.4807282172 29327571

   Type: Float
 Time: 0.10 (EV) = 0.10 sec

(Times shown are from a 500 MHz P3 running Windows XP
and axiom-0.1.4.)

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] A slow summation

2007-06-13 Thread Bill Page

On 6/13/07, Bill Page [EMAIL PROTECTED] wrote:


It turns out that Axiom's list data type is very slow and almost
all the time is spent building the list. You can avoid this by
preallocating an arrary of sufficient size. E.g.


(2) - for i in 1..2 repeat rlist(i-1):=1.0/i

Type: Void
   Time: 1.27 (EV) + 0.42 (GC) = 1.68 sec

(3) - reduce(+,rlist)

   (3)  10.4807282172 29327571

Type: Float
  Time: 0.10 (EV) = 0.10 sec

(Times shown are from a 500 MHz P3 running Windows XP
and axiom-0.1.4.)



Here is another probably less obvious solution:

(1) - reduce(+,map(x+-1.0/x,expand(1..2)))

  (1)  10.4807282172 29327571
   Type: Float
  Time: 0.73 (EV) + 0.02 (OT) + 0.12 (GC) = 0.87 sec

The reason that this is very fast is that 'expand' creates the
list in situ and the loop is internal to the 'map' operator.

See the discussion about 'expand' in

http://wiki.axiom-developer.org/SandBoxFloatSegment

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] A slow summation

2007-06-13 Thread Bill Page

Of course these also make some sense :-)

(1) - sum(1/x,x=1.0..2.0)

  (1)  10.4807282172 29327571
 Type: Union(Expression Float,...)
Time: 0.02 (IN) + 3.10 (EV) + 0.02 (OT) + 0.32 (GC) = 3.45 sec

(2) - sum(1/x,x=(1.0..2.0)$Segment DoubleFloat)

  (2)  10.480728217229315
Type: Union(Expression DoubleFloat,...)
 Time: 1.77 (EV) + 0.23 (GC) = 2.00 sec

(3) - sum(1/x,x=1..2)::Float

  (3)  10.4807282172 29327573
 Type: Float
Time: 5.02 (EV) + 1.22 (GC) = 6.23 sec

--

Float is the domain of finite precision floating point numbers and
DoubleFloat is the domain of hardware support floating point numbers.
The last computes an exact fraction (rational number) with a final
conversion to Float.

Maybe they provide good examples for your students?

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Axiom under windows - curious error

2007-06-14 Thread Bill Page

Alasdair,

Maybe the following axiom-developer email thread will help?

http://lists.nongnu.org/archive/html/axiom-developer/2007-02/msg00062.html

I think you should check the location of the definition of the AXIOM
environment variable as suggested in that thread. It needs to be
defined for all users who access Axiom. If you want it can be defined
at the system level for all users. To test log in as the new user and
start a Command Prompt windows. Type:

 echo %PATH%

and check that

 C:\Program Files\axiom2\mnt\windows\bin;

is in the list.

I think the reason why

  C:/msys/1.0/home/bpage/axiom--windows--1/mnt/window

is appearing in your error message is that Axiom rather stupidly
defaults to the original build directory if it does not find a local
definition of the AXIOM environment variable. (Of course it should
give a reasonable error message - not default to something that is
certain to no longer exist and then complain ... :-)

Let me know if this helps.

Regards,
Bill Page.

On 6/14/07, Alasdair McAndrew [EMAIL PROTECTED] wrote:

I've installed Axiom 0.1.4 on an oldish machine running Win 2000 Pro.  It
starts and works fine, but when I switch users and try to start it again, I
am told:

Error: Cannot open the file
C:/msys/1.0/home/bpage/axiom--windows--1/mnt/window
/algebra/compress.daase.
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by SYSTEM:TOP-LEVEL.
Broken at APPLY.  Type :H for Help.
BOOT

What is going on?  I installed the entire Axiom tree in drive F:, far away
from users' home directories, and both users are administrators.  I suppose,
Bill, that bpage is you?  Then it's all YOUR fault!  (Just kidding).  But
I would like to know how to get around this behaviour.

Thanks,
Alasdair

___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail





___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] AXIOM documentation

2007-06-20 Thread Bill Page
 and mixing old terminology here
without making this much clearer. I recommend trying to use the terms
as defined in the Aldor documentation.


I have not yet worked out how to refine a domain.  There is a hint on
page 14 of the book: Complex(R) defines its exports with
   Ring with ... if R has Field then Field ...


Complex is a domain constructor, i.e. a function that returns a domain
as a result.


The precompiled distribution doesn't seem to include source code for
built-in categories such as Complex, and I don't know how to get much
further.  I haven't yet found a full account of the syntax used to
declare a category such as Complex.


You should have a 'src' directory that was unpacked when you installed
the binary version of Axiom. If you don't find it, please tell us
exactly what binary version of Axiom you are using and where you
downloaded it.

You might also be interesting in view the Axiom source code on line.
You can do that here:

http://wiki.axiom-developer.org/axiom--test--1

For the Complex domain see:

http://wiki.axiom-developer.org/axiom--test--1/src/algebra/GaussianSpad


 The word
   with
does not have an entry in the Glossary or in bookvol1's index.



You will find this clearly defined in the Aldor documentation.


Please forgive me if these matters have simple answers.  I haven't
read all the documentation, but I have looked at it for a day or so.
This looks like a really powerful package, but learning how to take
full advantage of it is not simple.


I think you are right on both points!

Thank you for sending your notes. I will try to get time to review
them in a little more depth later.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Elliptic curve factoring

2007-07-10 Thread Bill Page

Now, Ralf, don't you go scaring people away by suggesting that we
expect even more from them than just working with Axiom - that is hard
enough as it is! ;-)

Seriously, I think we can develop such documentation as we go. From my
point of view, doing this via the Axiom Wiki makes it very easy.

Regards,
Bill Page.

On 7/10/07, Alasdair McAndrew wrote:

Err, no, I haven't written it up in pamphlet style at all... my version of
Axiom (Timestamp: Wednesday June 21, 2006 at 03:45:56) doesn't seem to come
with any pamphlets.  The '*.spad.dvi files just contain the text of the
*.spad files presented as dvi files.  All I really want to do is to extend
the methods in intfact.spad to include ecm - which the file itself
recommends.

-Alasdair


On 7/10/07, Ralf Hemmecke wrote:
 Why don't you put it just online and send the URL. I hope you have at
 least tried to write that up in a pamphlet style way?

 Ralf

 On 07/10/2007 03:08 PM, Alasdair McAndrew wrote:
  I have written some highly unoptimized code for factoring integers using
  Lenstra's elliptic curve method, with the birthday paradox phase two
  developed by Richard Brent.  Even at this stage, it can factor the
  seventh Fermat number 2^2^7+1 in 352 seconds, as opposed to 1877 seconds
  by the in-built factoring method.  If anybody is interesting in
  developing this code further, do let me know.



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail





___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Getting numerical values from a closed form integration?

2007-07-12 Thread Bill Page

On 12 Jul 2007 12:58:49 +0200, Francois Maltey wrote:

 For example:

 integrate(sin(2*x),x=-%pi/3..4*%pi/7)

 The answer is in closed form, but I can't convert it to a float.  At least:

 integrate(sin(2*x),x=-%pi/3..4*%pi/7)::Float

Try

numeric integrate(sin(2*x),x=-%pi/3..4*%pi/7)

I get 0.20048...


I think that is a good solution. But one thing to keep in mind perhaps
for later use is that often when

 integrate(sin(2*x),x=-%pi/3..4*%pi/7)::Float

fails, the following similar coercion will work

 integrate(sin(2*x),x=-%pi/3..4*%pi/7)::Expression Float

I think the issue is a certain weakness in Axiom's system of coercions.


Don't you find a strong typed CAS is nice for mathematics
even if the final user is a little bored...



Francois, could you expand this comment? I am not sure what point you
are making when you say bored. :-)

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] downloading sources stale?

2007-08-02 Thread Bill Page
On 8/2/07, Oliver Kullmann [EMAIL PROTECTED] wrote:
 I've read through the axiom-book, and it looked quite good, until
 I realised that this anti-syntax like in python is used: That's
 a show-stopper. In principle, of course, such indentation-games
 should be only part of the user-interface, and one should be
 able to go to the level of the real syntax and use brackets
 as usual (or treat it as a different user interface)
  --- but unfortunately I have never seen it, and so I
 fear that also Axiom only accepts input in that indentation-format?


What is anti-syntax? What show does Python stop?


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Axiom commands in LaTeX documents

2007-08-04 Thread Bill Page
On 8/4/07, Alasdair McAndrew wrote:
 Does the axiom.sty file allow for the following construction of an
 axiom command and output in a LaTeX file:

 input command (flushleft, textstyle)
 Axiom output (centred, or left, math typeset)
 Axiom type (flushright, textstyle)


No, unfortunately it does not although we have discussed this before
on the axiom-devel list.

 I could certainly kludge this up myself, but surely a command such as

 \axiom{integrate(x^2,x)}{\frac{1}{3}x^3}{Type: Polynomial Fraction Integer}

 should do it all.  Actually, from within emacs, it should be possible
 to call such a command as

 \axiom{integrate(x^2,x)}

 and have Axiom itself compute the output and complete the command.


A LaTeX interface like this is available for Sage and is used on the
Axiom Wiki to produce output from Sage on web pages and in pamphlet
files. See for example:

http://wiki.axiom-developer.org/SandBoxSagePamphlet
http://wiki.axiom-developer.org/AboutSage

Sage in turn can interface with Axiom and so Axiom output can be
produced this way. But something very similar to this that only
generated Axiom output should be quite easy to write. If you are able
to kludge this up for Axiom I think that would be great and would be
immediately useful for the Axiom pamphlet files on the wiki.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


[Axiom-mail] Re: Axiom / guess / sage

2007-08-16 Thread Bill Page
On 8/15/07, Paul-Olivier Dehaye [EMAIL PROTECTED] wrote:
 Hi,
 How do I do some of the more advanced examples given at
 http://wiki.axiom-developer.org/GuessingFormulasForSequences
 under SAGE?

 If tmp is a sequence of SAGE rational functions, I tried:

 sage: tmp_axiom = axiom(tmp)
 sage: tmp_axiom.guessRec()
   []

This is just telling you the guess found no answer to the problem you
gave it terms of a recursive formula.

Here is an example that will yield a simple result:

sage: tmp=[1/x^i for i in range(5)]
sage: tmp?
Type:   list
Base Class: type 'list'
String Form:[1, 1/x, 1/x^2, 1/x^3, 1/x^4]
Namespace:  Interactive
Length: 5
Docstring:
list() - new list
list(sequence) - new list initialized from sequence's items

The more interesting way of interacting with Axiom is by having Sage
automatically convert Sage expressions to Axiom expressions. This is
what happens when you leave out the quotes.

sage: tmp_axiom=axiom(tmp)
sage: tmp_axiom?
Type:   AxiomElement
Base Class: class 'sage.interfaces.axiom.AxiomElement'
String Form:[1,1/x,1/(x*x),1/x**3,1/x**4]
Namespace:  Interactive
Length: 5
Docstring:
[1,1/x,1/(x*x),1/x**3,1/x**4]

So 'tmp' above is a Sage list, but when we pass it to axiom as far as
Sage is concerned it becomes an AxiomElement.

But inside Axiom it a member of a specific Axiom domain (type):

sage: tmp_axiom.type()
List Fraction Polynomial Integer

'List Fraction Polynomial Integer' is the domain of rational functions
with integer coefficients.

Now we can operate on it using guessRec:

sage: tmp_axiom.guessRec()
  [[function= [f(n): - x f(n + 1) + f(n)= 0,f(0)= 1],order= 0]]


 sage: tmp_axiom.guess([guessRat], [guessSum, guessProduct])
 ---
  type ' exceptions.NameError' Traceback (most recent call last)

 /Users/pdehaye/ipython console in module()

 type 'exceptions.NameError': name 'guessRat' is not defined

 It s not clear to me how the syntax works...


The problem here is to keep track of when you are talking directly to
Axiom and when you are using native Sage syntax.  Of course any
expression that is acceptable to Axiom can be passed between quotes
like this:

  axiom(' ... ')

The quotes tell Sage not to interpret the contents, but rather just
pass it directly to Axiom. Axiom does some computation and creates a
Sage object which Sage then asks Axiom to display (or saves it a
variable without displaying it).

guessRat, guessSum and guessProduct are names known to Axiom but not
to Sage, so they must appear inside quotes ' ... '. We can define
these names for Sage like this:

sage: guessRat=axiom('guessRat')
sage: guessSum=axiom('guessSum')
sage: guessProduct=axiom('guessProduct')

Now we can call Axiom just as you wrote above:

sage: tmp_guess = tmp_axiom.guess([guessRat], [guessSum, guessProduct])
sage: tmp_guess

   - n
  [[function= x   ,order= 0]]

sage: tmp_guess?
Type:   AxiomElement
Base Class: class 'sage.interfaces.axiom.AxiomElement'
Namespace:  Interactive
Length: 1

sage: tmp_guess.type()
List Record(function: Expression Integer,order: NonNegativeInteger)
sage:

Notice that the result is a rather complex Axiom domain consisting of
a list of records consisting of two fields named, 'function' and
'order'.

Currently there are some limitations in Sage concerning convenient
access to fields within an Axiom Record but this is Python so we can
easily extend the AxiomElement class:

sage: def Record(self,n):
: return axiom('%s.%s'%(self.name(),n))
:
sage: setattr(sage.interfaces.axiom.AxiomElement,'Record', Record)

Then we can write:

sage: tmp_guess[1].Record('function')

   - n
  x

Or as a property:

sage: sage.interfaces.axiom.AxiomElement.function =
property(fget=lambda self: axiom('%s.function'%self.name()))

which is less generic but perhaps looks nicer:

sage: tmp_guess[1].function

   - n
  x

As this becomes more clear, I hope that we will be able to write some
documentation about how to use Guess and some of the other packages in
Axiom.

 Also:
 sage: axiom.help('guess')
 AXIOM shell variable has no value. using current directory
 unable to find the file compress.daase
 Help system not available.

 but that s on your todo list, right?


Yes it is. Axiom has several ways to do this and I am experimenting. I
will have an new update for 'axiom.py' in the next few days that has
something that works.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Axiom Wiki and Portal are moving

2007-11-01 Thread Bill Page
On 01 Nov 2007 12:54:00 -0500, Gabriel Dos Reis wrote:
 Bill Page [EMAIL PROTECTED] writes:

 | new sites now. They can be found at:
 |
 | http://axiom-wiki.newsynthesis.org
 |
 | and
 |
 | http://axiom-portal.newsynthesis.org

 What will happen to the email [EMAIL PROTECTED]


Right now on 'axiom-developer.org' email sent to
'[EMAIL PROTECTED]' containing a prefix in the subject
line such as

  Subject: [Moving] ...

is automatically added as a comment to the page named 'Moving' on the
Axiom Wiki. This works well for people who are subscribed to the wiki
so that that receive notices of new pages and edits with this same
return address.

This includes Names that begin with numbers, eg. [187 trouble with
tuples] which refer to issue tracker reports.

Doing this requires a special alias in the configuration of sendmail
on the server to pipe the content of the email to a particular method
called 'mailin' at the wiki url. I have not yet asked William Stein if
he is willing to allow this sort of 'mailin' processing on the
'sage.math.washington.edu' server. If so, then we can at least
temporarily redirect the old email address to the new one at for
example: '[EMAIL PROTECTED]'

Alternatively we could just redirect '[EMAIL PROTECTED]'
to some appropriate mailing list.

Any preferences?

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] I can't get the latex file for AxiomEmacsMode with noweb

2007-11-21 Thread Bill Page
On 11/21/07, Ralf Hemmecke wrote:
 ...
 Francois, you can look at a precompiled file... (click on pdf)

 http://axiom-wiki.newsynthesis.org/AxiomEmacsMode


 Bill, why is that 

 http://axiom-wiki.newsynthesis.org/images/AxiomEmacsMode.tex

 ERROR ...


Sorry, I have corrected this problem and the link should be ok now.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


[Axiom-mail] Axiom Wiki and Axiom Portal

2007-11-24 Thread Bill Page
Dear Axiom Fans,

The move of the Axiom Wiki and the Axiom Portal that was announced
last month is now nearly complete. Monday, November 26 is the official
date for the release of the new Axiom Wiki:

  http://axiom-wiki.newsynthesis.org

and the new Axiom Portal

  http://axiom-portal.newsynthesis.org

which is now hosted on the Sage server operated by William Stein at
the University of Washington. On Monday the old urls:

  http://wiki.axiom-developer.org  ** obsolete **

and

  http://portal.axiom-developer.org   **obsolete **

will be automatically re-directed to the new sites. Later that week,
all wiki and portal files will be removed from the axiom-developer.org
server. Tim Daly has plans that he will announce separately for
re-allocating resources on this server to focus on the goals of the
original Axiom project.

The new site is intended to support all three Axiom-related projects
(the original project plus OpenAxiom and the FriCAS forks), as well as
Aldor as a library compiler for Axiom. In addition to Axiom the wiki
and portal include interfaces for Reduce, Maxima and Sage. It also
supports pages containing noweb literate programs (pamphlets) and
graphics generated by graphviz.

All bug reports and issues from the old wiki site have been
transferred to the new site and an updated version of the customized
Topic navigation has been implemented at the new site (left sidebar).
The only feature that has not (yet) been implemented at the new site
is the point-and-click assistant extension of the edit and comment
forms. I am not certain whether this feature is really desirable since
in increases the size and there for the rendering time of every page
on the site. I would be glad to receive opinions about this.

If find any of your favorite pages from the old site are missing at
the new site, there is still time to transfer the page source from old
to the new. If you need help with doing this just let me know. Some of
the pages on the new axiom-wiki site do not yet reflect the current
state of the Axiom-related projects. Your help in updating the pages
at the new axiom-wiki site would be greatly appreciated.

If your were registered as a user of the old Axiom Portal site, your
account has *not* been automatically transferred to the new site. If
you have some files or other content that you wish to preserve and
transfer to the new site, please register at the new site:

  http://axiom-portal.newsynthesis.org

and if necessary ask me for help in transferring the content.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] download

2008-01-02 Thread Bill Page
http://axiom-wiki.newsynthesis.org
http://axiom-developer.org

On 12/27/07, suzanne molnar [EMAIL PROTECTED] wrote:




 How do I get a download of axiom?
 ___
 Axiom-mail mailing list
 Axiom-mail@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/axiom-mail





___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [fricas-devel] Re: [Axiom-mail] A simple question

2008-02-02 Thread Bill Page
On 2/2/08, Alasdair McAndrew [EMAIL PROTECTED] wrote:
 Actually,

 for n in 10..30 repeat output [n::String, factor(2^n-1)]

 is probably the simplest.


Although this apparently produces the effect that you wanted I think
it is also a very poor notation to achieve this effect. To understand
why it is a bad choice you need to understand how Axiom assigns types
to various objects - this is very complicated and often quite
unexpected - even when it works. The problem is finding a good way to
write this that always works the way you expect.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [fricas-devel] Re: [Axiom-mail] Setting elements in a matrix

2008-02-29 Thread Bill Page
On 2/29/08, Ralf Hemmecke wrote:

  On 02/29/2008 09:27 AM, Martin Rubey wrote:
make SQMATCAT inherit from MATCAT.


 I am sure you don't want that.

  We have

  MatrixCategory(R,Row,Col): Category == Definition where
R   : Ring
Row : FiniteLinearAggregate R
Col : FiniteLinearAggregate R

Definition == TwoDimensionalArrayCategory(R,Row,Col) with
   ...
   coerce: Col - %
   transpose: Row - %
   horizConcat: (%,%) - %
   vertConcat: (%,%) - %
   ...
 There are even more functions that allow the result to be a
 non-square matrix.

Perhaps I am missing something but I do not understand why you think
that if MatrixCategory is used in the definition of SquareMatrix that
these operations would result in a non-square matrix.

% means this *domain* , not this category.


  SquareMatrix *should not* inherit from MatrixCategory!!!


That does not make any sense. Surely a SquareMatrix (no matter exactly
whatever that is) is a sub-type of MatrixCategory (whatever that is).
So it makes perfectly good sense for SquareMatrix to be a sub-category
of MatrixCategory category.

 The better way would be to factor out a subcategory that doesn't
 change the structure of the matrix and let SquareMatrix and
 MatrixCategory inherit from that.


I do not see any structure of SquareMatrix that is in conflict with
MatrixCategory. SquareMatrix is just something that has more
structure, i.e. it has some more operations and some of the inherited
operations become degenerate (since nrows=ncols). It seems to me that
this is quite normal in the Axiom library.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] LLL-Algorithm

2008-05-21 Thread Bill Page
http://en.wikipedia.org/wiki/LLL_algorithm

On Wed, May 21, 2008 at 2:30 PM, Martin Rubey wrote:
 Andreas Klein [EMAIL PROTECTED] writes:

 Hello.

 I hope this is the right address.

 Has Axiom implemented the LLL-algorithm?

 not yet, but it would be wonderful if you (or somebody) did.  It would make a
 great counterpart for my guessing package...

 http://en.wikipedia.org/wiki/Lenstra?Lenstra?Lov

???


 has a list of implementations.  Maybe it's easiest to take an existing one and
 link it to axiom.



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Drawing two curves at once?

2008-05-29 Thread Bill Page
Alasdair,

You could try something like this:

draws(s,p,t) == (_
  vp:TwoDimensionalViewport:=viewport2D(); _
  for i in 1..#s repeat putGraph(vp,getGraph(draw(s.i,p,t),1),i::PI); _
  makeViewport2D(vp) _
)

draws([sin(x),x-x^3/6],x=-2*%pi..2*%pi,[])

draws([sin(x)^2, cos x], x=-3..3, title==Example 2)

Regards,
Bill Page.

On Thu, May 29, 2008 at 8:29 PM, Alasdair McAndrew wrote:
 Is there an easier way, in Axiom, of drawing two curves on the same set
 of axes than with the getGraph, putGraph and makeViewport2D commands?
  It would be nice (for me!) simply to be able to enter, say

 draw([sin(x),x-x^3/6],x=-2*%pi..2*%pi)

 and have the graphs of both functions in the list drawn on the same axes.
 But Axiom doesn't seem to support this syntax.

 Thanks,
 Alasdair



___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Two hyperdoc questions

2008-07-09 Thread Bill Page
On Wed, Jul 9, 2008 at 7:03 PM, Alasdair McAndrew [EMAIL PROTECTED] wrote:
 1) Is it possible to configure hyperdoc so that it responds to the mouse
 wheel for scrolling?

See Experimental support of the mouse wheel in Hyperdoc at

http://lists.nongnu.org/archive/html/axiom-developer/2006-11/msg00411.html

(I haven't tried the patch.)

 2) Is it possible to configure hyperdoc so that a search can be initiated
 simply by pressing return, rather than by clicking the Search link?

Probably a small programming change but what should happen if there is
more than one link on a page?

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] A little simplification problem

2008-08-01 Thread Bill Page
On Fri, Aug 1, 2008 at 10:18 AM, Alasdair McAndrew wrote:

 f(n)==7^n
 f(n+1)-7*f(n)
 simplify(%)

 What do I need to do to enable the final statement to produce 0?


You might use a pattern like this:

(1) - f(n)==7^n
Type: Void
(2) - f(n+1)-7*f(n)

 n + 1  n
   (2)  7  - 7 7
 Type: Expression Integer

(3) - expandPowers := rule x^(n+1) == x*x^n

 n + 1   n
   (3)  x  == x x
Type: RewriteRule(Integer,Integer,Expression Integer)

(4) - expandPowers( %% 2)

   (4)  0
 Type: Expression Integer

-

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] Programming with BTREEs.

2009-04-06 Thread Bill Page
Simon,

Here is one solution:

(1) - )r treelist.input

buildTree(lst:List Any):BTREE(Any) == binaryTree( _
(car dom(lst.1)='List::SExpression = buildTree(lst.1); _
 binaryTree(lst.1)),_
lst.2,_
(car dom(lst.3)='List::SExpression = buildTree(lst.3);_
binaryTree(lst.3)))

   Function declaration buildTree : List Any - BinaryTree Any has been
  added to workspace.
Type: Void

(2) - treeList := [e,[5,1],[[a,[1,1],b], [1,1], [c,[1,2],d]]]

   (2)  [e,[5,1],[[a,[1,1],b],[1,1],[c,[1,2],d]]]
Type: List Any

(3) - buildTree(treeList)

   (3)  [e,[5,1],[[a,[1,1],b],[1,1],[c,[1,2],d]]]
 Type: BinaryTree Any

---

'Any' is a very special type in Axiom. It is probably not a good place
to start to learn about types - or maybe it is if you can tolerate the
complexity of this answer :-)

Explanation:

Overloaded function names are not supported in the Axiom interpreter.
They are only available when writing in the library compiler language
called SPAD. But even if you wrote in SPAD, the function as you wrote
it originally would not work because in SPAD, types are static - that
is they are decided at the time you compile the program, not at the
time you run it. What you wrote requires dynamic type.

The type 'Any' is used to dynamically encapsulate values of any type
as a single type and that way avoid much of the type-checking
mechanism that would otherwise make this sort of routine rather
awkward. It is sometimes referred to in computer science literature as
duck typing.

There are several ways to query the real type of the value
encapsulated as a value of type Any. This can be done by the function
'dom' which returns something in Lisp form called an s-expression.
In the case of a value of type List, the first component of the
s-expression (obtained by the function 'car') is the literal symbol
List.

The way to read the expression:

(car dom(lst.1)='List::SExpression = buildTree(lst.1); _
 binaryTree(lst.1)),_

is:

   Check if the first item in lst is a List.
   If it is, call 'buildTree' recursively with the value.
   Otherwise call 'binaryTree' with the value.

Ref:

(4) - )show Any
(4) - )show SExpression

Regards,
Bill Page.

On Mon, Apr 6, 2009 at 9:55 PM, Simon Blomberg s.blombe...@uq.edu.au wrote:
 Hi,

 I sent a message asking for help a couple of weeks ago. Thanks to those who
 responded. I have a more concrete question:

 I am trying to write a simple recursive function to build binary trees from
 a List object. My test tree is the following:

 treeList := [e,[5,1],[[a,[1,1],b], [1,1], [c,[1,2],d]]]

 Each nested level contains a list of three elements, which are to become the
 left branch, value, and right branch of the tree, respectively. For internal
 nodes, the value of the tree is a two-element list representing the left-
 and right branch lengths. The leaves of the tree are to be binary trees with
 a Symbol as the value (a to e) and empty left - and right branches. Here is
 my code:

 buildTree(lst: List Any):BTREE(Any) == binaryTree(buildTree(lst.1), lst.2,
 buildTree(lst.3))
 buildTree(val:Symbol):BTREE(Any)  == binaryTree(val)

 However, calling buildTree(treeList) doesn't work. The second rule
 overwrites the first rule, even though the arguments are of different types.
 I'm still getting my head around how types are specified in Axiom, so any
 assistance would be greatly valued.

 Thanks in advance,

 Simon.

 Simon Blomberg, BSc (Hons), PhD, MAppStat.
 Lecturer and Consultant Statistician
 School of Biological Sciences
 The University of Queensland
 St. Lucia Queensland 4072
 Australia
 T: +61 7 3365 2506
 email: S.Blomberg1_at_uq.edu.au
 http://www.uq.edu.au/~uqsblomb/

 Policies:
 1.  I will NOT analyse your data for you.
 2.  Your deadline is your problem.

 The combination of some data and an aching desire for
 an answer does not ensure that a reasonable answer can
 be extracted from a given body of data. - John Tukey.


 ___
 Axiom-mail mailing list
 Axiom-mail@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/axiom-mail




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


[Axiom-mail] Re: [fricas-devel] Re: InputForm

2009-06-03 Thread Bill Page
On Wed, Jun 3, 2009 at 10:20 AM, Martin Rubey wrote:

 Bill Page writes:
 Note also that

   y^2+x

 is not syntactically identical to the input

   x+y^2

 I wonder why FriCAS changes the order?

 Because the semantics is the same.

Yes, thanks. Now I understand. In the expression:

  (x+y^2 )::INFORM

'(x+y^2 )' is first  fully interpreted by Fricas as a polynomial and
only then does it coerce (convert?) the result back to InputForm. To
do what I expected I guess one could write:

(1) - unparse(parse(x+y^2)$InputForm)

   (1)  x+y^2
 Type: String

Then no semantics are involved but if invoke the interpreter explicitly

(2) - unparse(interpret(parse(x+y^2)$InputForm)::INFORM)

   (2)  y^2+x
 Type: String

then of course I get the result you showed.

 Currently, + is always commutative I think, but compare:

 (18) - a:XPOLY INT := y*x

   (18)  y x 1
                                    Type: XPolynomial(Integer)
 (19) - b:POLY INT := x*y

   (19)  x y
                                    Type: Polynomial(Integer)

 well, embarassingly enough, there is no INFORM for XPOLY :-(


Of course there should be such a coercion.

You are right that the result depends on the domain chosen by the interpreter.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [fricas-devel] Re: [Axiom-mail] InputForm

2009-06-04 Thread Bill Page
On Thu, Jun 4, 2009 at 4:43 PM, Gabriel Dos Reis wrote:
 ...
 I would reserve the use of InputForm for syntatic canonical
 forms of mathematical objects.


Currently InputForm values can arise both from parsing of input
strings and from coercion of values from other domains. Only the
latter are in some sense cononical. But even these are only
cononical to the degree that the domain from which they are derived
has such properties.  So it is not clear to me how one can hope to
reserve InputForm for only this use.

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [fricas-devel] Re: [Axiom-mail] InputForm

2009-06-04 Thread Bill Page
 | On Thu, Jun 4, 2009 at 4:43 PM, Gabriel Dos Reis wrote:
 |  ...
 |  I would reserve the use of InputForm for syntatic canonical
 |  forms of mathematical objects.
 | 
 | Bill Page wrote:
 | Currently InputForm values can arise both from parsing of input
 | strings and


On Thu, Jun 4, 2009 at 9:48 PM, Gabriel Dos Reis wrote:

 That is the job of Syntax domain in OpenAxiom.


Although it sounds logical and desirable, I suppose that direct
conversion of values in the Syntax domain to canonical values in
InputForm is a rather hard problem. No?

I am tempted to argue in fact that the primary purpose of most of the
rest of panAxiom is to do just this sort of conversion - through the
algebraic back door so-to-speak ...

Regards,
Bill Page.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] A question about Axiom capabilities, Fwd: [fricas-devel] Abstract Vector Algebra

2013-03-29 Thread Bill Page
See:

https://www.researchgate.net/publication/220915895_Rule-Based_Simplification_in_Vector-Product_Spaces

There has been some work done on this subject in one of the Axiom forks:

-- Forwarded message --
From: someone someb...@bluewin.ch
Date: 27 October 2012 21:07
Subject: Re: [fricas-devel] Abstract Vector Algebra
To: fricas-de...@googlegroups.com


 I started making a small package for component-free vector algebra. It
 is based on the work Rule-Based Simplification in Vector-Product
 Spaces written by Songxin Liang and David J. Jeffrey.

I made some real progress with the code. In the most up to date
version it can do many non-trivial problems. For example:

(122) - simplify( (va-vd)^(vb-vc) + (vb-vd)^(vc-va) + (vc-vd)^(va-vb)
- 2*(va^vb + vb^vc + vc^va) )

   (122)  00
 Type: VectorAlgebra(Integer)

I attached the code as well as the examples and some other tests.
You can find the most recent versions of all files in the github repo at:

https://github.com/raoulb/fricas_code/blob/vectoralg/vecalg/

--
You received this message because you are subscribed to the Google
Groups FriCAS - computer algebra system group.
To post to this group, send email to fricas-de...@googlegroups.com.
To unsubscribe from this group, send email to
fricas-devel+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.




-- Forwarded message --
From: Raoul rao...@bluewin.ch
Date: 29 March 2013 19:42
Subject: Re: [Axiom-mail] A question about Axiom capabilities
To: u1204 d...@axiom-developer.org, axiom-mail@nongnu.org


Dear Tim,


 If you look at the matrixcookbook that Mike mentioned, the first 10
 equations are:

(A*B)^-1  = B^-1 * A^-1
(A*B*C...)^-1 = ...C^-1 * B^-1 * A^-1
(A^T)^-1  = (A^-1)^T
(A+B)^T   = A^T + B^T
(A*B)^T   = B^T * A^T
(A*B*C...)^T  = C^T * B^T *A^T
(A^H)^-1  = (A^-1)^H
(A+B)^H   = A^H + B^H
(A*B)^H   = B^H * A^H
(A*B*C...)^H  = ...C^H * B^H * A^H

Yes, I know this book very well. It would be indeed nice
if Axiom could do such things in an abstract fashion.


 It seems like we could create a SymbolicMatrix algebra that could
 perform these manipulations with uninterpreted matrix symbols
 A, B, C with a special recognized symbol 'T'.

I think it would be possible, however I expect representation of
abstract matrix algebra to be much more complicated than the
vector algebra stuff. There are transposes, conjugates, inverses,
traces, determinants and much more. One would need to have a way
to encode all these operation unevaluated.


 These matrices could have actual values which, for certain operations
 are ignored, so that

(A*B)^-1  = B^-1 * A^-1

 but for other operations would be evaluated as in:

eval(B^-1 * A^-1)

 giving the actual matrix result shown element by element.

Yes, of course this should play together with usual
(dense or sparse) matrices nicely. Doesn't make the task
easier though.

And do we want define abstract matrices with or without shape information?


 An additional enhancement would be to make a SymbolicMatrixCategory
 so that there could be specific domains such as

GeneralSymbolicMatrix,
SymmetricSymbolicMatrix,
UpperTriangularSymbolicMatrix,
DiagonalSymbolicMatrix,

 etc which could exploit certain matrix-level properties at the
 symbolic level.

Maybe someone should indeed try. I don't think I find the
time to try this soon.


It occurred to me that component-free geometric algebra
might be easier to start with anyway.

There is a nice book on the topic:

  https://sites.google.com/site/grassmannalgebra/
  https://sites.google.com/site/grassmannalgebra/thegrassmannalgebrabook

which is accompanied by a Mathematica Package (that I never tried so far):

  https://sites.google.com/site/grassmannalgebra/thegrassmannalgebrapackage

The algebra in there is as far as I remember not done in an
abstract way, but with explicit bases.


-- Raoul

___
Axiom-mail mailing list
Axiom-mail@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-mail


examples.input
Description: Binary data


tests.input
Description: Binary data


VA.spad
Description: Binary data
___
Axiom-mail mailing list
Axiom-mail@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] [fricas-devel] Using a polynomial inside a function

2015-11-16 Thread Bill Page
Alasdair,

Here is one solution:

(1) -> )r alas1.input

mult(xs:List Expression Integer):Expression Integer == reduce(*,[x-z for z
in xs])

   Function declaration mult : List(Expression(Integer)) -> Expression(
  Integer) has been added to workspace.
   Type:
Void

intm(xs,a,b) == integrate(mult(xs),x=a..b)

   Type:
Void
(3) -> mult([x1,x2])

   Compiling function mult with type List(Expression(Integer)) ->
  Expression(Integer)

 2
   (3)  (x1 - x)x2 - x x1 + x
Type:
Expression(Integer)
(4) -> intm([x1,x2,x3],1,2)

   Compiling function intm with type (List(OrderedVariableList([x1,x2,
  x3])),PositiveInteger,PositiveInteger) -> Union(f1:
  OrderedCompletion(Expression(Integer)),f2: List(OrderedCompletion
  (Expression(Integer))),fail: failed,pole: potentialPole)

((- 12x1 + 18)x2 + 18x1 - 28)x3 + (18x1 - 28)x2 - 28x1 + 45
   (4)  ---
 12
  Type: Union(f1:
OrderedCompletion(Expression(Integer)),...)

Bill Page.


On 16 November 2015 at 19:39, Alasdair McAndrew <amc...@gmail.com> wrote:

> Here's a minimum (non)-working example: I have a function which returns a
> polynomial:
>
> mult(xs)==
>   return(reduce(*,[x-z for z in xs]))
>
> and I have another function which needs such a polynomial:
>
> intm(xs,a,b)==
>   g:=(x:Float):Float+->mult(xs)
>   return(numeric(integrate(g(x),x=a..b)))
>
> which doesn't work.  I've tried replacing the second line with
>
>   function(mult(xs),g,x)
>
> which works on the command line, but not in a function.  Any ideas as to
> how I can get over this hump?
>
> ever confused,
> Alasdair
>
> --
> [image: http://www.facebook.com/alasdair.mcandrew]
> <http://www.facebook.com/alasdair.mcandrew> [image:
> https://plus.google.com/+AlasdairMcAndrew/posts]
> <https://plus.google.com/+AlasdairMcAndrew/posts> [image:
> https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108]
> <https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108> [image:
> https://twitter.com/amca01] <https://twitter.com/amca01> [image:
> http://numbersandshapes.net] <http://numbersandshapes.net>
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fricas-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to fricas-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
>
___
Axiom-mail mailing list
Axiom-mail@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] [fricas-devel] Problem with displayed digits

2015-11-14 Thread Bill Page
I can't reproduce this with the following simple example.  Could you be
more specific?

(1) -> outputFixed(2)
   Type:
Void
(2) -> %pi::Float

   (2)  3.14
  Type:
Float
(3) -> outputFixed(20)
   Type:
Void
(4) -> %pi::Float

   (4)  3.1415926535_8979323846
  Type:
Float
(5) ->

Bill.


On 14 November 2015 at 06:39, Alasdair McAndrew  wrote:

> I have a curious problem: a while ago I entered
>
> outputFixed(2)
>
> so as just to get a brief idea of the size of things, without cluttering
> up the screen with digits.  But now I want to get full display back.
> However:
>
> outputFixed(20)
>
> or even
>
> outputFixed()
>
> has no effect - no matter what I do, my displayed floating point output is
> stuck at 2 decimal places.  I know I could quit and start again, but is
> there some way of (a) finding out what setting is causing this behaviour,
> and (b) stopping it?
>
> Ever confused,
> Alasdair
>
> --
> [image: http://www.facebook.com/alasdair.mcandrew]
>  [image:
> https://plus.google.com/+AlasdairMcAndrew/posts]
>  [image:
> https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108]
>  [image:
> https://twitter.com/amca01]  [image:
> http://numbersandshapes.net] 
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fricas-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to fricas-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
>
___
Axiom-mail mailing list
Axiom-mail@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-mail