details: http://hg.sympy.org/sympy/rev/0ddda3e37061 changeset: 1818:0ddda3e37061 user: Ondrej Certik <[EMAIL PROTECTED]> date: Sun Oct 19 16:15:19 2008 +0200 description: Fixes mpmath import paths and functions renames all over SymPy.
Signed-off-by: Ondrej Certik <[EMAIL PROTECTED]> Signed-off-by: Fredrik Johansson <[EMAIL PROTECTED]> diffs (583 lines): diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/core/basic.py --- a/sympy/core/basic.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/core/basic.py Sun Oct 19 16:15:19 2008 +0200 @@ -1941,13 +1941,13 @@ # Number + Number*I is also fine re, im = v.as_real_imag() if allow_ints and re.is_Integer: - re = mpmath.lib.from_int(re.p) + re = mpmath.libmpf.from_int(re.p) elif re.is_Real: re = re._mpf_ else: raise ValueError(errmsg) if allow_ints and im.is_Integer: - im = mpmath.lib.from_int(im.p) + im = mpmath.libmpf.from_int(im.p) elif im.is_Real: im = im._mpf_ else: diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/core/evalf.py --- a/sympy/core/evalf.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/core/evalf.py Sun Oct 19 16:15:19 2008 +0200 @@ -3,16 +3,18 @@ for mathematical functions. """ -from sympy.mpmath.lib import (from_int, from_rational, fpi, fzero, fcmp, - normalize, bitcount, round_nearest, to_str, fpow, fone, fpowi, fe, - fnone, fhalf, fcos, fsin, flog, fatan, fmul, fneg, to_float, fshift, - fabs, fatan2, fadd, fdiv, flt, dps_to_prec, prec_to_dps, fpos, from_float, - fnone, to_int, flt, fexp, fsqrt) +from sympy.mpmath.libmpf import (from_int, from_rational, fzero, normalize, + bitcount, round_nearest, to_str, fone, fnone, fhalf, to_float, + from_float, fnone, to_int, mpf_lt, mpf_sqrt, mpf_cmp, mpf_abs, + mpf_pow_int, mpf_shift, mpf_add, mpf_mul, mpf_neg) import sympy.mpmath.libmpc as libmpc +from sympy.mpmath.settings import dps_to_prec from sympy.mpmath import mpf, mpc, quadts, quadosc, mp, make_mpf -from sympy.mpmath.specfun import mpf_gamma -from sympy.mpmath.lib import MP_BASE, from_man_exp +from sympy.mpmath.gammazeta import mpf_gamma +from sympy.mpmath.libelefun import mpf_pi, mpf_log, mpf_pow, mpf_sin, mpf_cos, \ + mpf_atan, mpf_atan2, mpf_e, mpf_exp +from sympy.mpmath.libmpf import MP_BASE, from_man_exp from sympy.mpmath.calculus import shanks_extrapolation, richardson_extrapolation @@ -98,7 +100,7 @@ if im: return libmpc.mpc_abs((re, im), prec), None, re_acc, None else: - return fabs(re), None, re_acc, None + return mpf_abs(re), None, re_acc, None def get_complex_part(expr, no, prec, options): """no = 0 for real part, no = 1 for imaginary part""" @@ -129,10 +131,10 @@ size_im = fastlog(im) # Convert fzeros to scaled zeros if re == fzero: - re = fshift(fone, size_im-prec) + re = mpf_shift(fone, size_im-prec) size_re = fastlog(re) elif im == fzero: - im = fshift(fone, size_re-prec) + im = mpf_shift(fone, size_re-prec) size_im = fastlog(im) if size_re > size_im: re_acc = prec @@ -205,7 +207,7 @@ expr = C.Add(expr, -nint, evaluate=False) x, _, x_acc, _ = evalf(expr, 10, options) check_target(expr, (x, None, x_acc, None), 3) - nint += int(no*(fcmp(x or fzero, fzero) == no)) + nint += int(no*(mpf_cmp(x or fzero, fzero) == no)) nint = from_int(nint) return nint, fastlog(nint) + 10 @@ -239,7 +241,7 @@ if len(terms) == 1: if not terms[0]: # XXX: this is supposed to represent a scaled zero - return fshift(fone, target_prec), -1 + return mpf_shift(fone, target_prec), -1 return terms[0] sum_man, sum_exp, absolute_error = 0, 0, MINUS_INF for x, accuracy in terms: @@ -266,7 +268,7 @@ return None, None if not sum_man: # XXX: this is supposed to represent a scaled zero - return fshift(fone, absolute_error), -1 + return mpf_shift(fone, absolute_error), -1 if sum_man < 0: sum_sign = 1 sum_man = -sum_man @@ -314,10 +316,10 @@ # XXX: should be able to multiply directly, and use complex_accuracy # to obtain the final accuracy def cmul((a, aacc), (b, bacc), (c, cacc), (d, dacc), prec, target_prec): - A, Aacc = fmul(a,c,prec), min(aacc, cacc) - B, Bacc = fmul(fneg(b),d,prec), min(bacc, dacc) - C, Cacc = fmul(a,d,prec), min(aacc, dacc) - D, Dacc = fmul(b,c,prec), min(bacc, cacc) + A, Aacc = mpf_mul(a,c,prec), min(aacc, cacc) + B, Bacc = mpf_mul(mpf_neg(b),d,prec), min(bacc, dacc) + C, Cacc = mpf_mul(a,d,prec), min(aacc, dacc) + D, Dacc = mpf_mul(b,c,prec), min(bacc, cacc) re, re_accuracy = add_terms([(A, Aacc), (B, Bacc)], prec, target_prec) im, im_accuracy = add_terms([(C, Cacc), (D, Cacc)], prec, target_prec) return re, im, re_accuracy, im_accuracy @@ -366,8 +368,8 @@ if complex_factors: # Multiply first complex number by the existing real scalar re, im, re_acc, im_acc = complex_factors[0] - re = fmul(re, v, prec) - im = fmul(im, v, prec) + re = mpf_mul(re, v, prec) + im = mpf_mul(im, v, prec) re_acc = min(re_acc, acc) im_acc = min(im_acc, acc) # Multiply consecutive complex factors @@ -379,7 +381,7 @@ print "MUL: obtained accuracy", re_acc, im_acc, "expected", target_prec # multiply by i if direction & 1: - return fneg(im), re, re_acc, im_acc + return mpf_neg(im), re, re_acc, im_acc else: return re, im, re_acc, im_acc else: @@ -408,15 +410,15 @@ re, im, re_acc, im_acc = evalf(base, prec+5, options) # Real to integer power if re and not im: - return fpowi(re, p, target_prec), None, target_prec, None + return mpf_pow_int(re, p, target_prec), None, target_prec, None # (x*I)**n = I**n * x**n if im and not re: z = fpowi(im, p, target_prec) case = p % 4 if case == 0: return z, None, target_prec, None if case == 1: return None, z, None, target_prec - if case == 2: return fneg(z), None, target_prec, None - if case == 3: return None, fneg(z), None, target_prec + if case == 2: return mpf_neg(z), None, target_prec, None + if case == 3: return None, mpf_neg(z), None, target_prec # General complex number to arbitrary integer power re, im = libmpc.mpc_pow_int((re, im), p, prec) # Assumes full accuracy in input @@ -432,10 +434,10 @@ if not xre: return None, None, None, None # Square root of a negative real number - if flt(xre, fzero): - return None, fsqrt(fneg(xre), prec), None, prec + if mpf_lt(xre, fzero): + return None, mpf_sqrt(mpf_neg(xre), prec), None, prec # Positive square root - return fsqrt(xre, prec), None, prec, None + return mpf_sqrt(xre, prec), None, prec, None # We first evaluate the exponent to find its magnitude # This determines the working precision that must be used @@ -453,7 +455,7 @@ if yim: re, im = libmpc.mpc_exp((yre or fzero, yim), prec) return finalize_complex(re, im, target_prec) - return fexp(yre, target_prec), None, target_prec, None + return mpf_exp(yre, target_prec), None, target_prec, None xre, xim, xre_acc, yim_acc = evalf(base, prec+5, options) @@ -467,12 +469,12 @@ re, im = libmpc.mpc_pow_mpf((xre or fzero, xim), yre, target_prec) return finalize_complex(re, im, target_prec) # negative ** real - elif flt(xre, fzero): + elif mpf_lt(xre, fzero): re, im = libmpc.mpc_pow_mpf((xre, fzero), yre, target_prec) return finalize_complex(re, im, target_prec) # positive ** real else: - return fpow(xre, yre, target_prec), None, target_prec, None + return mpf_pow(xre, yre, target_prec), None, target_prec, None @@ -490,9 +492,9 @@ TODO: should also handle tan and complex arguments. """ if v.func is C.cos: - func = fcos + func = mpf_cos elif v.func is C.sin: - func = fsin + func = mpf_sin else: raise NotImplementedError arg = v.args[0] @@ -548,24 +550,24 @@ if xim: # XXX: use get_abs etc instead re = evalf_log(C.log(C.abs(arg, evaluate=False), evaluate=False), prec, options) - im = fatan2(xim, xre or fzero, prec) + im = mpf_atan2(xim, xre or fzero, prec) return re[0], im, re[2], prec - imaginary_term = (fcmp(xre, fzero) < 0) + imaginary_term = (mpf_cmp(xre, fzero) < 0) - re = flog(fabs(xre), prec, round_nearest) + re = mpf_log(mpf_abs(xre), prec, round_nearest) size = fastlog(re) if prec - size > workprec: # We actually need to compute 1+x accurately, not x arg = C.Add(S.NegativeOne,arg,evaluate=False) xre, xim, xre_acc, xim_acc = evalf_add(arg, prec, options) prec2 = workprec - fastlog(xre) - re = flog(fadd(xre, fone, prec2), prec, round_nearest) + re = mpf_log(mpf_add(xre, fone, prec2), prec, round_nearest) re_acc = prec if imaginary_term: - return re, fpi(prec), re_acc, prec + return re, mpf_pi(prec), re_acc, prec else: return re, None, re_acc, None @@ -574,7 +576,7 @@ xre, xim, reacc, imacc = evalf(arg, prec+5, options) if xim: raise NotImplementedError - return fatan(xre, prec, round_nearest), None, prec, None + return mpf_atan(xre, prec, round_nearest), None, prec, None #----------------------------------------------------------------------------# @@ -658,7 +660,7 @@ if have_part[0]: re = result.real._mpf_ if re == fzero: - re = fshift(fone, min(-prec,-max_real_term[0],-quadrature_error)) + re = mpf_shift(fone, min(-prec,-max_real_term[0],-quadrature_error)) re_acc = -1 else: re_acc = -max(max_real_term[0]-fastlog(re)-prec, quadrature_error) @@ -668,7 +670,7 @@ if have_part[1]: im = result.imag._mpf_ if im == fzero: - im = fshift(fone, min(-prec,-max_imag_term[0],-quadrature_error)) + im = mpf_shift(fone, min(-prec,-max_imag_term[0],-quadrature_error)) im_acc = -1 else: im_acc = -max(max_imag_term[0]-fastlog(im)-prec, quadrature_error) @@ -876,8 +878,8 @@ C.Zero : lambda x, prec, options: (None, None, prec, None), C.One : lambda x, prec, options: (fone, None, prec, None), C.Half : lambda x, prec, options: (fhalf, None, prec, None), - C.Pi : lambda x, prec, options: (fpi(prec), None, prec, None), - C.Exp1 : lambda x, prec, options: (fe(prec), None, prec, None), + C.Pi : lambda x, prec, options: (mpf_pi(prec), None, prec, None), + C.Exp1 : lambda x, prec, options: (mpf_e(prec), None, prec, None), C.ImaginaryUnit : lambda x, prec, options: (None, fone, None, prec), C.NegativeOne : lambda x, prec, options: (fnone, None, prec, None), diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/core/numbers.py --- a/sympy/core/numbers.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/core/numbers.py Sun Oct 19 16:15:19 2008 +0200 @@ -1,7 +1,9 @@ import math import sympy.mpmath as mpmath -import sympy.mpmath.lib as mlib +import sympy.mpmath.libmpf as mlib +from sympy.mpmath.libmpf import mpf_abs import sympy.mpmath.libmpc as mlibc +from sympy.mpmath.libelefun import mpf_pow, mpf_pi, phi_fixed import decimal rnd = mlib.round_nearest @@ -252,10 +254,10 @@ is_Real = True def floor(self): - return C.Integer(int(mlib.to_int(mlib.ffloor(self._mpf_, self._prec)))) + return C.Integer(int(mlib.to_int(mlib.mpf_floor(self._mpf_, self._prec)))) def ceiling(self): - return C.Integer(int(mlib.to_int(mlib.fceil(self._mpf_, self._prec)))) + return C.Integer(int(mlib.to_int(mlib.mpf_ceil(self._mpf_, self._prec)))) @property def num(self): @@ -268,7 +270,7 @@ return self._mpf_, max(prec, self._prec) def __new__(cls, num, prec=15): - prec = mlib.dps_to_prec(prec) + prec = mpmath.settings.dps_to_prec(prec) if isinstance(num, (int, long)): return Integer(num) if isinstance(num, (str, decimal.Decimal)): @@ -303,7 +305,7 @@ return self.num < 0 def __neg__(self): - return Real._new(mlib.fneg(self._mpf_), self._prec) + return Real._new(mlib.mpf_neg(self._mpf_), self._prec) def __mul__(self, other): try: @@ -312,7 +314,7 @@ return NotImplemented if isinstance(other, Number): rhs, prec = other._as_mpf_op(self._prec) - return Real._new(mlib.fmul(self._mpf_, rhs, prec, rnd), prec) + return Real._new(mlib.mpf_mul(self._mpf_, rhs, prec, rnd), prec) return Number.__mul__(self, other) def __add__(self, other): @@ -324,7 +326,7 @@ return S.NaN if isinstance(other, Number): rhs, prec = other._as_mpf_op(self._prec) - return Real._new(mlib.fadd(self._mpf_, rhs, prec, rnd), prec) + return Real._new(mlib.mpf_add(self._mpf_, rhs, prec, rnd), prec) return Number.__add__(self, other) def _eval_power(b, e): @@ -338,18 +340,18 @@ if isinstance(e, Number): if isinstance(e, Integer): prec = b._prec - return Real._new(mlib.fpowi(b._mpf_, e.p, prec, rnd), prec) + return Real._new(mlib.mpf_pow_int(b._mpf_, e.p, prec, rnd), prec) e, prec = e._as_mpf_op(b._prec) b = b._mpf_ try: - y = mlib.fpow(b, e, prec, rnd) + y = mpf_pow(b, e, prec, rnd) return Real._new(y, prec) except mlib.ComplexResult: re, im = mlibc.mpc_pow((b, mlib.fzero), (e, mlib.fzero), prec, rnd) return Real._new(re, prec) + Real._new(im, prec) * S.ImaginaryUnit def __abs__(self): - return Real._new(mlib.fabs(self._mpf_), self._prec) + return Real._new(mlib.mpf_abs(self._mpf_), self._prec) def __int__(self): return int(mlib.to_int(self._mpf_)) @@ -364,7 +366,7 @@ return other.__eq__(self) if other.is_comparable: other = other.evalf() if isinstance(other, Number): - return bool(mlib.feq(self._mpf_, other._as_mpf_val(self._prec))) + return bool(mlib.mpf_eq(self._mpf_, other._as_mpf_val(self._prec))) return False # Real != non-Number def __ne__(self, other): @@ -377,7 +379,7 @@ return other.__ne__(self) if other.is_comparable: other = other.evalf() if isinstance(other, Number): - return bool(not mlib.feq(self._mpf_, other._as_mpf_val(self._prec))) + return bool(not mlib.mpf_eq(self._mpf_, other._as_mpf_val(self._prec))) return True # Real != non-Number def __lt__(self, other): @@ -389,7 +391,7 @@ return other.__ge__(self) if other.is_comparable: other = other.evalf() if isinstance(other, Number): - return bool(mlib.flt(self._mpf_, other._as_mpf_val(self._prec))) + return bool(mlib.mpf_lt(self._mpf_, other._as_mpf_val(self._prec))) return Basic.__lt__(self, other) def __le__(self, other): @@ -401,7 +403,7 @@ return other.__gt__(self) if other.is_comparable: other = other.evalf() if isinstance(other, Number): - return bool(mlib.fle(self._mpf_, other._as_mpf_val(self._prec))) + return bool(mlib.mpf_le(self._mpf_, other._as_mpf_val(self._prec))) return Basic.__le__(self, other) def epsilon_eq(self, other, epsilon="10e-16"): @@ -614,7 +616,7 @@ if other.is_comparable and not isinstance(other, Rational): other = other.evalf() if isinstance(other, Number): if isinstance(other, Real): - return bool(mlib.feq(self._as_mpf_val(other._prec), other._mpf_)) + return bool(mlib.mpf_eq(self._as_mpf_val(other._prec), other._mpf_)) return bool(self.p==other.p and self.q==other.q) return False # Rational != non-Number @@ -645,7 +647,7 @@ if other.is_comparable and not isinstance(other, Rational): other = other.evalf() if isinstance(other, Number): if isinstance(other, Real): - return bool(mlib.flt(self._as_mpf_val(other._prec), other._mpf_)) + return bool(mlib.mpf_lt(self._as_mpf_val(other._prec), other._mpf_)) return bool(self.p * other.q < self.q * other.p) return Basic.__lt__(self, other) @@ -659,7 +661,7 @@ if other.is_comparable and not isinstance(other, Rational): other = other.evalf() if isinstance(other, Number): if isinstance(other, Real): - return bool(mlib.fle(self._as_mpf_val(other._prec), other._mpf_)) + return bool(mlib.mpf_le(self._as_mpf_val(other._prec), other._mpf_)) return bool(self.p * other.q <= self.q * other.p) return Basic.__le__(self, other) @@ -1400,7 +1402,7 @@ return S.Pi def _as_mpf_val(self, prec): - return mlib.fpi(prec) + return mpf_pi(prec) def approximation_interval(self, number_cls): if issubclass(number_cls, Integer): @@ -1422,7 +1424,7 @@ __slots__ = [] def _as_mpf_val(self, prec): - return mlib.from_man_exp(mpmath.specfun.phi_fixed(prec+10), -prec-10) + return mlib.from_man_exp(phi_fixed(prec+10), -prec-10) def _eval_expand_func(self, *args): return S.Half + S.Half*S.Sqrt(5) @@ -1447,7 +1449,7 @@ __slots__ = [] def _as_mpf_val(self, prec): - return mlib.from_man_exp(mpmath.specfun.euler_fixed(prec+10), -prec-10) + return mlib.from_man_exp(mpmath.gammazeta.euler_fixed(prec+10), -prec-10) def approximation_interval(self, number_cls): if issubclass(number_cls, Integer): @@ -1469,7 +1471,7 @@ __slots__ = [] def _as_mpf_val(self, prec): - return mlib.from_man_exp(mpmath.specfun.catalan_fixed(prec+10), -prec-10) + return mlib.from_man_exp(mpmath.gammazeta.catalan_fixed(prec+10), -prec-10) def approximation_interval(self, number_cls): if issubclass(number_cls, Integer): diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/ntheory/partitions_.py --- a/sympy/ntheory/partitions_.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/ntheory/partitions_.py Sun Oct 19 16:15:19 2008 +0200 @@ -1,6 +1,9 @@ -from sympy.mpmath.lib import (fzero, fadd, fsub, fmul, fsqrt, - fdiv, fpi, pi_fixed, from_man_exp, from_int, from_rational, cosh_sinh, - fone, fcos, fshift, ftwo, fhalf, bitcount, to_int, to_str) +from sympy.mpmath.libmpf import (fzero, + from_man_exp, from_int, from_rational, + fone, ftwo, fhalf, bitcount, to_int, to_str, mpf_mul, mpf_div, mpf_sub, + mpf_add) +from sympy.mpmath.libelefun import mpf_sqrt, mpf_pi, cosh_sinh, pi_fixed, \ + mpf_cos from sympy.core.numbers import igcd import math @@ -25,7 +28,7 @@ else: frac = -((-t) & onemask) g += k*(frac - half) g = ((g - 2*h*n*one)*pi//j) >> prec - s = fadd(s, fcos(from_man_exp(g, -prec), prec), prec) + s = mpf_add(s, mpf_cos(from_man_exp(g, -prec), prec), prec) return s def D(n, j, prec, sq23pi, sqrt8): @@ -34,14 +37,14 @@ The constants sqrt(2/3*pi) and sqrt(8) must be precomputed. """ j = from_int(j) - pi = fpi(prec) - a = fdiv(sq23pi, j, prec) - b = fsub(from_int(n), from_rational(1,24,prec), prec) - c = fsqrt(b, prec) - ch, sh = cosh_sinh(fmul(a,c), prec) - D = fdiv(fsqrt(j,prec), fmul(fmul(sqrt8,b),pi), prec) - E = fsub(fmul(a,ch), fdiv(sh,c,prec), prec) - return fmul(D, E) + pi = mpf_pi(prec) + a = mpf_div(sq23pi, j, prec) + b = mpf_sub(from_int(n), from_rational(1,24,prec), prec) + c = mpf_sqrt(b, prec) + ch, sh = cosh_sinh(mpf_mul(a,c), prec) + D = mpf_div(mpf_sqrt(j,prec), mpf_mul(mpf_mul(sqrt8,b),pi), prec) + E = mpf_sub(mpf_mul(a,ch), mpf_div(sh,c,prec), prec) + return mpf_mul(D, E) def npartitions(n, verbose=False): """ @@ -63,18 +66,18 @@ prec = p = int(pbits*1.1 + 100) s = fzero M = max(6, int(0.24*n**0.5+4)) - sq23pi = fmul(fsqrt(from_rational(2,3,p), p), fpi(p), p) - sqrt8 = fsqrt(from_int(8), p) + sq23pi = mpf_mul(mpf_sqrt(from_rational(2,3,p), p), mpf_pi(p), p) + sqrt8 = mpf_sqrt(from_int(8), p) for q in xrange(1, M): a = A(n,q,p) d = D(n,q,p, sq23pi, sqrt8) - s = fadd(s, fmul(a, d), prec) + s = mpf_add(s, mpf_mul(a, d), prec) if verbose: print "step", q, "of", M, to_str(a, 10), to_str(d, 10) # On average, the terms decrease rapidly in magnitude. Dynamically # reducing the precision greatly improves performance. p = bitcount(abs(to_int(d))) + 50 - np = to_int(fadd(s, fhalf, prec)) + np = to_int(mpf_add(s, fhalf, prec)) return int(np) __all__ = ['npartitions'] diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/printing/repr.py --- a/sympy/printing/repr.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/printing/repr.py Sun Oct 19 16:15:19 2008 +0200 @@ -8,7 +8,8 @@ from printer import Printer from sympy.printing.precedence import precedence from sympy.core import Basic -import sympy.mpmath.lib as mlib +import sympy.mpmath.libmpf as mlib +from sympy.mpmath.settings import prec_to_dps, repr_dps class ReprPrinter(Printer): def reprify(self, args, sep): @@ -97,8 +98,8 @@ return '%s(%s, %s)' % (expr.__class__.__name__, self._print(expr.p), self._print(expr.q)) def _print_Real(self, expr): - dps = mlib.prec_to_dps(expr._prec) - r = mlib.to_str(expr._mpf_, mlib.repr_dps(expr._prec)) + dps = prec_to_dps(expr._prec) + r = mlib.to_str(expr._mpf_, repr_dps(expr._prec)) return "%s('%s', prec=%i)" % (expr.__class__.__name__, r, dps) def _print_Sum2(self, expr): diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/printing/str.py --- a/sympy/printing/str.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/printing/str.py Sun Oct 19 16:15:19 2008 +0200 @@ -10,7 +10,8 @@ from sympy.core.symbol import Symbol, Wild from sympy.core.basic import Basic -import sympy.mpmath.lib as mlib +import sympy.mpmath.libmpf as mlib +from sympy.mpmath.settings import prec_to_dps class StrPrinter(Printer): def parenthesize(self, item, level): @@ -287,7 +288,7 @@ if prec < 5: dps = 0 else: - dps = mlib.prec_to_dps(expr._prec) + dps = prec_to_dps(expr._prec) return mlib.to_str(expr._mpf_, dps, strip_zeros=False) def _print_Relational(self, expr): diff -r 50d93e027ef1 -r 0ddda3e37061 sympy/statistics/distributions.py --- a/sympy/statistics/distributions.py Sun Oct 19 16:15:18 2008 +0200 +++ b/sympy/statistics/distributions.py Sun Oct 19 16:15:19 2008 +0200 @@ -125,7 +125,8 @@ # error function is not yet implemented in SymPy but can easily be # computed numerically - from sympy.mpmath import mpf, secant, erf + from sympy.mpmath import mpf, erf + from sympy.mpmath.calculus import secant p = mpf(p) # calculate y = ierf(p) by solving erf(y) - p = 0 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-commits" group. To post to this group, send email to sympy-commits@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy-commits?hl=en -~----------~----~----~----~------~----~------~--~---