Finding Definite Integrals Using Mathematica

Example 1

First, set up your function as in this example:

In[17]:=

IntegrateNew_1.gif

Out[17]=

IntegrateNew_2.gif

You can also set up a and b, or just fill in their values in the formulas that follow:

In[18]:=

IntegrateNew_3.gif

Out[18]=

IntegrateNew_4.gif

In[19]:=

IntegrateNew_5.gif

Out[19]=

IntegrateNew_6.gif

Our goal is to find the definite integral of f[x] from a to b.  First we use the definition.

We begin with an appropriate Riemann sum.  Here is a general way to write it:

In[20]:=

IntegrateNew_7.gif

Out[20]=

IntegrateNew_8.gif

In[21]:=

IntegrateNew_9.gif

Out[21]=

IntegrateNew_10.gif


Note that the sigma (sum) symbol can be found on the Basic Math Assistant palette (found under the Palettes menu).

Also note that the (b - a) / n is our Δx.  The a + k * Δx steps through the right endpoints of our subintervals as k runs from 1 to n in the sum.

For example, when k = 1 we simply have a + Δx, the right endpoint of the first subinterval.

When k = 2 we get a + 2 * Δx, the right endpoint of the second subinterval.

When k = n we get a + n * Δx = a + n * (b - a) / n = a + (b - a) = b, which is the right endpoint of the last subinterval.

Finally, we take the limit of the Riemann sum.  Just be sure it was the last item that you used shift-Enter on.

In[22]:=

IntegrateNew_11.gif

Out[22]=

IntegrateNew_12.gif

We can get a numeric value for the answer like this:

In[23]:=

IntegrateNew_13.gif

Out[23]=

IntegrateNew_14.gif

Let' s check our answer by using the numerical integration routine:

In[24]:=

IntegrateNew_15.gif

Out[24]=

IntegrateNew_16.gif

You can also use the Integrate function to try to get an exact answer.  Sometimes this will fail, however.

In[25]:=

IntegrateNew_17.gif

Out[25]=

IntegrateNew_18.gif

In[26]:=

IntegrateNew_19.gif

Out[26]=

IntegrateNew_20.gif

You can also use the definite integral symbol from the Basic Math Assistant palette to try to get an exact answer.  After placing it on the page, click on each little box.  You can then type in the item that you want in that position.

In[27]:=

IntegrateNew_21.gif

Out[27]=

IntegrateNew_22.gif

In[28]:=

IntegrateNew_23.gif

Out[28]=

IntegrateNew_24.gif

Looks like we got it!

You can also use the Integrate function to try to get an exact answer.  Sometimes this will fail, however.

Example 2

Let’s look at a different way to tell Mathematica to find a definite integral as the limit of a Riemann sum.  For example, it might be easier to use h instead of Δx.  Thus we start out as follows:

In[39]:=

IntegrateNew_25.gif

Out[39]=

IntegrateNew_26.gif

For an exponential function, make sure you use the number e on the Basic Math Assistant palette.  Do NOT simply type an ordinary letter e.  It will not work correctly.

In[40]:=

IntegrateNew_27.gif

Out[40]=

IntegrateNew_28.gif

In[41]:=

IntegrateNew_29.gif

Out[41]=

IntegrateNew_30.gif

In[42]:=

IntegrateNew_31.gif

Out[42]=

IntegrateNew_32.gif

It might also be easier to take the Limit of the Riemann sum directly, insead of doing the Riemann sum and then finding the limit of %, the last output:

In[43]:=

IntegrateNew_33.gif

Out[43]=

IntegrateNew_34.gif

IntegrateNew_35.gif

Example 3

Here we try a harder exponential function.

In[44]:=

IntegrateNew_36.gif

Out[44]=

IntegrateNew_37.gif

Suppose that we want to integrate this function from 0 to 2. Let's try the definition first:

In[45]:=

IntegrateNew_38.gif

Out[45]=

IntegrateNew_39.gif

In[46]:=

IntegrateNew_40.gif

Out[46]=

IntegrateNew_41.gif

In[47]:=

IntegrateNew_42.gif

Out[47]=

IntegrateNew_43.gif

In[48]:=

IntegrateNew_44.gif

Out[48]=

IntegrateNew_45.gif

Note that Mathematica has refused to calculate the limit, or even the sum.  It knows no method to do so.

We can try Integrate and NIntegrate:

In[49]:=

IntegrateNew_46.gif

Out[49]=

IntegrateNew_47.gif

This gave us an answer in terms of some other function.  The problem is that f[x] has no closed-form antiderivative among
the elementary functions.

Perhaps we can get an approximate numerical result:

In[50]:=

IntegrateNew_48.gif

Out[50]=

IntegrateNew_49.gif

In[51]:=

IntegrateNew_50.gif

Out[51]=

IntegrateNew_51.gif

At least we succeeded in getting a numerical result.

Spikey Created with Wolfram Mathematica 8.0