# Course:CPSC312-2023/Projects

Authors: Tengs, Riley, Jules

### What is the problem?

Symbolic mathematics is a crucial aspect of modern mathematical tools, with powerful software like Maple and Mathematica leading the way. However, for students or enthusiasts who are just beginning to explore this domain, these tools can be overwhelming and expensive. The goal of this course project is to create a tiny, simple tool for performing basic symbolic mathematics as an educational resource.

## MicroMath

MicroMath is a small-scale project implemented using logical programming, aiming to introduce basic concepts of symbolic mathematics. The project follows a step-by-step processing procedure, including tokenization, parsing, simplification, and conversion to string. While not as comprehensive or robust as professional tools, MicroMath provides an accessible starting point for learners to understand the fundamentals of symbolic computation and logical programming.

### What is the something extra?

Our something extra is processing a mathematical expression in MicroMath which involves four main steps: tokenization, parsing, simplification, and conversion to string.

• Tokenization: The first step in processing a mathematical expression is to tokenize the input string. This process converts the input string into a list of tokens.
• Parsing: The list of tokens is parsed. It is responsible for constructing an abstract syntax tree (AST) from the tokens. The AST is a tree structure that represents the hierarchical relationships between the different components of the mathematical expression. With the AST, we can manipulate the expression's structure and apply algebraic rules in the simplification step.
• Simplification: Once the AST has been generated, we simplify the expression. This involves applying various algebraic rules and simplifications to the AST, such as combining like terms, cancelling out terms, and simplifying trigonometric functions. The output of this step is a simplified AST, which represents the most simplified form of the input expression.
• Conversion to String: Finally, after the expression has been simplified, we convert the simplified AST back into a human-readable string or atom. This involves traversing the AST and concatenating the string representations of its nodes in a specific order. The output of this step is the final simplified expression in a human-readable format, which can be displayed or further processed as needed.

By combining these four steps, MicroMath can process a mathematical expression from a raw input string to a simplified, human-readable output. This modular design makes it easy to extend and modify the library to support additional features or improvements in the future.

### What did we learn from doing this?

Throughout the development of this project, we learned several essential concepts:

1. Logical programming in symbolic mathematics: Implementing MicroMath using logical programming principles allowed us to explore the potential of this programming paradigm in the context of symbolic mathematics.
2. Modularity and simplicity: Breaking the problem down into smaller components made it easier to develop, test, and understand the system. This modular approach is a valuable lesson in software design and development.
3. The importance of testing: Even for a small-scale project, comprehensive testing is crucial for ensuring the correctness and reliability of the system.