Question: Approx procedure

Hi. I have to create a procedure Approx with the procedure call Approx(f, a, b, N). I don't really understand how to write procedures so I'm confused.  The point of the procedure is to return the floating point value of the right Reimann sum SN  which approximates the area under the curve y = f(x) over the interval [a, b]. I don't know where to go from here. Here is what I have so far:

 

 

with(plots);
with(plottools);
ith_rectangle := proc(f, a, h, i)
  rectangle([a+(i-1)*h, 0], [a+i*h, f(a+i*h)], transparency=1);
end;
proc(f, a, h, i)  ...  end;

Approx :=proc(a, b, f, N)
local h, i;
f := x -> x;
a := a;  b := b;  h := (b-a)/N;
 

Please Wait...