You are here

WIMS: An Interactive Mathematics Server - How WIMS Works

Xiao Gang

Server-side vs. Client-side Interactivity

The word interactive is somewhat ambiguous when applied to the web environment, for the html format is already interactive: You click on a link, and you see the page change. So here we usually use the word interactive to mean that some computer program is involved to process users' clicks. In this sense, there exist basically two approaches.

  • First, there is client-side interactivity: Programs, usually Javascript or Java applets, are embedded in the html page, sent to the client, and executed on the client computer by the browser. For example, the site Interactive Mathematics Miscellany and Puzzles contains a large number of such pages.

  • Second, there is server-side interactivity, in which a program installed on the server site processes the client requests. Examples of this method include The Integrator or Mathserv.

Both approaches have their advantages and inconveniences. For server-side interactivity, the main advantage is the power of computation that can be provided by sophisticated background computational software packages. Such computational power is often difficult to achieve by Java applets sent to the client. And the main disadvantage is delay of response, especially when the connection is of limited bandwidth. WIMS is based principally on server-side interactivity, although some of its applications may also incorporate Javascript or Java applets, in particular when high-speed response is needed. And it is specially designed to support mathematical applications.

In order to take full advantage of server-side interactivity, WIMS incorporates interfaces for many mathematical software packages. It may even call several packages in a chain to compute one user request. As a result, we have been able to create applications which can make sophisticated computations, while at the same time being easy to use.

Because of the importance of practice in mathematics learning, we have emphasized online exercises. Use of mathematical software allows generation of random exercises -- for example, in Visual Gauss we generate random unimodular matrices based on LU-decomposition. It also allows computed analysis of user answers -- for example, in Bases there are infinitely many good answers (bases), so each answer is analyzed by PARI/GP instead of being compared with a prepared database of good answers. Software originally designed for local interactive use can also be adapted to power step-by-step exercises -- for example the use of Coq (see Page 5 for detail) in Logicoq.

Mathematical software is also used to power online computational or visual tools designed to provide online help for the exercises. But these tools can also be used as stand-alone ones.

These online tools in WIMS are not intended to replace traditional use of mathematical software packages by power users to carry out complicated computations via programmed scripts. Rather, WIMS is intended for "casual" users who want to carry out only "simple" computations, for which it is often not cost-effective to learn the syntax of the software for just a few such computations. In fact, for security reasons, we avoid letting the user directly type in source lines of a computational software via WIMS. The system security also disallows computations requiring a long execution time.

On the other hand, web user interfaces can be made much more user friendly for the computations they support, and it is possible to create applications on WIMS combining the computing power of several different software packages.

Of course, this design goal of WIMS does not stop people from using it in other ways. For example, we have regularly seen users spending hours or even days on Factoris to factor series of integers such as  nm + n - 1  for n from 100 to 1000 and m from 2 to 10. It is clearly not the intention of Factoris to support such activities, since a direct use of PARI/GP with a small loop would give them the result within minutes. However, the fact that these people prefer spending so much time on Factoris suggests that they would have to spend more time and effort finding, installing, and learning to use PARI/GP directly. Therefore we are not discouraging people from using Factoris (and other online tools) in such an intensive way.

Basic Structure of the System

The center of the system is a cgi program, wims.cgi, written in C, whose location is the unique entry point of the server. It processes user requests arriving from http connections. These requests may contain parameters, which will be captured and interpreted by wims.cgi.

Each application under the system is an independent unit, called a module. Modules are written in a specially designed scripting language to be interpreted by wims.cgi. Inter-module communication is achieved via http links. Many capabilities of the system are available to modules via special commands in the scripting language, so that these capabilities can be enhanced or upgraded without modification at the module's level, as long as backward compatibility is respected.

Each module under WIMS resides in a separate directory, which also contains a number of files for different purposes, written in the scripting language. A typical user request to WIMS should contain information for the name of the module requested, for which wims.cgi will then read the files in that module's directory and interpret them. The result is an html page generated by wims.cgi and sent back to the user.

Our principle is to let all sophisticated mathematical computations be carried out by exterior programs, in order to gain maximal power and versatility with minimal cost of development. Thus wims.cgi can carry out only very basic computations by itself. When needed, the module's writer can use a special command to execute an exterior program for mathematical computations or visualizations. An interface to this program is then called by wims.cgi, which prepares the parameters, executes the appropriate program, and filters the output of the latter to make it directly usable by subsequent commands in the module.

The number of programs that can be executed to process one user request is limited only by the server resources. For example, in the module Factoris, a user-submitted expression is first sent to PARI/GP for a check of syntax consistency. Then the number of variables in the expression is computed. For integers or one-variable polynomials, PARI/GP is executed again to factor it. For multivariate polynomials, Maxima is called for factorization.


The home site of WIMS is freely accessible to all, and it contains a list of publicly available mirror sites. Online help pages and technical documentation can also be found there.

The source code of the system (server and modules) is freely downloadable from, distributed under the GNU General Public License. At the current stage, the system is available only for Linux, with no immediate prospect of porting it to other operating systems.

Although it is possible for anyone to work on a remote WIMS server through the Internet, we recommend local installation if intensive work is planned, due to possibly important delays caused by network saturation. The installation of WIMS itself is relatively easy, but installation of support software packages is sometimes more complicated.

Xiao Gang, "WIMS: An Interactive Mathematics Server - How WIMS Works," Convergence (August 2004)