Re: Advanced expression simplification



On 2005-07-11, Igor Chudov <ichudov@xxxxxxxxxxx> wrote:
> I am writing an algebra expression simplifier. It parses an expression
> and then applies various rules to the parsed tree. It also produces
> "work shown". Much of it already works (reduction of constants,
> similar terms, similar factors, etc). It works with expressions of
> arbitrary complexity, powers etc.
>
> http://www.algebra.com/services/rendering/simplifier.mpl
>
> Now I am approaching more difficult areas.
>
> Specifically, in simplification, some approaches can be tried and
> abandoned. For example:
>
> (x^2-1)/(x-1) simplifies to x+1. GOOD
>
> (1^100-1)/(x-1) "simplifies" to x^99+x^98+...+x+1. NOT GOOD.
>
>
> If I do such things, I need to make sure that simplification does not
> loop with endless tries, and that it takes a reasonable amount of
> time. Some approaches can initially lead to bigger expressions, and
> then to smaller ones. The typical example is use of associative
> property.
>
> I cannot expect all simplification approaches to always reduce the
> size of expressions. And yet, I need to know "where to stop".
>
> Are there any good treatises on expression simplification.

If I look at your examples, a first order approach would be to
estimate the "terms" count of your initial expression, and pass that
count (or maybe +1 or +2) to the simplifying procedure telling it to
abort if more terms than that have been found.

.



Relevant Pages

  • Re: remove negative indices
    ... does multiplying the numerator and denominator by y^2 do it? ... spot checking could lead you astray. ... that the simplification is valid. ... for some types of expressions (for example ...
    (sci.math)
  • Re: logical expressions simplification with short circuit evaluation
    ... We all know that logical expressions can be manipulated or simplified, ... But this simplification is apparently not all valid if short-circuit ... I know some compilers may do this kind of simplification. ...
    (comp.lang.c)
  • Re: Simplification: science or heuristics?
    ... since the two expressions have different domains. ... the simplification is also perfectly correct, ... very specific interpretation and the notion of being “incorrect” is also ... arithmetics or arithmetics over sets, and even a-a = 0 is no longer valid. ...
    (sci.math.symbolic)
  • Re: Improving the MATLAB function "simple" / genetic not a good idea
    ... trig identities. ... If you want to improve the simplifier for "all expressions" then there should be better methods, ... A genetic algorithm, it seems to me, has very little chance of finding a good simplification sequence for an expression ... Of course some computer algebra systems also include rules; used with restraint they can put the "finishing touches" on an expression. ...
    (sci.math.symbolic)
  • Re: Guy Steele on Parallel Programing
    ... On 19/02/2011 17:30, Helmut Eller wrote: ... then the following two expressions are equivalent: ... possibilities for useful parallelization of the reduction. ...
    (comp.lang.lisp)