You should have read the introduction in the manual. (Yeah, I know...) Anyway, the quit command is &q. All
commands to the interpreter start with &. If you just type "quit" the interpreter will very reasonably look for a variable called "quit."
If you wish, you can create a function called Quit (note capital letter) to quit. It would be Function Quit = &q. Note the
period.
Why is this computer algebra system called "Fermat?"
It began as a project (to write an interpreter) in a compiler design course that I was teaching in 1986. To help the students, and to see
just how hard it would be to write an interpreter, I wrote my own version. Since we were using Pascal, I figured Fermat ought to have a
system named after him too. The summer after the course ended, I just kept going.
You mean you wrote the whole thing?
Yes. However, someone who does not want to be named here made significant contributions when Fermat was translated into C.
Who are you?
Short professional biography.
Professor, Mathematics Department, Fordham University, New York, New York. I started out in algebraic topology, but
realized I was intrigued by computational questions. For example, I wanted to find new low dimensional nilpotent spaces by computer
calculations. I obtained a masters degree in computer science from
the University of North Carolina, Chapel Hill. I was intrigued by compiler design, the design of languages, and the idea of computer
algebra before I knew a name for it. Here is my academia web page. Here is my
cv as of January 2016.
Does Fermat run on top of Maple or some other system?
No. Fermat is completely stand-alone. (except for the very old Mac MPW version, which runs as an MPW tool. MPW was a Unix-like development
environment that handled the console input/output. I no longer update the MPW versions. MPW and OS 9 are obsolete.)
There are now web sites that one can go to and find symbolic calculators right there
-- for free! Who needs a stand-alone symbolic package anymore, much less this one?
I've seen some of those sites too. They run Java scripts or something similar. That's fine if you've got a toy problem, say a 6 X 6
determinant. But try entering (much less computing) a 100 X 100 determinant with polynomial entries. Fermat is a state-of-the-art
research tool for real problems.
What is Fermat written in? How big is it?
It was written in Pascal. In July 2003 it was translated into C. It was then about 98,000 lines of C. In 2010 64 bit versions were written. Totalling all the other
versions, and accounting for some duplication of code between the versions, it's about 170,000 lines.
What is Fermat good at?
Fermat is especially good at Smith normal form; polynomial and rational function arithmetic;
determinant, normal forms, and inverse of matrices with multivariate polynomial entries over
Z, Q, Z/p,
finite fields, or more complex fields; sparse matrices; characteristic polynomials; and gcd of
multivariate polynomials over Z, Z/p, or finite fields. In addition, I have striven to make
it easy to use. For
example, it is very easy to edit the output of Fermat (on the screen) and make it the input.
This is a great boon in experiments with matrices. Extensive facilities exist for saving data
to text files and reading such data.
Why Don't You Do Gröbner Bases?
For three reasons.
1. I don't know much about it.
2. Other systems, like Singular and CoCoA, handle it pretty well.
3. I've never needed it in my own work. I have taken instead the resultant approach to solving polynomial equations.
Can I get a quick idea of what this system does?
Yes, to get an overview of the polynomial and matrix features of Fermat, look at
this html version of Appendices 4 - 6 of the Manual. This is the revised manual of July 2011
for Mac OS X, Linux, and now Windows too (November 2011).
What is the hardest thing about writing a computer algebra system?
Discovering and repairing bugs.
Have you published your algorithms for multivariate polynomial gcd?
There really aren't any new algorithms. There are a lot of heuristics to decide when to use ideas like content with respect to lower precedent variables. Update 2017: there are now Zippel-like multivariate GCD algorithms.
Has this system been tested or used very much?
Yes. Many students at Fordham used it in undergraduate and graduate courses. For three summers in the early 1990's I used
it in R.E.U. programs involving some heavy computations. Sixteen R.E.U. students wrote lots of programs in Fermat. I
used it to help my colleague Armand Brumer in number theory research. I used it to answer some questions of Gilbert Baumslag
about "almost free" groups. Recently I and others have used it in computer vision research, rational drug design, operations
research, and computational chemistry. A.V. Smirnov has written software for physics that uses Fermat. These and other users are mentioned on the main web page,
under "Fermat in Actual Use". Many bugs have been found
and improvements made along the way.
The 2008 nomination form for Fermat for the Jenks Prize can be read here.
Why should I use this system?
Because it works. Really. Time and again, it has bested the well known expensive systems in both time and space, often by
enormous, almost unbelievable, ratios. Often other systems can't even load up the data (polynomials) to begin the problem,
given the same amount of RAM as Fermat. If you have serious problems to solve, try Fermat.
How is it that you could write a system that outperforms many big systems?
I can't be sure because I know only one side of the story. Perhaps because Fermat is a small system that doesn't attempt to do everything. Perhaps because
I handle all my own storage allocation and retrieval. Perhaps because of unrelenting attention to detail.
Another reason is that in most large systems, many of the commands are implemented within the system's own language, not a compiled
language like C or Pascal. This is sometimes called "soft coding" or "bootstrapping." For example, in system X, typing "Det" may
invoke a Gaussian elimination program written in X's language, as if a user had written it. This imposes an extra level of
interpretation. Everything in Fermat is written in C, i.e., it is "hard coded".
Can you say a few words about the internal architecture of Fermat?
The basic data item is a rational function over an exact ground ring, Z, Z/pZ, or a couple other finite fields. The polynomials can be
multivariate. They are implemented as linked lists, or multilists. (x+1)^100 is a linked list with 101 nodes. x^100 + 1 has two nodes.
If x has higher rank than y, then (y+2)x^2 + (y^3+2y+1)x + 2y + 3 is a list of lists. At the top level are three nodes corresponding
to x^2, x, and x^0. The coefficient of x^2 is the polynomial y+2, and so on recursively if more variables are present. Virtually
everything in Fermat is a linked list, and most algorithms are heavily recursive. The core of the system is the polynomial gcd algorithm,
which has been relentlessly refined over many years. It is basically mod p interpolation, with Knuth's algorithm C as fall back
for small enough cases. Update 2017: there are now Zippel-like multivariate GCD algorithms.
The 2008 nomination form for Fermat for the Jenks Prize can be read here.
I don't have a Macintosh. What about other platforms?
A Windows95/NT/98/2000/XP/PDQ - whatever - version is available, as of 22 April 1998. As of July 2001 it has an even nicer
interface than the Mac version, thanks to Bill Hastings of Fordham University. As of August 2003 there are Linux and Unix versions.
What is this MPW mentioned in the documentation?
MPW was a development environment (Macintosh Programmer's Workshop) by Apple, sort of like a little operating system. It provided
the user with compilers and a nice interface to invoke the compilers and create software. In particular, it provided a "worksheet"
console window where the user can invoke
commands. The worksheet environment was very nice, nicer than that provided by most (any?) computer algebra systems I've seen.
It was extremely flexible at editing and reentering commands, turning output into input.
OS X, Windows, Linux, and Unix users can ignore any reference to MPW. As of January 2004, I do not update the MPW versions. Like OS 9,
MPW is now obsolete.
That's sad because the interface there was very nice indeed. For a while at least,
MPW was being given away on Apple's webpage. Try ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./
Why are there different versions?
Originally Fermat was one program, one version. The basic data type was rational numbers of unlimited size and precision. As I
used Fermat in teaching, it became clear that there were advantages to the "real" or "float" data type, so I put that in, with
the ability to convert back and forth between types. Then I put in floats with fixed but essentially unlimited precision. Then
I put in a
modular data type, so that one could work efficiently mod p for moderate sized primes.
But after a while, as the algorithms got more sophisticated (such as polynomial gcd algorithms over the integers) it became
cumbersome to have one version with all those types. So I split off different versions. I no longer support or keep up the
original "full" version. However, it is mentioned sometimes in the manual. I do support the rational version Fermat for
Windows, Macs, Linux, and Unix, and the float version FFermat for Mac OS 9.
Update June 2016: The versions mentioned above for OS 9 are obsolete. The Unix version is obsolete (does anyone still use Unix??)
In 2010 I added 64 bit versions for Mac and Linux, which are now the canonical versions. There are also good float versions now.
The Windows version is becoming obsolete, as, frankly, I never use it and no one asked about it in years.
What is Fermat not particularly good at?
If you are doing ONLY uni-variate polynomial arithmetic, you might be better off using NTL or Flint. But if you are putting your
polynomials in matrices, and doing matrix algorithms, even then I would try Fermat.
Note that Fermat will eventually crash if you try to do arithmetic with REALLY REALLY BIG integers. Ironically, this is not the system for investigating factoring
of large Fermat numbers. The largest possible integer here is around 2^850000. That limit could be essentially removed, and made 2^66571993088, or even
2^285924533142498050048.
What about the source code?
On January 19, 2009, I released the Pascal source code for FFermat, the float version. See here. The
source code for the old (now obsolete) Windows version was released on April 17, 2010. See here. The source code for version 6.21 was released in August 2018.
Why is there no 64 bit Windows version?
I had been told that in Windows C you can't do goto. There are three or four very important gotos in the Fermat C code. They implement the
"push and pop" interrupt feature of the interpreter, which is VERY nice to have. They branch a long way though the code, and there is really
no other way to do that. At least, as of November 2011 there is a good 32 bit Windows version thanks to Cygwin.
Anybody want to develop a 64 bit Windows version? Send me an email. It shouldn't be too hard.
Why is there no recent Unix version?
I don't have access to Unix. I wonder if anyone still uses it?
Questions of a More Technical Nature
I run the Linux version, but the backspace key doesn't work. This is very annoying!
That often happens with Red Hat. Try this: before you start Fermat, type: stty erase control/V BACKSPACE ENTER. In other words, after typing "stty erase" and a space,
type control-V (hold control while typing capital V), release control, then hit the backspace key (which should produce ^?), then hit enter. I think this could be put
in a .cshrc.
This problem is well known, and transcends the use of Fermat. Do a web search for "Linux backspace problem."
I tried to run the Linux version, but I get an error message about libraries.
Try ferls instead of ferl. (As of June 2016, only ferls is available here.)
I was running a program and the system crashed.
There are three reasons that come to mind:
1) You were using one of the "dangerous commands" like selective modularmode, and were not careful enough.
2) You wrote a recursive program in Fermat, and were not careful enough about the trival case. A program that calls itself too often will blow out the stack.
3) You found a bug in Fermat! If the problem is reproducible, please send it to me.
I was running the (new) Windows version and it suddenly disappeared! Poof!
That means it crashed. Unlike the other versions, the Windows (Cygwin) version is a stand-alone app. If it crashes, it instantly disappears. See the previous question about crashing.
It could also be that it just ran out of RAM due to the computation you were running. With the other versions, a message will be left on the terminal about "allocation of memory failed."
But here, there is no way to see that message, unless you can read very quickly!
I used Remquot [mod] on some multivariate polynomials but get an odd answer that doesn't seem to be correct.
That is indeed a potential problem. r := Remquot(x, d, q) is designed to produce the (pseudo)quotient and (pseudo)remainder of x divided by d. In other words, d*q + r = co^k*x, where
co is the leading coefficient of d and k is 1 plus the difference in degrees of x and d. However this assumes that x and d have the same highest precedence polynomial variable.
Especially if the highest variable in d is lower than that of x, odd things can happen when co is a polynomial. The same applies to the builtin function mod, signified by the vertical line |. This will be
explained better in the next revision of the manual.
I took a file of Fermat commands and data from Mac to Windows. It worked fine on the Mac, but now I get crazy error messages.
I bet you get:
*** Inappropriate symbol:
expected scalar variable, function, or other factor.
Note that after the colon in the error message, there is "nothing" there -- at least nothing visible. There is probably a "glyph" or "gremlin" in the file. That's a
non-ACSII (or Unicode) character that is harmless on the Mac but not in Windows. It may have been inserted by the Mac OS, or it may have gotten into the file if you cut
and pasted. This can be a huge pain. Use an editor that will display invisibles, or go back to the Mac editor and carefully remove any characters at the end of each line.
In other words, after the last visible chracter on each line, look carefully to see if there is a space there.
I declared a function, it looks fine when I do &F [to display all functions], but it won't execute correctly. I get no error message.
Did you by accident declare it to have the same name as a builtin function? Inside BACKWARD, look at the file Qerrs. Near the end is the list of all builtin functions. If you create a
function named Trace, for example, you will not get an error message. But if you type Trace to execute it, the builtin Trace will execute.
I was running a computation with multivariate polynomials over ground ring Z and I got a "Fermat error".
This is mentioned in the documentation. A sophisticated fast polynomial gcd algorithm sometimes guesses wrong when working over Z with "a lot" of variables.
Turn it off with the command &_t. (This does not happen in the old Windows version or the obsolete OS 9 version.)
I wrote a loop in modularmode and it behaved crazily.
That is probably the "pseudo-negative" problem. It's a feature, not a bug. Let's say you are working modulo the prime 65537, and k has been assigned a value that you
think of as -20. It will display as "-20" if &H is on the default setting. You write a loop like: for i = 1, n+m+k do .... You may be thinking the value is reasonable,
maybe n = 30, m = 50, so n+m+k = 60. No! Remember -20 is really 65517, so n+m+k = 65597 (modding out is not done in loop setup arithmetic). Oops.
I tried the old Windows version but it gives an error message right away.
That old Windows version is obsolete
as of November 2011.
The file FERSTART.TXT should contain the single line &(t=1); No more and no less; delete any weird non-ASCII characters.
I was running the stand-alone version (Mac OS 9), pulled down the File Menu and tried to Quit but nothing happened.
As of January 2010, Classic and OS 9 are completely obsolete.
For some reason, the Quit command on the File Menu has never worked. Remember, Fermat is command-line-driven, not menu-driven. The command to quit is &q. I never use any
of those menus that come with SIOUX.
I was running FFermat and tried to go to a different application using the usual application menu in the upper right of the menu bar.
I clicked in the usual way but nothing happened.
FFermat no longer works on any platform after Mac OS 10.3. As of January 2012, there are new float versions but they have no graphics.
Again, I don't know why that doesn't work. However, at the prompt in FFermat, you can branch to another running application by first clicking on some empty part of the desktop. That
will return you to the Finder.
I tried to run the MPW Fermat but got an error message that a file couldn't be found.
As of January 2009, MPW is completely obsolete, unfortunately ;-(
Make sure that all the auxiliary files are in the Fermat folder, and that the Fermat folder is inside the MPW folder. Use MPW's "set directory" command to set the
directory to be the fermat folder.