Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mult.factorization with recursion #290

Open
wwitzel opened this issue Jun 22, 2022 · 0 comments
Open

Mult.factorization with recursion #290

wwitzel opened this issue Jun 22, 2022 · 0 comments

Comments

@wwitzel
Copy link
Collaborator

wwitzel commented Jun 22, 2022

Currently, Mult.factorization requires 'the_factor' to be a direct factor. But to be more complete and versatile, it should be able to factor from an exponentiation factor or nested Mult or maybe a sum:

Examples:
a * b^5 * c = b^2 * (a * b^3 * c)
a * (b * b) * c = b * (a * b * c)
a * (b + b*d) * c = b * (a * (1 + d) * c)

Add.factorization uses recursion already. That can be a guide as appropriate, but the situation is a little different. In Add, the factor must appear in every term. In Mult, the factor must appear in any factor. So it is trickier with Mult because we'd want a way to peek in and decide if we can perform a factorization without actually doing the factorization to avoid extra work. We probably want number operations to have an "is_factorable(the_factors)" method to facilitate such a thing. If we are pulling to the left, find the first factorable factor going left to right. If we are pulling to the right, find the first factorable factor going right to left, perhaps.

wwitzel added a commit that referenced this issue Nov 25, 2022
Implementing #290.  Mult factorization now works in a recursive fashion using 'readily_factorable'.
wwitzel added a commit that referenced this issue Nov 25, 2022
Implementing #290.  Mult factorization now works in a recursive fashion using 'readily_factorable'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant