Definite and Indefinite Integration in Mathematica

Simplicity

Example 1

∫((2^x)/(Sqrt[1 + (4^x)])) \[DifferentialD]x

Simplify[%]

Use the fact that ((((2^x)))^2) = (4^x)

∫((2^x)/(Sqrt[((((2^x)))^2) + 1])) \[DifferentialD]x

Example 2

(∫_(-((3 π)/4))^(-(π/4)))(1/2) (Sqrt[2 - 2 cos(2 x)]) \[DifferentialD]x

Example 3

(∫_(-∞)^∞) 
            (1/((x^4) + (x^2) + x + 1)) \[DifferentialD]x

N[%]

N[
      (2/5) π (cos((π/5)) + 
            1) csc(((2 π)/5))]

Difficult Integrands

Example 1

∫\[LeftBracketingBar]x\[RightBracketingBar] \[DifferentialD]x

∫If[x > 0, 
          x, -x] \[DifferentialD]x

Example 2

∫cos(5 x) Ci(
            2 x) \[DifferentialD]x

Example 3

(∫_(-∞)^∞)(( sin(
                t) (E^(2 I t)))/t) \[DifferentialD]t

Example 4

∫((((∂f(x))/(∂x)) g(x)-f(x) ((∂g(x))/(∂x)))/((((f(x) + 
                    g(x)))^2)))\[DifferentialD]x

Simplify[((∂%)/(∂x))]

Parametric Integrands

Example 1

Integrate[((cos(x))/((a^2) + (x^2))), {x, -∞, ∞}, Assumptions -> {a > 0}]

Without assumption, Mathematica provides even a case distinction:

(∫_(-∞)^∞)(( cos(
              x))/((a^2) + (x^2))) \[DifferentialD]x

Example 2

Integrate[
      x (E^(2 q x - p (x^2))), {x, -∞, ∞}, Assumptions -> {p > 0}]

Without case distinction, Mathematica again finds the restrictions on its own

(∫_(-∞)^∞) 
          x (E^(2 q x - p (x^2))) \[DifferentialD]x

Example 3

∫(((cot^n)(x))/((sin^2)(
              x))) \[DifferentialD]x

Example 4

Integrate[
      ((t^(a - 1))/(t + 1)), {t, 0, ∞}, 
      Assumptions -> {a > 0, a < 1}]

Again, appropriate parameter constraints can be found by Mathematica.

(∫_0^∞) ((t^(a - 1))/(t + 
              1)) \[DifferentialD]t

Branch Cut Problems

\(TraditionalForm\`Consider\ the\ real\ valued\ function\ f\ defined\ by\)

f(x_) := (Sqrt[x - 2 + (1/x)])

\(TraditionalForm\`This\ function\ has\ a\ nasty\ behaviour\ at\ x = \(\(1\)\(:\)\)\)

Plot[f[x],{x,0,2},PlotRange->{0,2}]

Mathematica finds an indefinite integral for this function:

∫f(x) \[DifferentialD]x

Simplify[%]

Define F to be this antiderivative.

F(
        x_) := ((2 (x - 3) x (Sqrt[x - 2 + (1/x)]))/(3 (x - 1)))

This antiderivative has a discontinuity as can be seen from its plot:

Plot[F[x],{x,0,2}]

However, definite integration works fine and does not struggle over the naive way to apply the fundamental theorem of calculus.

(∫_0^2) f(
          x) \[DifferentialD]x

(lim_(x -> 2)) F(x) - 
      (lim_(x -> 0)) F(x)