Practical applications of computer algebra systems

593 Views Asked by At

(Sorry if this is not the correct place for the question)

Are there practical applications of symbolic computation systems like Mathematica, Sage, Maxima and the like in software development? To clarify what I mean - is there any point using CAS engines for developing end-user software (for example - machine learning in desktop and web software)?

Symbolic regression seems like something very beautiful, but it's current applications seem to be mostly theoretical.

Arguments like "It never rounds numbers unless it is told to do so" or "It can find antiderivatives" don't seem to impress people and "It does arbitrary precision calculations" doesn't seem to make much sense with available libraries like GMP (GNU multiple precision).

I have seen many people using symbolic computation engines for homework mathematical research, but it doesn't seem to make actual sense when it comes to using them to develop other software (mostly because these systems add much overhead). Yet there are Mathematica bindings for many programming languages.

2

There are 2 best solutions below

0
On BEST ANSWER

There are, at least, two ''practical'' kinds of situations where using symbolic computation is useful:

When exact values and calculations are required. If they are inaccurate, errors could amplify and lead to very bad results.

See the following Java code, which represent numeric values and operations according with the IEEE 754 floating-point standard:

double x = 16    + 0.025;
double y = 16.05 - 0.025;
System.out.println(y - x);

output:
3.552713678800501E-15

The $x$ and $y$ values are mathematically identical, but in floating-point representation , they differ by a single bit, at the least significant position.

Arbitrary precision does not solve the problem, because $0.025$ in binary has an infinite representation $0.0000011001100...$ = $0.00000\overline{1100}$ so no matter how much precision is used, it had to be unavoidably either truncated or rounded.

I faced this problem when working with calculations of an interest rate with data from several banks. The single bit error had made that a bank had to pay -erroneously- an amount of money as penalty.

The solution was to delegate the calculations to a CAS (mathematica in my particular case, but another one should had worked as well) in order it can do the operations in symbolic form. Before calculations, the numbers were immediately converted to their rational form, so for example, the number $16.05$ is converted to $321/20$ -any CAS supports this simple operation-. At the end of calculations the results were converted back to floating point, but all intermediate operations were performed not numerically but symbolic. It also worked because the CAS provides a way to be connected with an external program (through an API for example). Almost every CAS has support for it.

When is desirable to separate calculations from the main software There can be several reasons for it:

  1. A large set or calculations is required, too many to be hardcoded in a program. It could end with lot of mixed code (calculations and syntax required by the programming language) that could affect the readability of code, makes difficult its maintenance and is very error-prone.
  2. The team that define and maintain the calculations (i.e. analysts) is different than the team that write programs. The first group usually does not deal with code.
  3. The set of calculations changes frequently, or when changes, it must be available in a short time, too fast for programming work (coding, testing, deploying, etc.), specially if dealing with problems of type (1).
  4. Calculations require functionality unavailable, or hard to code in the main program.

A typical applications is a payroll system, where conditions can vary at any moment, there are several external factors that change -i.e. taxing calculations- and yes, there is not enough time to change code.

I am writing a payroll program, it delegates all the calculations to a CAS named Fōrmulæ (http://www.formulae.org). The edition of the calculations is also delegated because it let expressions to be shown in pretty-print fashion and edited in a human style -it does not parse lines of text, as usual-.

0
On

Mathematica has extensive means of interface design and visualization, and there are thousands of demonstration notebooks around. They even designed their own "Computable Document Format".

Basically, it means that it can do all that can be done in Excel plus besides diagrams also complicated 3D and 2D dynamic graphics, high-speed networking and parallelization, operations on images, sounds and videos, including complicated integral transforms and after-effects.