Consider a large expression which contains terms like

a/x+b/x^2+c x + d x^4 +...-b/x^2 +h x -a/x +...

I want to find limit of the expression when x goes to zero. Because the expression is very huge, using Limit[exp,x->0] doesn't help and takes very very large time. Then, I decided to put x=0 and print the value of expression, but it gives 1/0 error. It happens because Mathematica doesn't cancel terms like a/x and -a/x.

What is an efficient way to force MM to cancel these terms? I wanted to use simplify and then put x=0, but it also takes to much time for MM to simplify the expression. Could any one help me?


closed as off-topic by Daniel Lichtblau, MarcoB, Hector, halirutan Jul 22 '18 at 14:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, MarcoB, Hector, halirutan
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Do you know for sure that this expressions are polynomials in x (with negative powers of x allowed)? Then you could use CoefficientList on the summands and add up the CoefficientLists of the results... $\endgroup$ – Henrik Schumacher Jul 21 '18 at 14:32
  • $\begingroup$ I am sure that negative powers of x exist. @HenrikSchumacher $\endgroup$ – Holger Mate Jul 21 '18 at 14:34
  • $\begingroup$ That was not my question. $\endgroup$ – Henrik Schumacher Jul 21 '18 at 14:34
  • $\begingroup$ There is no result. What I get is 1/0 error @HenrikSchumacher $\endgroup$ – Holger Mate Jul 21 '18 at 14:36
  • 3
    $\begingroup$ If you can put a copy of your notebook with the exact correct expression that you are working on somewhere and leave a link so others can grab a copy and look at it and perhaps suggest some way to make progress then you might have a chance. Otherwise "it is huge and doesn't work and how do I fix it" gives very very little for anyone to work on. $\endgroup$ – Bill Jul 21 '18 at 15:06

You might try

Collect[yourExpression, x]

and see if that will be a sufficiently fast way to group together similar x and thus get those to cancel, but without taking the time need to Simplify or Limit each of which need to do a lot more work than just grouping together similar powers of x.

But without being able to see your actual expression this is still just guesswork.


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