11
$\begingroup$

Consider the following:

a = 1+(x+y+z+u)^10000 
(* Out[57]= 1+(u+x+y+z)^10000 *)
e = -a*z+a*z
(* Out[59]= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)

How can I simplify -a*z+a*z (assigned to e) to 0? The simplification is obvious.

I tried:

Simplify[e]
(* Out[60]= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)
FullSimplify[e]
(* Out[61]= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)
Distribute[e]
(* Out[62]= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)

None of it worked. The only two functions that can do that are Expand[e] and Apart[e], both of which work for smaller expressions, but never finish for this one:

Apart[e]
(*
No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.
*)

because they are expanding the (u+x+y+z)^10000 part, which takes forever.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Jan 22 '15 at 22:17
  • $\begingroup$ Please reformat your code according to the guidelines in meta1027. Doing so will encourage more people to try to answer your question. $\endgroup$ – bbgodfrey Jan 22 '15 at 22:19
  • $\begingroup$ e /. (x + y + z + u) -> t // Simplify $\endgroup$ – Bob Hanlon Jan 23 '15 at 5:13
10
$\begingroup$

Expand takes forever, because it is trying to expand (u + x + y + z)^10000. Tell it not to.

Expand[e, Power[u + x + y + z, 10000]]
(* 0 *)
$\endgroup$
  • 1
    $\begingroup$ Thanks! Or in general Expand[e, _^_] will work too. $\endgroup$ – Ondřej Čertík Jan 22 '15 at 23:23
  • 1
    $\begingroup$ Well, hey, that's something I did not know about Expand, nifty. +1 $\endgroup$ – rcollyer Jan 23 '15 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.