Question: Simpson function

Hi

I am trying to create a procedure for the Simpson function and i can't see why it is wrong.

This is what i have done but it keeps coming up with an error.

Simpson:=proc(f,N,a,b);
 if (N,odd)=true then
  print("N has to be even.");
else
 N:=N:
 a:=a:    b:=b:
 h:=(b-a)/N:
for i from 1 to N/2 do
  S := S + 4*sum(f(x2i-1)):
od:
 for i from 1 to N/2-1
  T := T + 2*sum(f(x2i):
od:
S:=(h*(T+S+a+b))/3;
end proc:
Error, missing operator or `;`
 

Thanks Martin

Please Wait...