According to Mathematica 10: $$\mbox{Simplify}\left[\frac{\frac{1}{t^2}-1}{(t+\frac{1}{t})^2}\right]==\frac{1-t^2}{(1+t^2)^2}$$

However, the first equation does not tolerate $t=0$ because of a division by zero, but the second equation cleary does allow $t=0$.

How come and what can I do to avoid this?

Raw input:

f[t_] = (1/t^2 - 1)/(t + 1/t)^2
FunctionDomain[f[t], t]
g[t_] = Simplify[f[t]]
FunctionDomain[g[t], t]


  • 3
    $\begingroup$ The singularity of the first expression is removable at $t=0$, taking value $1$. Unless you're really nitpicking, the simplification is everywhere correct, and it's only incorrect in the sense that a removable singularity has been removed. $\endgroup$ – Patrick Stevens Aug 5 '15 at 20:03
  • 1
    $\begingroup$ You'll find this sort of limitation in pretty much every computer algebra system. First check FunctionDomain for a potential workaround, then here and here. I would consider this a duplicate of these question (there are more on the same topic). $\endgroup$ – Szabolcs Aug 5 '15 at 20:05
  • 2
    $\begingroup$ People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful $\endgroup$ – Michael E2 Aug 5 '15 at 20:17

I'm not sure how well this works for more complicated expressions, but my idea is as follows:

Using the option ComplexityFunction. If the domain of an intermediate expression is larger than the original expression, assign a very large penalty. Add this to Mathematica's default complexity function (Simplify`SimplifyCount).

(* define domain for readability *)
domain[e_, x_] := FunctionDomain[e, x, Complexes, Method -> {"Reduced" -> False}]

CarefulSimplify[expr_, x_, r___] := With[{dom = domain[expr, x]},
  Simplify[expr, r, 
    ComplexityFunction -> (Simplify`SimplifyCount[#] + 
      10^20 Boole[!TrueQ[PossibleZeroQ[expr - #] && 
        Reduce[Equivalent[dom, domain[#, x]]]]]&)

For your example this works, but again I haven't tried this for more complicated expressions.

CarefulSimplify[(1/t^2 - 1)/(t + 1/t)^2, t]
(-1 + 1/t^2)/(1/t + t)^2

Edit: I've incorporated Karsten 7.'s idea, since otherwise we're calling Reduce more than we need to.

  • 5
    $\begingroup$ Or one might use Method -> {"Reduced" -> False} instead of Complexes or no third argument. $\endgroup$ – Karsten 7. Aug 6 '15 at 2:21

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.