One way to compute an integral


 

In this unit we will learn to compute an estimate of an integral in a new way, and we will compare the result to the theoretical computation of the same integral, and to the integral as computed by fnInt.

 

The general case: Evaluating an integral from A to B.

Randomly choose a number between A and B, with A<B.

(Remember that RAND on the TI-83/84 yields a random number between 0 and 1.)

To get a random number between A and B, enter

A + RAND*(B-A)

(RAND yields a number between 0 and 1. If it yields 0, the above yields A. If it yields 1, the above yields B.)

 

RAND(100) yields 100 random numbers between 0 and 1.

A + RAND(100)*(B-A) yields 100 random numbers between A and B.

 

Put a function in Y1.

Now enter from the home screen

sum(Y1(A+RAND(100)*(B-A)))/100

You are computing the average of 100 values of Y1(X), and multiplying it by (B-A).

This will give an estimate of the value of the integral! The integral is the average of the values of the function times (B-A).

So in general, the integral divided by the range of x is the average. When the range of x is one, then the integral is the average.

 

The specific case: Evaluating an integral from 0 to 1 (so the range of x is one).

To simplify, let’s just consider values between 0 and 1. (So here, A = 0 and B =1, so B-A=1.)

Let our first function be y = x2. Put it in Y=:

\Y1=X2

Now enter from the home screen

sum(Y1(RAND(100)))/100

You are randomly dividing the interval from 0 to 1 into 100 pieces, which are little dx’s.

You evaluate the function at each of these values of x, and you sum them up and divide by 100.

Display: .343816717 (you won’t get exactly this, because your random numbers will be different!)

 

We can compute

EQ1.png

 

And we can compute

fnInt(X2,X,0,1)

display:.3333333333

 

You may increase the number of random numbers you use, up to 999! But then you must be very patient.

 

Let’s try another integral:

y = 1/(1+x).

You may recognize this as the natural logarithm of 2.

ln(2) = .6931471806

fnInt((1+X)-1,X, 0, 1)

display .6931471806

 

Now put

Y1=(1+X)-1

From the home screen, enter

sum(Y1(RAND(100)))/100

I got this: .7066311345

You may generate up to 999 values for RAND, but again you must be very patient.


Webpage Maintained by Owen Ramsey
Calculus Index