I often run into the problem that Mathematica refuses to simplify divergent subexpressions as part of a full expression that is manifestly finite. This only happens when a symbolic power is involved.
A minimal example is:
expr = x^(d - 4) (a x^2 + b (x + x^3 + c x^d));
Let's say this is an expression that I want to use for all
d=3 comes closest to diverging:
But I want to be able to do this:
expr /. d->3 /.x->0
which in its current form will run into a division by zero.
Note that if we simplify the expression after setting
d->3 it does work, but that is not what I'm after.
I have at various times made some ad hoc solution with a replacement rule for example, but I've run into this problem so often now that I'm looking for a definite general solution.
You may assume that the expression is rational in
x, that the expression when properly expanded is finite and nonzero at
x=x0 (in the example above
x0=0), and that there is some definite lower bound for the symbolic power (
I'm ideally looking for a simple and reasonably fast solution that works for any expression satisfying the above criteria.
Expand[expr] would work, but I want something more sensible, keeping the expression as much as possible in simplified form.