Cristian wrote:
> On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote:
> 
>> I think key may be to discuss names and name binding with your friend.

Here's an idea:

import math

def sin_integral(start, finish, dx):
     total = 0.0
     y0 = math.sin(start)
     for n in range(1, 1 + int((finish - start) / float(dx))):
         y1 = math.sin(start + n * dx)
         total += (y0 + y1)
         y0 = y1
     return total / 2. * dx


def cos_integral(start, finish, dx):
     total = 0.0
     y0 = math.sin(start)
     for n in range(1, 1 + int((finish - start) / float(dx))):
         y1 = math.cos(start + n * dx)
         total += (y0 + y1)
         y0 = y1
     return total / 2. * dx

generalize and separate the integration technique from the
function it integrates.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to