This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / The Mathematica Book / Practical Introduction / Symbolic Mathematics  /

1.5.12 Advanced Topic: Generic and Non-Generic Cases

  • This gives a result for the integral of that is valid for almost all values of

  • In[1]:= Integrate[x^n, x]


  • For the special case of

    , however, the correct result is different.
  • In[2]:= Integrate[x^-1, x]


    The overall goal of symbolic computation is typically to get formulas that are valid for many possible values of the variables that appear in them. It is however often not practical to try to get formulas that are valid for absolutely every possible value of each variable.

  • Mathematica always replaces by

  • In[3]:= 0 / x


  • If

    is equal to 0, however, then the true result is not 0.
  • In[4]:= 0 / 0

    Power::infy: Infinite expression - encountered.

    Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.


  • This construct treats both cases, but would be quite unwieldy to use.
  • In[5]:= If[x != 0, 0, Indeterminate]


    If Mathematica did not automatically replace by 0, then few symbolic computations would get very far. But you should realize that the practical necessity of making such replacements can cause misleading results to be obtained when exceptional values of parameters are used.
    The basic operations of Mathematica

    are nevertheless carefully set up so that whenever possible the results obtained will be valid for almost all values of each variable.

  • is not automatically replaced by

  • In[6]:= Sqrt[x^2]


  • If it were, then the result here would be

    , which is incorrect.
  • In[7]:= % /. x -> -2


  • This makes the assumption that

    is a positive real variable, and does the replacement.
  • In[8]:= PowerExpand[Sqrt[x^2]]