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

Expand "collect and combine like terms" to be more general (addition) #46

Open
evykassirer opened this issue Dec 13, 2016 · 5 comments
Open

Comments

@evykassirer
Copy link
Contributor

evykassirer commented Dec 13, 2016

right now adding like terms looks like: x^2 + x + 3 + x^2 + 2 => ... => 2x^2 + x + 5 and only works with polynomial terms (where a polynomial term is defined as a symbol like x, with maybe an exponent, and maybe a coefficient)

it would be great if we had one for non-polynomial terms too

e.g. (x + 3)(x+3) + (x+3)(x+3) => 2*(x+3)(x+3) => ... will have one case of distribution instead of doing the leftmost one and then the rightmost one (which is what we currently do)

@nitin42
Copy link
Contributor

nitin42 commented Feb 11, 2017

I can try this and will let you know if I am done. And I think we'll have to create a new check to make a case for non-polynomial terms too. Right ?

@evykassirer
Copy link
Contributor Author

sounds good! I'll mark you as assigned

you should be updating collectAndCombineSearch (or making another tree search similar to it) to handle non-polynomial terms. let me know if you have any questions!

@nitin42
Copy link
Contributor

nitin42 commented Feb 11, 2017

Ok but I'll start working on it soon as possible (pending college stuff). Hope you don't mind !!

@kevinbarabash
Copy link
Contributor

Would factoring out a common factor also fall under this issue? For example:

x^3 + 2x^2 + x => x(x^2 + 2x + 1)

@evykassirer
Copy link
Contributor Author

evykassirer commented Feb 12, 2017

no, I think that would go under our Factoring module

#104 is what we have so far, this case isn't covered yet

(tbd how it's gonna fit in with simplifyExpression... it's hard cause sometimes it's best to leave it in expanded form and sometimes it's best to leave it in factored form, and sometimes factoring lets you cancel things out..... yeah we're gonna have to figure out how this will work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants