[issue3366] Add gamma and error functions to math module
report at bugs.python.org
Mon Jul 28 19:04:20 CEST 2008
nirinA raseliarison <nirina at mail.blueline.mg> added the comment:
i wrote pure Python equivalent of the patch and will
post it to the ASPN cookbook as suggested. i'm wondering
if i have to upload the code here too, or just the link
> Can you also implement blending of approximations:
> (1-t)*f1(x) + t*f2(x)
i do this with the Python code for now, and my question is:
how to choose the values for the borders?
with erf, for example, one has typically 5 domains
of approximation and one can write something like:
f = float(x)
if (f == inf):
elif (f == -inf):
elif (f == nan):
implementing the blending of approximations,
one may write:
def blend(x, a, b, f1, f2):
if x < a:
if x > b:
and the definition becomes:
but the choice of these values is somewhat arbitrary.
or i completely misunderstood what you mean by "blending of approximations"!
for erf functions, blending of approximations, as i understand it,
may be implemented easily as the functions are monotonics.
for gammas, this will be a bit complicated, especially for
negative values, where there are extremums for half integers and
discontinuities for integers.
in the other hand, i'm wondering if these coefficients had been chosen
with optimization of discontinuities already taken into account.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list