josdejong / josdejong/mathjs

Allow tentative/bidirectional simplify rules

Open
#2,423 2 comments 0 reactions 0 assignees View on GitHub
category:symbolic feature
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

With the `leafCount` function provided by the resolution #2389, it would now make sense to allow simiplification rules to specify that they only apply if they ultimately lead to a lower-complexity (as measured by leafCount) expression, or to allow rules that will apply in either direction (and which will take the ultimate result with the lowest complexity). In both cases, there needs to be a way to specify whether (or in which direction) the rule applies if the complexity is a tie between multiple alternatives.

This was initially proposed in conjunction with simplification of array expressions, so it might be best to add this facility prior to addressing #2390. On the other hand, it would be good to have at least one use case for this feature in place before implementing it, so perhaps it is best to address #927 at least partially first, and then use this feature for the `phi^2 <-> phi+1` rule mentioned there.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.