Commit a30d7e5a authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #162 from joonro/patch-4

Fixed indentation of a code example
parents b804af9a 5774eaa0
......@@ -49,15 +49,15 @@ fast for use from Cython and one slower for use from Python. Then::
Using this, we can now change our integration example::
def integrate(Function f, double a, double b, int N):
cdef int i
cdef double s, dx
if f is None:
raise ValueError("f cannot be None")
s = 0
dx = (b-a)/N
for i in range(N):
s += f.evaluate(a+i*dx)
return s * dx
cdef int i
cdef double s, dx
if f is None:
raise ValueError("f cannot be None")
s = 0
dx = (b-a)/N
for i in range(N):
s += f.evaluate(a+i*dx)
return s * dx
print(integrate(SinOfSquareFunction(), 0, 1, 10000))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment