CAS

A computer algebra system (CAS) is a mathematical application that can manipulate mathematical expressions in a way similar to the traditional manual computations of mathematicians and scientists.

Your scientist friends are tired of using existing CAS software and computing things on paper and so they decided to ask you, a software engineering dream-team, to create one for them.

They know that there are two categories of CAS: specialized and general-purpose. For now they request a general-purpose one so that it can be later extended to various fields of their interest.

After reading through the Wikipedia article, you know that are certain common pieces of functionality for a general-purpose CAS:

  • a user interface allowing to enter and display mathematical formulas, (This is needed)

  • a programming language and an interpreter (the result of a computation commonly has an unpredictable form and an unpredictable size; therefore user intervention is frequently needed), (This is needed)

  • a simplifier, which is a rewrite system for simplifying mathematics formulas, (This is extra)

  • a memory manager, including a garbage collector, needed by the huge size of the intermediate data, which may appear during a computation, (Don't do this)

  • an arbitrary-precision arithmetic, needed by the huge size of the integers that may occur, (This is extra)

  • a large library of mathematical algorithms and special functions. (Just a fair amount of functions is fine, e.g. 10)

Implementing all of these would be infeasible in the timescope of this course, so you need to carefully consider which parts are crucial, and what is your view on how they should look like. We have included some suggestions in bold above.

Deliverable 1 - Software Requirements Specification (SRS)

This document has to contain ~12 functional and ~5 non-functional software requirements. It also has to contain 4 scenarios in a format described during the lecture.

More information about the first deliverable in general, no matter the project, and the feedback can be found here. The template that you should use can be found here.

Here are some examples of possible requirements:

  • It supports addition, multiplication, subtraction, division, modulo, power.
  • It supports nested expressions using parenthesis.
  • It supports variable assignment and later use in expressions.
  • It supports trigonometric functions.
  • It supports Matrix operations.
  • It can be configured via a .ini file.

Deliverable 2 - Software Design Specification (SDS)

For this phase you will design the architecture of your liking that will satisfy the requirements of the first deliverable.

More information about the second deliverable in general, no matter the project, and the feedback can be found here. The template that you should use can be found here.

One architecture pattern that you might consider is the MVC (Model-View-Controller) pattern. The console is the view, the interpreter is the controller and the computational kernel with the stored data structures is the model.

Deliverable 3 - Implementation

For this phase you will implement the design that the other team has prepared for you.

As a guideline, your implementation should contain at most around 800-1000 lines of code. This is not a requirement, but a guideline: if you feel you need more, you probably need to rethink your implementation and follow the DRY (don't repeat yourself) principle.

Some tips you might find helpful:

  • For parsing the input, a simple recursive descent parser should be enough.

  • If you use matrices it is recommended that all your inputs are matrices (have the same type in computations) as for example in older versions of MATLAB where even the scalars had dimensions.

  • If you want to support different types of any kind (scalar vs. matrix, integer vs. floating-point), you will probably find C++ templates very helpful. Before deciding to do this, you should make sure enough people in your team are comfortable with templates.

Deliverable 4 - Testing report

See here.