martin123

24 Reputation

2 Badges

15 years, 209 days

MaplePrimes Activity


These are answers submitted by martin123

Hi

Thanks for the reply. I don't quite understand what you mean. Could you clarify what you mean.

Thanks Martin

Hi

I have got my procedure set and it doesn't return any errors but it will not give me a number answer when i putt values for the variables in.

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

(ii):evalf(Simpson(cosh(x),4,-2,2));
0.3333333333 S + 1.333333333 cosh(x)(-1) + 1.333333333 cosh(x)(1) + 0.3333333333 T + 0.6666666667 cosh(x)(0)

Thanks Martin
 

Page 1 of 1