7.1 Advantages
GiNaC has several advantages over traditional Computer
Algebra Systems, like
-
familiar language: all common CAS implement their own proprietary
grammar which you have to learn first (and maybe learn again when your
vendor decides to `enhance' it). With GiNaC you can write your program
in common C++, which is standardized.
-
structured data types: you can build up structured data types using
struct
s or class
es together with STL features instead of
using unnamed lists of lists of lists.
-
strongly typed: in CAS, you usually have only one kind of variables
which can hold contents of an arbitrary type. This 4GL like feature is
nice for novice programmers, but dangerous.
-
development tools: powerful development tools exist for C++, like fancy
editors (e.g. with automatic indentation and syntax highlighting),
debuggers, visualization tools, documentation generators…
-
modularization: C++ programs can easily be split into modules by
separating interface and implementation.
-
price: GiNaC is distributed under the GNU Public License which means
that it is free and available with source code. And there are excellent
C++-compilers for free, too.
-
extendable: you can add your own classes to GiNaC, thus extending it on
a very low level. Compare this to a traditional CAS that you can
usually only extend on a high level by writing in the language defined
by the parser. In particular, it turns out to be almost impossible to
fix bugs in a traditional system.
-
multiple interfaces: Though real GiNaC programs have to be written in
some editor, then be compiled, linked and executed, there are more ways
to work with the GiNaC engine. Many people want to play with
expressions interactively, as in traditional CASs. Currently, two such
windows into GiNaC have been implemented and many more are possible: the
tiny
ginsh
that is part of the distribution exposes GiNaC's
types to a command line and second, as a more consistent approach, an
interactive interface to the Cint C++ interpreter has been put together
(called GiNaC-cint) that allows an interactive scripting interface
consistent with the C++ language. It is available from the usual GiNaC
FTP-site.
-
seamless integration: it is somewhere between difficult and impossible
to call CAS functions from within a program written in C++ or any other
programming language and vice versa. With GiNaC, your symbolic routines
are part of your program. You can easily call third party libraries,
e.g. for numerical evaluation or graphical interaction. All other
approaches are much more cumbersome: they range from simply ignoring the
problem (i.e. Maple) to providing a method for `embedding' the
system (i.e. Yacas).
-
efficiency: often large parts of a program do not need symbolic
calculations at all. Why use large integers for loop variables or
arbitrary precision arithmetics where
int
and double
are
sufficient? For pure symbolic applications, GiNaC is comparable in
speed with other CAS.