Monday 20 December 2010

algorithm to Implement Simpsons method

Algorithm:

Step 1. Read x1,x2,e
Step 2. h=(x2-x1)/2
Step 3. i=2
Step 4. si=f(x1) + f(x2)
Step 5. s2=0
Step 6. s4=f(x1+h)
Step 7. I0=0
Step 8. In =(s+4s4). (h/3) Repeat

Step 9. s2=s2+s4 {s2 stores already computed functional value and s4 the
value computed in the new nitration }

Step 10. s4=0
Step 11. x=x1+h/2
Step 12. for j=1 to I do
    Step 13. s4=s4+f(x)
Step 14. x=x+h
Step 15. h=h/2
Step 16. i=2i
Step 17. io=in
Step 18. in= (s1+2s2+4s4) . (h/3)
Step 19. until |In-Io|≤e. /in
Step 20. Write In,h,i

No comments:

Post a Comment