> 
The following was implemented in Maple by Marcus Davidsson (2008) davidsson_marcus@hotmail.com 
> 
############################# Our basic Integral ############################ 
> 
# Our curve is given by 

(1) 
> 
# The area under the curve is given by 

(2) 

(3) 
> 
############################ Summation when rectangule width is 1 ###################### 

(4) 
> 
# Note that the intercept is 3 and the slope is 1 
> 
plot(f(t), t = 0..4, color = blue); 
> 
# The last 4 in the maple input below is the number of rectangles in the below figure 
> 
rightbox(f(t), t = 0..4, 4, color = blue, shading = grey); 
> 
# The value of f (height) at different time periods are given by 
> 
# In order to get the area of each rectangles 
> 
# we multiply the height with the width (=1) 

(6) 

(7) 

(8) 

(9) 
> 
# The total area is simply the sum of the individual retangles 
> 
S:=[seq(f(i)*1,i=1..4,1)]; 

(10) 
> 
evalf(sum(S[k]*1,k=1..4),3); 

(11) 
> 
# Our integral was 33.3 so it is a bit over. We can increase the accuracy 
> 
# by decreasing the rectangule width 
> 
######################## Summation when rectangule width is 1/10 ############# 

(12) 
> 
# The total amount of triangles 

(13) 
> 
# The amount of triangles between 0 and 1 

(14) 
> 
# The incremental change in t over time 

(15) 
> 
# The Q in the maple input below is the number of rectangles in the below figure 
> 
rightbox(f(t), t = 0..4, Q, color = blue, shading = grey); 
> 
# The value of f (height) for the first 4 cases are given by 
> 
f(T);f(T+T);f(T+T+T);f(T+T+T+T); 
> 
# In order to get the area of each rectangles 
> 
# we multiply the hight with the width T. So for the first 4 cases we get 

(17) 

(18) 

(19) 

(20) 
> 
# The total area is simply the sum of the individual retangles 
> 
S:=[evalf(seq(f(i)*T,i=T..4.01,T),3)]; 

(22) 
> 
evalf(sum(S[k]*1,k=1..nops(S)),3); 

(23) 
> 
# Our integral was 33.3 so we are still a little bit over. 
> 
# we will now increase the accuratcy by using the Trapozide rule 
> 
################################ Trapozide Rule ############################## 

(24) 
> 
# The total amount of triangles 

(25) 
> 
# The amount of triangles between 0 and 1 

(26) 
> 
# The incremental change in t over time 

(27) 
> 
# The Q in the maple input below is the number of rectangles in the below figure 
> 
leftbox(f(t), t = 0..4, Q, color = blue, shading = grey); 
> 
# The value of f (height) at different time periods is given by 
> 
f(T);f(T+T);f(T+T+T);f(T+T+T+T);f(T+T+T+T+T); 
> 
# We have previously just took the height of the rectangle at time t which meant that 
> 
# we overestimated the height of the rectangel. In this case in order 
> 
# to get the area of each rectangles we use the trapezoid rule. 
> 
# We approximate the hight of each rectangle by taking the value of f 
> 
# at time t (height at time t) plus the value of f at time t+1 (height at time t+1) 
> 
# divided by 2 (average height). We then multiply that average height with the 
> 
# rectangle width. Note that the trapezoid rule results in that we over estimate 
> 
# the area to the left of the curve and underestimate the area to the right 
> 
# of the curve, which means that the rectagual area should be more accurate. 
> 
################################################# 
> 
# Trapezoid rule for a three period curve 
> 
T_:=(1/2)*[H(0)+H(1)]*triangle_t+(1/2)*[H(1)+H(2)]*triangle_t+(1/2)*[H(2)+H(3)]*triangle_t; 

(29) 
> 
# If we multiply in (1/2) and triangle_t in the parenthases and notice that 
> 
# H(0)=H_(0),H(1)=H_(1) and H(2)=H_(2) we get; 
> 
T_:=(1/2)*triangle_t*H_(0)+(1/2)*triangle_t*H_(1)+(1/2)*triangle_t*H(1)+(1/2)*triangle_t*H_(2)+(1/2)*triangle_t*H(2)+(1/2)*triangle_t*H(3); 

(30) 
> 
T_:=collect(%,triangle_t); 

(31) 
> 
# we note that (1/2)*H_(1)+(1/2)*H(1)=H(1) and (1/2)*H_(2)+(1/2)*H(2)=H(2) so we get 
> 
H_(1):=H(1): H_(2):=H(2): T_; 

(32) 
> 
################################################# 
> 
# The rectanguel width is T so for the first 4 cases we get 
> 
evalf(((f(0)+f(T))/2)*T,3); 

(33) 
> 
evalf(((f(T)+f(T+T))/2)*T,3); 

(34) 
> 
evalf(((f(T+T)+f(T+T+T))/2)*T,3); 

(35) 
> 
evalf(((f(T+T+T)+f(T+T+T+T))/2)*T,3); 

(36) 
> 
# As previously the total area is simply the sum of the individual retangles 
> 
# We can also solve the above problem by typing 
> 
for i from T by T to 4.01 do 
> 
A[i]:=evalf(((f(iT)+f(i))/2)*T,3) end do: 
> 
S:=[seq(A[i],i=T..4.01,T)]; 

(37) 

(38) 
> 
# Our integral was 33.3 so 33.36 is acceptable. However to get the most 
> 
# accurate estimation of the area under the curve we should use the integral 
> 
####################### Basic Economics Example and Extention #################### 
> 
# The growth of an economy G evolves over time and is a function of 5 variables 
> 
# Initial resources A (influence the intercept ) 
> 
# Initial population B (influence the intercept ) 
> 
# Peoples willingness to work W (influence slope) 
> 
# Amount of entreprenesurieal activities E (influence slope) 
> 
# The larger the area under the curve G(t) the larger the growth in the economy 
> 
# Our curve is given by 
> 
G:= t > (A+B)+(W+E)*t; 

(39) 
> 
# The area under the curve is therefore given by 

(40) 
> 
# Our parameteres are given by 
> 
A:=5: B:=10: W:=5: E:=5: I_; 

(41) 
> 
# The gowth in the economy is there for given by 

(42) 
> 
leftbox(G(t), t = 0..4, 10, color = blue, shading = grey); 
Legal Notice: The copyright for this application is owned by the authors. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.. This application is intended for noncommercial, nonprofit use only. Contact the authors for permission if you wish to use this application in forprofit activities.