Question: Floor or round to get the number of intervals

March 19 2014 sarra 170

1

Dear all;

I have a simple question about round and floor. Please read these line.

I have an interval [0,a].  For a given step size h=a/N; N is an integrer.

all the noeuds in this interval are X[i]:=i*h; must be in the interval [0,a].

If we make a procedure with input h, and a. ANd the oupt put x[i]. I try this

 

sol:=proc(h,a)

local x, N, i;

x[0]:=0;

## My question how we define the N in the next line.  N:=floor(a/N); or N:=round(a/h);

N:=round(a/h);

for i from 0 to N-1 do:

x[i+1]:=x[i]+h;

end do:

seq([[x[i]], i=0..N);

end proc;

 

 

Please Wait...