Guest User

Untitled

a guest
Nov 21st, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import math
  2.  
  3. def g(x):
  4. return x**2+3
  5.  
  6. def Integrate(f, a , b, n):
  7. h=(b-a)/n
  8. result=0
  9. for k in range(n):
  10. x=k*h+h/2
  11. result+=f(x)*h
  12. return result
  13.  
  14. F=input("f:")
  15. A=float(input("a:"))
  16. B=float(input("b:"))
  17. N=int(input("n:"))
  18. print(Integrate(F, A, B, N))
  19.  
  20. line 14, in Integrate
  21. result+=f(x)*h
  22. TypeError: 'str' object is not callable
Add Comment
Please, Sign In to add comment