Question: Procedure error

This is the procedure for the question I posted on http://www.mapleprimes.com/questions/128600-Romberg-Approximation-Procedure-In-Maple?sq=128600 

Can anyone see where the problem is?

RombInt:=proc(f,a,b,m,n)
local j,k,R;
if type(m, numeric) then
if not type(m,nonnegint) then ERROR("m must be a non-negative integer"); fi;fi;
if type(n, numeric) then
if not type(n,nonnegint) then ERROR("n must be a non-negative integer");fi;fi;
while (m > n) do
error "parameter m must be less than or equal to n":
od;
for k from 0 to m do
R[0,k]:=TrapRule(f,2^N,a,b); od;
for j from 1 to m do
for k from j to m do
R[j,k]:=1/(4^j-1)*(4^j*R[j-1,k+1]-R[j-1,k]);
od; od;
end proc:
I then did
RombInt(exp,-3,1,0,2); but got "Error, (in TrapRule) final value in for loop must be numeric or character"
 

 

 

Please Wait...