Integrals in Mathematica

This laboratory will demonstrate solving integrals in Mathematica. you investigate definite and indefinite integrals and, when all else fails, how to numerically calculate an integral. You can use tables to look up integrals, but Mathematica is usually faster.

1. A Simple Example of a Definite Integral

Find the following integral using Mathematica.

                                                           A = (∫_0^1)(x^2)dx
                                                           
The sample code below shows how to perform this calculation using the command line and also using the 'BasicMathInput' palette. If you don't see this palette when you start Mathematica, you can open it by clicking and dragging down to 'BasicMathInput' under the Palettes menu.

Integrate[(x^2),{x,0,1}] (* Command line *)
(∫_0^1)(x^2)\[DifferentialD]x (* palette version. *)

2. An Indefinite Integral

Now use the same function as Part 1 for an indefinite integral.

Integrate[(x^2),x] (* Command line *)
∫(x^2)\[DifferentialD]x (* palette version. *)

3. When Things Go Bad

The indefinite integral of the rather odd function below does not have a closed analytical form. Note how Mathematica handles this situation.

                                                      f(x) = sin( sin(x))

∫Sin[Sin[x]]\[DifferentialD]x

If Mathematica doesn't know how to handle a situation it just spits back the original request to you. The solution here is to now do this integral numerically.

NIntegrate[Sin[Sin[x]],x]

For the previous command you should have seen a warning message about the integration range for x. A numerical integral only makes sense as a definite integral so we need to define the range of the integral.

NIntegrate[Sin[Sin[x]],{x,0,1}]