An example where Axiom/FriCAS excels?

308 views
Skip to first unread message

Alasdair

unread,
Jun 22, 2014, 8:14:00 AM6/22/14
to fricas...@googlegroups.com
Hello,

I've been invited to give a little talk to some people about FOSS mathematical tools (mainly computer algebra systems like Axiom, Maxima, Sage), and numerical systems like Scilab, GNU Octave.  Of all the CAS's out there, Axiom is the only one (to my knowledge) which is still alive, so to speak, and which embodies strong typing.  Most CAS's, like Maple and Mathematica, I've seen described as "term rewriting" engines; and types don't enter into them.  What I'm looking for is an example of a fairly elementary problem (one that most mathematicians and university mathematics teachers could relate to) in which Axiom's type system provides the means for a simple and elegant solution, and which for less strongly typed systems would be difficult.

I did see something once, but naturally I've forgotten what it was, or where I saw it.

Anyway, if anybody has any ideas, do please let me know!

many thanks,
Alasdair

Waldek Hebisch

unread,
Jun 22, 2014, 10:11:25 AM6/22/14
to fricas...@googlegroups.com
Alasdair wrote:
>
> I've been invited to give a little talk to some people about FOSS
> mathematical tools (mainly computer algebra systems like Axiom, Maxima,
> Sage), and numerical systems like Scilab, GNU Octave. Of all the CAS's out
> there, Axiom is the only one (to my knowledge) which is still alive, so to
> speak, and which embodies strong typing. Most CAS's, like Maple and
> Mathematica, I've seen described as "term rewriting" engines; and types
> don't enter into them. What I'm looking for is an example of a fairly
> elementary problem (one that most mathematicians and university mathematics
> teachers could relate to) in which Axiom's type system provides the means
> for a simple and elegant solution, and which for less strongly typed
> systems would be difficult.

Long ago I needed to compute a resultant. I had two polynomials
with rational coefficients, something like a^(-2)*x^2 + b.
I tried to use Maxima and Maxima kept treating my polynomials
as rational functions which lead to nonsense result.
In Axiom/FriCAS I can use types to say exactly what I want.
That said I do not think types make essential differences
for naive users. Namely, users need adequate control on
performed computations. Sometimes this may be done via
explicit types. But similar effects can be obtained
via hidden types. And even in completely untyped system
one can have options which force treatement of arguments
in specific way.

For me types give systematic understanding of the system.
In Axiom/FriCAS when you type 'a + b' system looks at
types of 'a' and 'b' and chooses '+' apriopriate for
given types. Intepreter may coerce arguments to get
matching types, but once types are known there is
little extra choice. In other systems some arguments
may get same special treatment. In some sense other
systems are much more flexible. But for the same
reason are harder to understand.

Personally I think that types became useful once users
write their own programs. AFAICS users releatively
quickly realize that they can do a lot by writing
small programs. And here types help avoiding errors.

The subject was "An example where Axiom/FriCAS excels?".
I think that one should not put too much emphasis on
types. More precisely, types are part of system design
and IMO main advantages are indirect. One property
of Axiom/FriCAS is that basically all mathematical
capabilities are coded in Spad which in turn is
essentially the same as language user use for everyday
interaction with the system. This is possible because
Spad gives reasonable speed and getting speed without
types would be quite hard.

I would rather stress thing that FriCAS does very well.
For example in 'sci.math.symbolic' was a disscussion
of "hard" integrals proposed by Charlwood. AFAIK
FriCAS is the only free system which can do all
of first ten (considered the hardest). Note: when
the examples appeared FriCAS could do 8 of 10 and
two examples exposed bugs which are fixed now.
Also, FriCAS is quite good at integrating in terms
of special functions, see for example:

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

On more basic level, FriCAS can frequently compute GCD,
factor polynomials or solve systems of equations that
other systems are unable to do or need excessive time.


--
Waldek Hebisch
heb...@math.uni.wroc.pl

Ralf Hemmecke

unread,
Jun 23, 2014, 7:26:26 AM6/23/14
to fricas...@googlegroups.com
Just some small example...

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

Maybe not convincing, but for me it shows that FriCAS makes it quite
easy to express, what one wants.

In general, I think that most users are still confused by types.
In other words types in an interactive session is something like a
hurdle, but can be useful if used wisely.

However, for library writers, types are a good tool to express ideas
more clearly and prevent unnecessary errors. It also helps to avoid
needless code that checks whether the expression in hand is really of
the form that is wanted for the particular function.

Needless to say that Mathematica and Maple added code that looks like
types in function specification. But in contrast to FriCAS, their stuff
is basically always runtime typechecking. Just a fancy way to avoid
typechecking that otherwise a programmer would have to add explicitly.

Ralf

someone

unread,
Jun 23, 2014, 5:26:47 PM6/23/14
to fricas...@googlegroups.com
Hi,


> Just some small example...
>
> http://axiom-wiki.newsynthesis.org/TypedGcd
>
> Maybe not convincing, but for me it shows that FriCAS makes it quite
> easy to express, what one wants.

A simple but never the less very nice example showing
an important aspect of the Type system.

I tend to think more and more that strong types are very
important as soon as you want to write larger things
or even libraries.

Your example shows that even in interactive computing
Sessions types can be very helpful. I usually make a
simple demonstration like this:

(2) -> p := (2*x^2 + 3*x + 5) / 7

2 2 3 5
(2) - x + - x + -
7 7 7
Type: Polynomial(Fraction(Integer))
(3) -> p :: FRAC(POLY(INT))

2
2x + 3x + 5
(3) ------------
7
Type: Fraction(Polynomial(Integer))

In other CAS Systems one usually needs to call a Function
like "together(...)" on the polynomial. This case is so simple
that one could argue which version is easier or more user friendly.
Reply all
Reply to author
Forward
0 new messages