nerdamer
nerdamer copied to clipboard
Pending issues with factor
- Grouping Terms I (#IAmSoDisappointed)
Input | My Answer | Algebrite | Nerdamer |
---|---|---|---|
factor((c+d)s+(c+d)t) | (c+d)(s+t) | (c + d) (s + t) | (c+d)*s+(c+d)*t |
factor((s+t)a-(s+t)b) | (s+t)(a-b) | (a - b) (s + t) | (s+t)*a-(s+t)*b |
factor(3(a-b)-(a-b)c) | (a-b)(3-c) | nil - a c + b c | -(-b+a)*c-3*b+3*a |
factor(2a^2(c-3d)+7(c-3d)) | (c-3d)(2a^2+7) | nil + 2 a^nil | -21*d+2*(-3*d+c)*a^2+7*c |
factor(2x(a^2+b^2)-y(a^2-b^2)) | Cannot be factorized | 2 x(a^2 + b^2) - y(a^2 - b^2) | -(-b^2+a^2)*y+2*(a^2+b^2)*x |
factor(x y(s+t)-z(s+t)) | (s+t)(x y-z) | y(s + t) x - z(s + t) | (s+t)*x*y-(s+t)*z |
factor(a(u+v)+b(u+v)) | (u+v)(a+b) | a(u + v) + b(u + v) | (u+v)*a+(u+v)*b |
factor(c(x-y)+d(y-x)) | (x-y)(c-d) | -1 + c(x - y) | (-x+y)*d+(-y+x)*c |
factor(3(x^2+y^2)+6a(x^2+y^2)) | 3(x^2+y^2)(1+2a) | nil + 6 a(x^2 + y^2) | 2*(x^2+y^2)*a+x^2+y^2 |
factor(4(a-b)-3(a+b)c) | Cannot be factorized | nil - nil c | -3*(a+b)*c-4*b+4*a |
factor(k(a-b)-l(b-a)) | (k+l)(a-b) | k(a - b) - l(-a + b) | (-b+a)*k-(-a+b)*l |
factor(c(d-4)+7(4-d)) | (d-4)(c-7) | nil + c(-4 + d) | (-4+d)*c-7*d+28 |
- Grouping Terms II (#IAmStillDisappointed)
Input | My Answer | Algebrite | Nerdamer |
---|---|---|---|
factor(x^2+x y+x z+y z) | (x+y)(x+z) | (x + y) (x + z) | (x+y)*(x+z) |
factor(5l^2+3l+5l m+3m) | (5l+3)(l+m) | 3 l + 3 m + 5 l m + 5 l^2 | (3/5+l)*(5)*(l+m) |
factor(4s-t^2+4t-s t) | (s+t)(4-t) | -(t - 4) (s + t) | (-s*t-t^2+4*t+4*s) |
factor(a b c-b-1+a c) | (a c-1)(b+1) | -1 - b + a b c + a c | (-1-b+a*b*c+a*c) |
factor(4c^3-3c^2-3d^2+4c d^2) | (4c-3)(c^2+d^2) | 4 c d^2 - 3 c^2 + 4 c^3 - 3 d^2 | (-3/4+c)*(4)*(c^2+d^2) |
factor(2x^2-2x y+x z-y z) | (x-y)(2x+z) | (x - y) (2 x + z) | factor(2x^2-2x y+x z-y z) |
factor(3x^3-x^2y-2y^3+6x y^2) | (3x-y)(x^2+2y^2) | (3 x - y) (x^2 + 2 y^2) | (-2*y^3-x^2*y+3*x^3+6*x*y^2) |
factor(6x^4-9x+15-10x^3) | (3x-5)(2x^3-3) | (3 x - 5) (2 x^3 - 3) | (-10*x^3-9*x+6*x^4+15) |
factor(2x^2-2x y-3x z-3y z) | Cannot be factorized | 2 x^2 - 2 x y - 3 x z - 3 y z | (-2*x*y-3*x*z-3*y*z+2*x^2) |
factor(a^4-a^3+2a-2) | (a-1)(a^3+2) | -2 + 2 a - a^3 + a^4 | (-1+a)*(2+a^3) |
factor(24-x y-6y+4x) | (x+6)(4-y) | (-y + 4) (x + 6) | (-y+4)*(6+x) |
factor(10+3x y-15x-2y) | (y-5)(3x-2) | (y - 5) (3 x - 2) | (-2/3+x)*(-5+y)*(3) |
- Grouping Terms III
Input | My Answer | Algebrite | Nerdamer |
---|---|---|---|
factor((l-m)x+(l-m)y) | (x+y)(l-m) | (l - m) (x + y) | (-m+l)*x+(-m+l)*y |
factor(a(c-d)-b(c-d)) | (c-d)(a-b) | a(c - d) - b(c - d) | (-d+c)*a-(-d+c)*b |
factor(3k^2(u+4v)-2(u+4v)) | (u+4v)(3k^2-2) | -nil + 3 k^nil | -2*u-8*v+3*(4*v+u)*k^2 |
factor(5(x+y)-(x+y)t) | (x+y)(5-t) | -(-nil + t x + t y) | -(x+y)*t+5*x+5*y |
factor(2a b(d+5)-9(d+5)) | (d+5)(2a b-9) | -nil + 2 a b(5 + d) | -45-9*d+2*(5+d)*a*b |
factor(2s(c^2-d^2)+3t(c^2+d^2)) | Cannot be factorized | 2 s(c^2 - d^2) + 3 t(c^2 + d^2) | 2*(-d^2+c^2)*s+3*(c^2+d^2)*t |
factor(x(u-v)-y(v-u)) | (u-v)(x+y) | x(u - v) - y(-u + v) | (-v+u)*x-(-u+v)*y |
factor(c(p+q)+l(q+p)) | (p+q)(c+l) | c(p + q) + l(p + q) | (p+q)*c+(p+q)*l |
factor(m(t-2)+5(2-t)) | (t-2)(m-5) | nil + m(t - 2) | (-2+t)*m-5*t+10 |
factor(5(l^2+m^2)+4x(m^2+l^2)) | (m^2+l^2)(5+4x) | nil + 4 x(l^2 + m^2) | 4*(l^2+m^2)*x+5*l^2+5*m^2 |
factor(5(c+d)-9(d-c)k) | Cannot be factorized | nil - nil k | -9*(-c+d)*k+5*c+5*d |
factor(m(y-z)-n(z-y)) | (y-z)(m+n) | m(y - z) - n(-y + z) | (-z+y)*m-(-y+z)*n |
Fix planned?
- Identities I See #223
Yes I'm currently working on this. This issue is related to #164 and actually triggered issue #221 to take a higher priority. As for #223, I'm cleaning up the dev branch. Somewhere along the line things got a little messy.
@Happypig375 . Were you aware that calling expand on the input causes some (maybe all, haven't tested) of them to be correctly factored? Have you tried this?
- Two-step/Three-step factorization
Question | Answer | Nerdamer | Algebrite |
---|---|---|---|
~~(x^2+4x+4)-y^2~~ | (x+y+2)(x-y+2) | (-(4*x+x^2)-4+y^2) | 4 + 4 x + x^2 - y^2 |
a^2-(4b^2+12b*c+9c^2) | (a+2b+3c)(a-2b+3c) | (-12*b*c-4*b^2-9*c^2+a^2) | -12 b c + a^2 - 4 b^2 - 9 c^2 |
~~(9x^2-12x+4)~~-25 | 3(x+1)(3x-7) | (-7+3*x)*(1+x)*(3) | 3 (3 x - 7) (x + 1) |
~~81-(16a^2-56a+49)~~ | 8(a+1)(4-a) | (-16)*(-4+a)*(1/2+a) | 32 + 56 a - 16 a^2 |
~~(x^2+4x+4)+x*y+2y~~ | (x+2)(x+y+2) | (2+x)*(2+x+y) | (x + 2) (2 + x + y) |
(25a^2-10a+1)-10a*b+2b | (5a-1)(5a-2b-1) | (-10*a*b-10*a+25*a^2+1+2*b) | 1 - 10 a + 2 b - 10 a b + 25 a^2 |
~~(4x^2+24x+36)-14x*y-42y~~ | 2(2x-7y+6)(x+3) | (-7*y+2*x+6)*(2)*(3+x) | 2 (x + 3) (6 + 2 x - 7 y) |
~~35a*b-15b+(49a^2-42a+9)~~ | (7a-3)(7a+5b-3) | (-3+5*b+7*a)*(-3/7+a)*(7) | 9 - 42 a - 15 b + 35 a b + 49 a^2 |
(x^2+10x+25)-(y^2+8y+16) | (x+y+9)(x-y-1) | (-8*y-y^2+10*x+x^2+9) | 9 + 10 x - 8 y + x^2 - y^2 |
(4a^2+4a+1)-(9b^2-12b+4) | (2a+3b-1)(2a-3b-1) | (4a^2+4a+1)-(9b^2-12b+4) | -3 + 4 a + 12 b + 4 a^2 - 9 b^2 |
(x^2-4x+4)-(y^2-6y+9) | (x+y-5)(x-y-5) | (-4*x+x^2-5-y^2+6*y) | -5 - 4 x + 6 y + x^2 - y^2 |
(25a^2-20a*b+4b^2)-(16c^2+8c+1) | (5a-2b+4c+1)(5a-2b-4c-1) | (-1-16*c^2-8*c-20*a*b+25*a^2+4*b^2) | -1 - 8 c - 20 a b + 25 a^2 + 4 b^2 - 16 c^2 |
x^4-y^4 | (x^2+y^2)(x+y)(x-y) | (-y^4+x^4) | (x + y) (x - y) (x^2 + y^2) |
(a+b)^4-9(a+b)^2 | (a+b)^2(a+b+3)(a+b-3) | (a+b)^4*(a+b^2)^(-1)-9*(a+b)^2*(a+b^2)^(-1) | 4 a b^3 - nil^2 + a^4 + b^4 + 6 a^2 b^2 + 4 a^3 b |
~~1-6a^2+9a^4~~ | (1-3a^2)^2 | (-3*a^2+1)^2 | 1 - 6 a^2 + 9 a^4 |
~~1-6a^2+9a^4-49b^2~~ | (1-3a^2+7b)(1-3a^2-7b) | ((-1/49)*(-6*a^2+9*a^4)-1/49+b^2) | 1 - 6 a^2 + 9 a^4 - 49 b^2 |
https://github.com/jiggzson/nerdamer/issues/219#issuecomment-331587171 @jiggzson At least one case does not apply, factor(expand(2a^2(c-3d)+7(c-3d))) => (-3*d+c)*(4)*(7/2+a^2) The middle (4) should be (2). Anyways, no fractions inside brackets would be better. ~~factor(expand(2x(a^2+b^2)-y(a^2-b^2))) => (-a^2*y+2*a^2*x+2*b^2*x+b^2*y) too.~~ Edit: That is clearly not factorizable. Silly me.
Fixed? :x:
factor(x^16-1) => (-1+x)*(1+x)*(1+x^2+x^4+x^6)*(1+x^8) factor(1+x^2+x^4+x^6) => (1+x^2)*(1+x^4) Therefore, factor(x^16-1) should=> (-1+x)*(1+x)*(1+x^2)*(1+x^4)*(1+x^8)
Fixed? :x:
- Extra hard factorization
Input | Current Behaviour | Expected | Compare with Algebrite | Fixed? |
---|---|---|---|---|
factor(3x^3 - x^2y +6x^2y - 2x y^2 + 3x y^2 - y^3) | Unfactored | (3x-y)(x+y)^2 | Correct factorization | ❌ |
factor((x + 4)^3 - 9x - 36) | Unfactored | (x + 4)(x + 1)(x + 7) | Correct factorization | ✔ |
factor(x^2+2x+1-y^2) | Outputs 1 | (x + 1 - y)(x + 1 + y) | Unfactored | ✔ |
factor(x^2 - 6x + 9 - 4y^2) | Outputs 1 | (x - 3 - 2y)(x - 3 + 2y) | Unfactored | ✔ |
factor(a^2 - b^2 - 10b - 25) | Outputs 1 | (a - b - 5)(a + b + 5) | Unfactored | ✔ |
factor(a^2 - b^2 + 12b - 36) | Outputs 1 | (a - b + 6)(a + b - 6) | Unfactored | ✔ |
#261: factor(6(2a+2)) => (1+a)*(2) Still NOT fixed!
https://github.com/jiggzson/nerdamer/issues/219#issue-255288788: factor(3(x^2+y^2)+6a(x^2+y^2)) It factors into 3(2a+1)(x+y)(x-y). Strange...
Please do check if all the above are all fixed. These need to be cleaned up.
factor(x^a+2x^(a-1)+1x^(a-2)) => (2*x^(-1-NaN+a)+x^(-2-NaN+a)+x^(-NaN+a))*x^NaN
!?!??!?!??!?!??!?!??!?!
factor(-180a^3b^3c-180a^4b^3-54ab^5c-54a^2b^5-54a^5bc-54a^6b+135a^2b^4c+135a^3b^4+135a^4b^2c+135a^5b^2+9ab^6+9a^6c+9a^7+9b^6c)
factor(-7+21*x+3*x^4+4*x^2+9*x^3)
very very bad results.