## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "mpmath/calculus/quadrature.py" betweenmpmath-0.19.tar.gz and mpmath-1.0.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

skipping to change at line 85 skipping to change at line 85
def transform_nodes(self, nodes, a, b, verbose=False): def transform_nodes(self, nodes, a, b, verbose=False):
r""" r"""
Rescale standardized nodes (for [-1, 1]) to a general Rescale standardized nodes (for [-1, 1]) to a general
interval [a, b]. For a finite interval, a simple linear interval [a, b]. For a finite interval, a simple linear
change of variables is used. Otherwise, the following change of variables is used. Otherwise, the following
transformations are used: transformations are used:
.. math :: .. math ::
: t = \frac{1}{x} + (a-1) \lbrack a, \infty \rbrack : t = \frac{1}{x} + (a-1)
: t = (b+1) - \frac{1}{x} \lbrack -\infty, b \rbrack : t = (b+1) - \frac{1}{x}
: t = \frac{x}{\sqrt{1-x^2}} \lbrack -\infty, \infty \rbrack : t = \frac{x}{\sqrt{1-x^2}}
""" """
ctx = self.ctx ctx = self.ctx
a = ctx.convert(a) a = ctx.convert(a)
b = ctx.convert(b) b = ctx.convert(b)
one = ctx.one one = ctx.one
if (a, b) == (-one, one): if (a, b) == (-one, one):
return nodes return nodes
half = ctx.mpf(0.5) half = ctx.mpf(0.5)
new_nodes = [] new_nodes = []
skipping to change at line 421 skipping to change at line 421
""" """
ctx = self.ctx ctx = self.ctx
# It is important that the epsilon is set lower than the # It is important that the epsilon is set lower than the
# "real" epsilon # "real" epsilon
epsilon = ctx.ldexp(1, -prec-8) epsilon = ctx.ldexp(1, -prec-8)
# Fairly high precision might be required for accurate # Fairly high precision might be required for accurate
# evaluation of the roots # evaluation of the roots
orig = ctx.prec orig = ctx.prec
ctx.prec = int(prec*1.5) ctx.prec = int(prec*1.5)
if degree == 1: if degree == 1:
x = ctx. x = ctx.sqrt(ctx.mpf(3)/5)
w = ctx.mpf(5)/9 w = ctx.mpf(5)/9
nodes = [(-x,w),(ctx.zero,ctx.mpf(8)/9),(x,w)] nodes = [(-x,w),(ctx.zero,ctx.mpf(8)/9),(x,w)]
ctx.prec = orig ctx.prec = orig
return nodes return nodes
nodes = [] nodes = []
n = 3*2**(degree-1) n = 3*2**(degree-1)
upto = n//2 + 1 upto = n//2 + 1
for j in xrange(1, upto): for j in xrange(1, upto):
# Asymptotic formula for the roots # Asymptotic formula for the roots
r = ctx.mpf(math.cos(math.pi*(j-0.25)/(n+0.5))) r = ctx.mpf(math.cos(math.pi*(j-0.25)/(n+0.5)))
End of changes. 4 change blocks.
4 lines changed or deleted 4 lines changed or added