Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def trap_approx3(f,a,b,tol):
  2. i = 1 //counter
  3. last = 0
  4. nextLast = 0
  5.  
  6. while ((last - nextLast) => tol):
  7. h = float(b-a)/i
  8. I = I + f(a + i*h)
  9. nextLast = last
  10. last = I*h
  11. return last
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement