Question: Factor/simplify very long expression?


How do I get Maple to factor some of the terms in the expression and ignore the irrelavent ones?


factor(x^2+2x+1)   gives  (x+1)^2

but   factor(x^2+2x+1+y)   just returns  x^2+2x+1+y

So  factor((x^2+2x+1+y)/(x+1)^2)  will not automatically simplify to   1 + y/(x+1)^2


I'm looking to simplify a very long an expression such as this one:

-kn*(-kc^3*kp^3*dc+kc^3*dc^2*dp*dn-dc^3*kc^2*dp^2-kc^3*kp^3*dp-kc^4*dp*dc^2-dc^4*kc*dp^2-dc^4*kc^2*dp-dc^3*kc*dp^3-dc^4*dn*dp^2+dc^4*dn^2*dp-dc^3*dn*dp^3+2*dc^3*dn^2*dp^2-kc^3*dc^2*dp^2-dn^3*dc^3*dp+dn^2*dc^2*dp^3-dn^3*dc^2*dp^2+dn^2*dc^3*dp*kc+dn^2*dc^2*dp^2*kc-kc^3*dp^3*dc-kc^4*dp^2*dc-kc^4*kp^3+kc^3*kp^3*dn+kc^3*dp^2*dc*dn) / (dc^2*dp*(-kc+dn)*(kc+dn)*(dn-dp-kc)*(dc+dp)*(dc-dn+kc))


(30+ terms, various combinations and powers of x1, x2, x3, x4, x5, x6) over (factorised bottom line eg x1*x2*(x2+x3+x4)(x3+x4)(x5+x6+1) etc)


And to get it into the form


ie   (some overall factor)*(1 + (something)/(x1*x2)   + (something)/(x1*x2 *(x2+x3+x4) + (something)/x1*x2*(x2+x3+x4)(x3+x4)   etc

which I know it does (well it should do anyway!)


So any ideas on how to do this, factor with a preference for fractions, or make it readable in any way?






I have an expression with about 50 terms, is it possible to get Maple to factor where possible?

Please Wait...