Guest User

Untitled

a guest
May 4th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. def numint(f,alpha,beta,N,b,c):
  2. x = np.linspace(alpha,beta,N).reshape(N,1);
  3. h = np.ones(N,dtype=float)*(x[1] - x[0]);
  4. h = h.reshape(N,1);
  5. c1 = np.array(c).reshape(1,np.size(c));
  6. functionResult = f(x+h*c1);
  7. print(b*functionResult);
  8. #dif = np.diff(functionResult);
  9. #print(dif);
  10. result = 0;
  11. result = np.sum(h[1:N+1] * np.sum(b*functionResult));
  12. return result;
Advertisement
Add Comment
Please, Sign In to add comment