Skip to content

mathy

Mathy.ai

Solve math problems. Show your work. Contribute new solution types.

Package version

pip install mathy Successfully installed mathy mathy simplify "2x + 1y^3 + 7b + 4x"

Features

  • Computer Algebra System: Parse text into expression trees for manipulation and evaluation. Transform trees with user-defined rules that do not change the value of the expression.
  • Learning Environments Use built-in environments or author your own. Provide custom logic and values for custom actions, problems, timestep rewards, episode rewards, and win conditions.
  • Visualize Expressions: Gain a deeper understanding of problem structures and rule transformations by visualizing binary trees in a compact layout with no branch overlaps.
  • Free and Open Source: Mathy is free because educational tools are important and should be accessible to everyone.
  • Python with Type Hints: typing hints are used everywhere in Mathy to help provide rich autocompletion and linting in modern IDEs.

Requirements

  • Python 3.6+

Installation

$ pip install mathy

Try It

Let's start by simplifying a polynomial problem using the CLI:

Simplify a Polynomial

$ mathy simplify "2x + 4 + 3x * 6"

Mathy uses a swam planning algorithm to determine which intermediate steps to take to achieve the desired solution.

The output will vary, but it might look like this:

mathy simplify "2x + 4 + 3x * 6"

Generate Input Problems

Mathy can generate lists of randomized problems. Rather than forcing users to create solutions, Mathy uses environment-specific functions to determine when a problem is solved. In this way, users don't need to know the answer to a question they generate.

$ mathy problems poly

Contributors

Mathy wouldn't be possible without the contributions of the following people:

This project follows the all-contributors specification. Contributions of any kind are welcome!