n-arms / math-parser

A library to take in a string and output a mathematical result, as well as acting as a Computer Algebra System.
0 stars 0 forks source link

Reduce using like terms #2

Open n-arms opened 3 years ago

n-arms commented 3 years ago

Description

Trees can be expanded using the distributive property, but in order to reduce them we need to implement like terms.

Implementation

Let v be a variable, a and b be constants: av^b+a'v^b = (a+a')v^b Therefore we need a way to determine both the power and the constant of a term. This requires some standardization for trees. An arbitrary but somewhat consistent system:

Math

n-arms commented 3 years ago