In this laboratory we will explore the notion of Riemann sums.
We begin by demonstrating the method for defining functions in Mathematica
Each line of code in a notebook must be executed by either using the Evaluate cell tab under the heading of Evaluation in the Mast  or by selecting -shift-return on the keyboard.  Use each of these methd to evaluate the cells below

F[x_]:= x
F[x]

G[x_]:=x^2
G[x]

We may plot a function with the following command. Note the set backets that pair functions and also pair the limits.

Plot[{F[x],G[x]},{x,-2,2}]

In this case the aspect ration is not quite correct.  We may force the aspect ratio by using the following:

Plot[{F[x],G[x]},{x,-2,2}, AspectRatio -> Automatic]

We know how to compute the integral for the power rule for instance

A:=Integrate[F[t],{t,0,x}]
A

B:=Integrate[G[t],{t,0,x}]
B

We wish to now consider the problem of using numerical methos such as the Riemann sum which is ultimately the definition of the definte integral

n:=10
a:=0.0
b:=1.0
IA:= Integrate[F[x],{x,a,b}]
RA:=Sum[F[a+i*(b-a)/n]*(b-a)/n,{i,1,n}]

The integral is

IA

The Riemann sum is

RA

The percent error is

PE:=Abs[(IA-RA)/IA]*100
PE

n:=10
a:=0.0
b:=1.0
IA:= Integrate[F[x],{x,a,b}]
RA:=Sum[F[a+i*(b-a)/n]*(b-a)/n,{i,1,n}]
PE:=Abs[(IA-RA)/IA]*100
Print["IA..........RA.............PE"]
Print[IA,"........",RA,"..........",PE]

Take n=20, 40, 80, 160, 320 above 
and fill in the chart below
a=0,b=1,  for f(x)=x
n.....................IA...................RA.................PE
10                   0.5                  0.55             10.0
20
40
80
160
320

Change to b=2
and repeat
n.....................IA...................RA.................PE
10                   2                      2.2                  10.0
20
40
80
160
320

Now G[x] instead of F[x] and repeat
a=0,b=1 for f(x)=x^2
n.....................IA...................RA.................PE
10                   -                       -                     -
20
40
80
160
320

a=0,b=2 for f(x)=x^2
n.....................IA...................RA.................PE
10                   -                       -                     -
20
40
80
160
320

when finished email this completed file  to 

prcoulton@eiu.edu