Advertisement
Fhernd

definir_tipo_dato.pyx

Feb 21st, 2018
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. def funcion(double x):
  2.     return x**2 - 42;
  3.    
  4.  
  5. def integrar_funcion(double limite_inferior, double limite_superior, int N):
  6.     cdef int i
  7.     cdef double s, dx
  8.    
  9.     s = 0
  10.     dx = (limite_superior - limite_inferior) / N
  11.    
  12.     for i in range(N):
  13.         s  += funcion(limite_inferior + i * dx)
  14.        
  15.     return s * dx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement