Trapezoidal Method Algorithm

  • Start
  • Define and Declare the function
  • Input initial boundary value, final boundary value and length of interval
  • Calculate number of strips, n=(final boundary value-initial boundary value)/length of interval
  • Perform the following operations in loop
    x[i]=x0+i*h
    y[i]=f(x[i])print y[i]
  • Initialize se=0,s0=0
  • Do the following using a loop
    if i%2=0
    s0=s0+y[i]Otherwise
    se=se+y[i]
  • ans=h/3*(y[0]+y[n]+4*s0+2*se)
  • print the ans
  • stop

Flow Chart:

flow chart algorithm of trapezoidal rule for definite integrals

[wpedon id="7041" align="center"]

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.