The product of all xs[j] with j != k.
"""
- return product([xs[k] - xs[j] for j in range(0, len(xs)) if j != k])
+ return product([xs[k] - xs[j] for j in xrange(len(xs)) if j != k])
def lagrange_coefficient(k, x, xs):
True
"""
- ls = [ lagrange_coefficient(k, x, xs) for k in range(0, len(xs)) ]
- sigma = sum([ ys[k] * ls[k] for k in range(0, len(xs)) ])
+ ls = [ lagrange_coefficient(k, x, xs) for k in xrange(len(xs)) ]
+ sigma = sum([ ys[k] * ls[k] for k in xrange(len(xs)) ])
return sigma
[1/2/pi^2, -1/pi^2, 1/2/pi^2]
"""
- coeffs = [ QQ(1)/lagrange_denominator(k, xs) for k in range(0, len(xs)) ]
+ coeffs = [ QQ(1)/lagrange_denominator(k, xs) for k in xrange(len(xs)) ]
return coeffs
N = SR(0)
- for k in range(0, degree+1):
+ for k in xrange(degree+1):
term = divided_difference(xs[:k+1], ys[:k+1])
term *= lagrange_psi(x, xs[:k])
N += term
"""
s1 = sum([ ys[k] * hermite_coefficient(k, x, xs)
- for k in range(0, len(xs)) ])
+ for k in xrange(len(xs)) ])
s2 = sum([ y_primes[k] * hermite_deriv_coefficient(k, x, xs)
- for k in range(0, len(xs)) ])
+ for k in xrange(len(xs)) ])
return (s1 + s2)