Trapezoidal rule for Numerical Integration

Trapezoidal rule for Numerical Integration :

ALGORITHM :

  1. [start]
  2. Input Lower limit a
  3. Input Upper Limit b
  4. Input number of sub intervals n
  5. h=(b-a)/n
  6. sum=0
  7. sum=fun(a)+fun(b)
  8. for i=1; i<n; i++
  9. sum +=2*fun(a+i)
  10. [end of loop i]
  11. result =sum*h/2;
  12. Print Output result
  13. [end of program]
  14. Start of Section fun
  15. temp = 1/(1+(x*x))
  16. return temp
  17. end of section fun.
C SOURCE CODE :

OUTPUT

trapezoidal rule


Leave a Reply

Your email address will not be published. Required fields are marked *