# Simplify returns wrong result [duplicate]

For some particular reason, Mathematica makes wrong calculations when using Simplify[]. I need Simplify[] for a fractional decomposition of some fractions of low-order polynomicals.

Here is a (somewhat) minimal example illustrating the problem:

denom = 25 + 2 g + x^2;
x0 = I /2 Sqrt[100 + 8 g];

Simplify[Simplify[(x - x0)/denom] /. {x -> x0}]
(* --> 0  (WRONG) *)

test1 = {g -> 1000};
Simplify[Simplify[(x - x0)/denom /. test1] /. {x -> (x0 /. test1)}]
(* --> -i / 90  (RIGHT) *)

test2 = {g -> 1};
Simplify[Simplify[(x - x0)/denom /. test2] /. {x -> (x0 /. test2)}]
(* --> Indeterminate with warnings 1/0 and 0*ComplexInfinity *)


Note that x0 is a (non-degenerate) root of denom for any value of g. As such, 1/denom = a/(x-x0) + b/(x-x1) for some constants a and b (dependent on the value of g).

In the application, with this construct I try to calculate a and b (in the test1 case of g=1000 it is a=-i/90 and b=+i/90). But if the result returns 0 without warning something is clearly wrong.

What is happening here, also in the second test case ?

In the end, how do I compute fractional decomposition the best way (if I know all roots of the denominator)? Apart[] does only handle numerical input...

• You could try /.{x->x0+eps}//Simplify then /.{eps->0}. – Stephen Luttrell Nov 20 '14 at 18:32
• This is a duplicate of a question asked last week, give me a minute and I'll post a link. – DumpsterDoofus Nov 20 '14 at 18:57
• As Bob Hanlon points out, using /. is a quick and easy way to perform substitutions, but it may not always give correct answers in cases where singularities are involved, and to rigorously evaluate a function limit at a particular point, you should instead use Limit[..., x -> x0]. – DumpsterDoofus Nov 20 '14 at 19:14

denom = 25 + 2 g + x^2;
x0 = I/2 Sqrt[100 + 8 g];


Rather than substituting with x -> x0, take the limit

result[g_] = Limit[(x - x0)/denom, x -> x0]


-(I/(2*Sqrt[25 + 2*g]))

result


-(I/90)

result


-(I/(6*Sqrt))

Apart works with symbolic expressions:

(x - x0)/denom


((-(1/2))ISqrt[100 + 8*g] + x)/ (25 + 2*g + x^2)

% // Apart


-((I*Sqrt[25 + 2*g])/(25 + 2*g + x^2)) + x/(25 + 2*g + x^2)

• Thank you very much, taking Limit[] works better. Although: Apart[] does nothing. Apart[1/denom,x] just returns 1/denom - no fractional decomposition. ApartSquareFree[] doesn't help either. – Seb Bi Nov 20 '14 at 22:05