Update to 1.0.

Also:
- All patches have been upstreamed; drop them all.
- Add -test patch to fix test failures with recent mpmath.
- Recommend scipy.
This commit is contained in:
Jerry James 2016-04-01 13:49:55 -06:00
parent 9df01736ac
commit d681cf5ee5
8 changed files with 103 additions and 1254 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/sympy-0.7.6.tar.gz
/sympy-0.7.6.1.tar.gz
/sympy-1.0.tar.gz

View File

@ -1,45 +0,0 @@
From 1be64700c1063eff2b2747ce63ca03eac797b4a4 Mon Sep 17 00:00:00 2001
From: Aaditya M Nair <aadityanair6494@gmail.com>
Date: Sun, 1 Feb 2015 01:48:11 +0530
Subject: [PATCH] Fixed incompatiblity with latest version of pyglet
(1.2alpha1)
In earlier version of pyglet, `c_float` was defined in `pyglet.gl`
but in the latest version of pyglet (1.2alpha1) it is defined in
`pyglet.gl.gl`. This commit addresses this issue by adding a
try-except block that imports `cfloat` from this module.
---
sympy/plotting/pygletplot/plot_rotation.py | 5 +++++
sympy/plotting/pygletplot/util.py | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/sympy/plotting/pygletplot/plot_rotation.py b/sympy/plotting/pygletplot/plot_rotation.py
index dbbaa42..6dbf972 100644
--- a/sympy/plotting/pygletplot/plot_rotation.py
+++ b/sympy/plotting/pygletplot/plot_rotation.py
@@ -1,5 +1,10 @@
from __future__ import print_function, division
+try:
+ from pyglet.gl.gl import c_float
+except ImportError:
+ pass
+
from pyglet.gl import *
from math import sqrt as _sqrt, acos as _acos
diff --git a/sympy/plotting/pygletplot/util.py b/sympy/plotting/pygletplot/util.py
index 49574b8..710f008 100644
--- a/sympy/plotting/pygletplot/util.py
+++ b/sympy/plotting/pygletplot/util.py
@@ -1,5 +1,10 @@
from __future__ import print_function, division
+try:
+ from pyglet.gl.gl import c_float
+except ImportError:
+ pass
+
from pyglet.gl import *
from sympy.core import S
from sympy.core.compatibility import xrange

View File

@ -1 +1 @@
92e5b8e2f51c41ecac47b3458da1f505 sympy-0.7.6.1.tar.gz
9750339a54321e583a231a834f4476c3 sympy-1.0.tar.gz

View File

@ -1,20 +0,0 @@
#!/bin/bash
# Script for stripping traces of the bundled mpmath library
# 2011-10-12 Jussi Lehtola
# Loop
for i in `find . -name \*.py`; do
if [[ " `grep sympy.mpmath $i`" != " " ]]; then
echo $i
cp -a $i $i.mpmath
sed -i 's|sympy.mpmath|mpmath|g' $i
fi
if [[ " `grep 'from sympy import mpmath' $i`" != " " ]]; then
if [ ! -f $i.mpmath ]; then
echo $i
cp -a $i $i.mpmath
fi
sed -i 's|from sympy import mpmath|import mpmath|g' $i
fi
done

View File

@ -1,776 +0,0 @@
--- ./examples/advanced/autowrap_ufuncify.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./examples/advanced/autowrap_ufuncify.py 2014-12-04 10:30:58.017350207 -0700
@@ -25,7 +25,7 @@ np = import_module('numpy')
if not np:
sys.exit("Cannot import numpy. Exiting.")
-import sympy.mpmath as mpmath
+import mpmath
from sympy.utilities.autowrap import ufuncify
from sympy.utilities.lambdify import implemented_function
from sympy import symbols, legendre, Plot, pprint
--- ./examples/advanced/pidigits.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./examples/advanced/pidigits.py 2014-12-04 10:30:58.017350207 -0700
@@ -6,8 +6,8 @@ Example shows arbitrary precision using
computation of the digits of pi.
"""
-from sympy.mpmath import libmp, pi
-from sympy.mpmath import functions as mpf_funs
+from mpmath import libmp, pi
+from mpmath import functions as mpf_funs
import math
from time import clock
--- ./setup.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./setup.py 2014-12-04 10:30:58.017350207 -0700
@@ -73,11 +73,6 @@ modules = [
'sympy.matrices',
'sympy.matrices.benchmarks',
'sympy.matrices.expressions',
- 'sympy.mpmath',
- 'sympy.mpmath.calculus',
- 'sympy.mpmath.functions',
- 'sympy.mpmath.libmp',
- 'sympy.mpmath.matrices',
'sympy.ntheory',
'sympy.parsing',
'sympy.physics',
@@ -246,7 +241,6 @@ tests = [
'sympy.logic.tests',
'sympy.matrices.expressions.tests',
'sympy.matrices.tests',
- 'sympy.mpmath.tests',
'sympy.ntheory.tests',
'sympy.parsing.tests',
'sympy.physics.hep.tests',
--- ./sympy/combinatorics/permutations.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/combinatorics/permutations.py 2014-12-04 10:30:58.018350206 -0700
@@ -9,7 +9,7 @@ from sympy.utilities.iterables import (f
has_dups, runs)
from sympy.polys.polytools import lcm
from sympy.matrices import zeros
-from sympy.mpmath.libmp.libintmath import ifac
+from mpmath.libmp.libintmath import ifac
def _af_rmul(a, b):
--- ./sympy/core/evalf.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/evalf.py 2014-12-04 14:05:59.235169407 -0700
@@ -6,20 +6,20 @@ from __future__ import print_function, d
import math
-import sympy.mpmath.libmp as libmp
-from sympy.mpmath import (
+import mpmath.libmp as libmp
+from mpmath import (
make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec)
-from sympy.mpmath import inf as mpmath_inf
-from sympy.mpmath.libmp import (from_int, from_man_exp, from_rational, fhalf,
+from mpmath import inf as mpmath_inf
+from mpmath.libmp import (from_int, from_man_exp, from_rational, fhalf,
fnan, fnone, fone, fzero, mpf_abs, mpf_add,
mpf_atan, mpf_atan2, mpf_cmp, mpf_cos, mpf_e, mpf_exp, mpf_log, mpf_lt,
mpf_mul, mpf_neg, mpf_pi, mpf_pow, mpf_pow_int, mpf_shift, mpf_sin,
mpf_sqrt, normalize, round_nearest, to_int, to_str)
-from sympy.mpmath.libmp import bitcount as mpmath_bitcount
-from sympy.mpmath.libmp.backend import MPZ
-from sympy.mpmath.libmp.libmpc import _infs_nan
-from sympy.mpmath.libmp.libmpf import dps_to_prec
-from sympy.mpmath.libmp.gammazeta import mpf_bernoulli
+from mpmath.libmp import bitcount as mpmath_bitcount
+from mpmath.libmp.backend import MPZ
+from mpmath.libmp.libmpc import _infs_nan
+from mpmath.libmp.libmpf import dps_to_prec
+from mpmath.libmp.gammazeta import mpf_bernoulli
from .compatibility import SYMPY_INTS
from .sympify import sympify
--- ./sympy/core/expr.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/expr.py 2014-12-04 11:07:54.359742059 -0700
@@ -8,7 +8,7 @@ from .evalf import EvalfMixin, pure_comp
from .decorators import _sympifyit, call_highest_priority
from .cache import cacheit
from .compatibility import reduce, as_int, default_sort_key, xrange
-from sympy.mpmath.libmp import mpf_log, prec_to_dps
+from mpmath.libmp import mpf_log, prec_to_dps
from collections import defaultdict
@@ -384,7 +384,7 @@ class Expr(Basic, EvalfMixin):
# increase the precision up to the default maximum
# precision to see if we can get any significance
- from sympy.mpmath.libmp.libintmath import giant_steps
+ from mpmath.libmp.libintmath import giant_steps
from sympy.core.evalf import DEFAULT_MAXPREC as target
# evaluate
--- ./sympy/core/function.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/function.py 2014-12-04 10:30:58.020350202 -0700
@@ -51,8 +51,8 @@ from sympy.utilities import default_sort
from sympy.utilities.iterables import uniq
from sympy.core.evaluate import global_evaluate
-from sympy import mpmath
-import sympy.mpmath.libmp as mlib
+import mpmath
+import mpmath.libmp as mlib
import inspect
@@ -460,7 +460,7 @@ class Function(Application, Expr):
try:
args = [arg._to_mpmath(prec + 5) for arg in self.args]
def bad(m):
- from sympy.mpmath import mpf, mpc
+ from mpmath import mpf, mpc
# the precision of an mpf value is the last element
# if that is 1 (and m[1] is not 1 which would indicate a
# power of 2), then the eval failed; so check that none of
@@ -1223,7 +1223,7 @@ class Derivative(Expr):
When we can represent derivatives at a point, this should be folded
into the normal evalf. For now, we need a special method.
"""
- from sympy import mpmath
+ import mpmath
from sympy.core.expr import Expr
if len(self.free_symbols) != 1 or len(self.variables) != 1:
raise NotImplementedError('partials and higher order derivatives')
--- ./sympy/core/numbers.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/numbers.py 2014-12-04 10:30:58.021350201 -0700
@@ -16,11 +16,11 @@ from .cache import cacheit, clear_cache
from sympy.core.compatibility import (
as_int, integer_types, long, string_types, with_metaclass, HAS_GMPY,
SYMPY_INTS)
-import sympy.mpmath as mpmath
-import sympy.mpmath.libmp as mlib
-from sympy.mpmath.libmp import mpf_pow, mpf_pi, mpf_e, phi_fixed
-from sympy.mpmath.ctx_mp import mpnumeric
-from sympy.mpmath.libmp.libmpf import (
+import mpmath
+import mpmath.libmp as mlib
+from mpmath.libmp import mpf_pow, mpf_pi, mpf_e, phi_fixed
+from mpmath.ctx_mp import mpnumeric
+from mpmath.libmp.libmpf import (
finf as _mpf_inf, fninf as _mpf_ninf,
fnan as _mpf_nan, fzero as _mpf_zero, _normalize as mpf_normalize,
prec_to_dps)
--- ./sympy/core/power.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/power.py 2014-12-04 10:30:58.021350201 -0700
@@ -14,7 +14,7 @@ from .logic import fuzzy_bool
from .compatibility import as_int, xrange
from .evaluate import global_evaluate
-from sympy.mpmath.libmp import sqrtrem as mpmath_sqrtrem
+from mpmath.libmp import sqrtrem as mpmath_sqrtrem
from sympy.utilities.iterables import sift
--- ./sympy/core/tests/test_evalf.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/tests/test_evalf.py 2014-12-04 10:31:03.063341891 -0700
@@ -4,9 +4,9 @@ from sympy import (Add, ceiling, cos, E,
Sum, Product, Integral)
from sympy.core.evalf import complex_accuracy, PrecisionExhausted, scaled_zero
from sympy.core.compatibility import long
-from sympy.mpmath import inf, ninf, nan
+from mpmath import inf, ninf, nan
from sympy.abc import n, x, y
-from sympy.mpmath.libmp.libmpf import from_float
+from mpmath.libmp.libmpf import from_float
from sympy.utilities.pytest import raises, XFAIL
--- ./sympy/core/tests/test_numbers.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/tests/test_numbers.py 2014-12-04 10:56:49.005878896 -0700
@@ -6,9 +6,9 @@ from sympy.core.basic import _aresame
from sympy.core.compatibility import long, u
from sympy.core.power import integer_nthroot
from sympy.core.numbers import igcd, ilcm, igcdex, seterr, _intcache, mpf_norm
-from sympy.mpmath import mpf
+from mpmath import mpf
from sympy.utilities.pytest import XFAIL, slow, raises
-from sympy import mpmath
+import mpmath
def test_integers_cache():
@@ -1355,8 +1355,8 @@ def test_issue_4172():
@XFAIL
def test_mpmath_issues():
- from sympy.mpmath.libmp.libmpf import _normalize
- import sympy.mpmath.libmp as mlib
+ from mpmath.libmp.libmpf import _normalize
+ import mpmath.libmp as mlib
rnd = mlib.round_nearest
mpf = (0, long(0), -123, -1, 53, rnd) # nan
assert _normalize(mpf, 53) != (0, long(0), 0, 0)
@@ -1365,7 +1365,7 @@ def test_mpmath_issues():
mpf = (1, long(0), -789, -3, 53, rnd) # -inf
assert _normalize(mpf, 53) != (0, long(0), 0, 0)
- from sympy.mpmath.libmp.libmpf import fnan
+ from mpmath.libmp.libmpf import fnan
assert mlib.mpf_eq(fnan, fnan)
@@ -1396,7 +1396,7 @@ def test_int_NumberSymbols():
def test_issue_6640():
- from sympy.mpmath.libmp.libmpf import (
+ from mpmath.libmp.libmpf import (
_normalize as mpf_normalize, finf, fninf, fzero)
# fnan is not included because Float no longer returns fnan,
# but otherwise, the same sort of test could apply
--- ./sympy/core/tests/test_sympify.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/tests/test_sympify.py 2014-12-04 10:31:04.375339729 -0700
@@ -11,7 +11,7 @@ from sympy.functions.combinatorial.facto
from sympy.abc import _clash, _clash1, _clash2
from sympy.core.compatibility import exec_, HAS_GMPY
-from sympy import mpmath
+import mpmath
def test_issue_3538():
--- ./sympy/core/tests/test_wester.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/core/tests/test_wester.py 2014-12-04 10:31:04.377339726 -0700
@@ -6,6 +6,7 @@ See also http://math.unm.edu/~wester/cas
each tested system.
"""
+import mpmath
from sympy import (Rational, symbols, factorial, sqrt, log, exp, oo, zoo,
product, binomial, rf, pi, gamma, igcd, factorint, radsimp, combsimp,
npartitions, totient, primerange, factor, simplify, gcd, resultant, expand,
@@ -13,7 +14,7 @@ from sympy import (Rational, symbols, fa
bernoulli, hyper, hyperexpand, besselj, asin, assoc_legendre, Function, re,
im, DiracDelta, chebyshevt, legendre_poly, polylog, series, O,
atan, sinh, cosh, tanh, floor, ceiling, solve, asinh, acot, csc, sec,
- LambertW, N, apart, sqrtdenest, factorial2, powdenest, Mul, S, mpmath, ZZ,
+ LambertW, N, apart, sqrtdenest, factorial2, powdenest, Mul, S, ZZ,
Poly, expand_func, E, Q, And, Or, Ne, Eq, Le, Lt,
ask, refine, AlgebraicNumber, continued_fraction_iterator as cf_i,
continued_fraction_periodic as cf_p, continued_fraction_convergents as cf_c,
@@ -26,7 +27,7 @@ from sympy.functions.special.zeta_functi
from sympy.integrals.deltafunctions import deltaintegrate
from sympy.utilities.pytest import XFAIL, slow, SKIP, skip, ON_TRAVIS
from sympy.utilities.iterables import partitions
-from sympy.mpmath import mpi, mpc
+from mpmath import mpi, mpc
from sympy.matrices import Matrix, GramSchmidt, eye
from sympy.matrices.expressions.blockmatrix import BlockMatrix, block_collapse
from sympy.matrices.expressions import MatrixSymbol, ZeroMatrix
--- ./sympy/external/tests/test_numpy.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/external/tests/test_numpy.py 2014-12-04 10:31:04.378339724 -0700
@@ -21,7 +21,7 @@ from sympy import (Rational, Symbol, lis
Matrix, lambdify, symarray, symbols, Integer)
import sympy
-from sympy import mpmath
+import mpmath
from sympy.abc import x, y, z
from sympy.utilities.decorator import conserve_mpmath_dps
--- ./sympy/functions/combinatorial/numbers.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/combinatorial/numbers.py 2014-12-04 10:59:59.605872355 -0700
@@ -21,8 +21,8 @@ from sympy.functions.elementary.exponent
from sympy.functions.elementary.trigonometric import sin, cos, cot
from sympy.functions.combinatorial.factorials import factorial
-from sympy.mpmath import bernfrac, workprec
-from sympy.mpmath.libmp import ifib as _ifib
+from mpmath import bernfrac, workprec
+from mpmath.libmp import ifib as _ifib
def _product(a, b):
@@ -706,7 +706,7 @@ class euler(Function):
if m.is_odd:
return S.Zero
if m.is_Integer and m.is_nonnegative:
- from sympy.mpmath import mp
+ from mpmath import mp
m = m._to_mpmath(mp.prec)
res = mp.eulernum(m, exact=True)
return Integer(res)
@@ -725,7 +725,7 @@ class euler(Function):
m = self.args[0]
if m.is_Integer and m.is_nonnegative:
- from sympy.mpmath import mp
+ from mpmath import mp
from sympy import Expr
m = m._to_mpmath(prec)
with workprec(prec):
--- ./sympy/functions/special/bessel.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/special/bessel.py 2014-12-04 11:01:02.478869466 -0700
@@ -706,8 +706,8 @@ def jn_zeros(n, k, method="sympy", dps=1
from math import pi
if method == "sympy":
- from sympy.mpmath import besseljzero
- from sympy.mpmath.libmp.libmpf import dps_to_prec
+ from mpmath import besseljzero
+ from mpmath.libmp.libmpf import dps_to_prec
from sympy import Expr
prec = dps_to_prec(dps)
return [Expr._from_mpmath(besseljzero(S(n + 0.5)._to_mpmath(prec),
@@ -1209,7 +1209,7 @@ class airyaiprime(AiryBase):
raise ArgumentIndexError(self, argindex)
def _eval_evalf(self, prec):
- from sympy.mpmath import mp, workprec
+ from mpmath import mp, workprec
from sympy import Expr
z = self.args[0]._to_mpmath(prec)
with workprec(prec):
@@ -1365,7 +1365,7 @@ class airybiprime(AiryBase):
raise ArgumentIndexError(self, argindex)
def _eval_evalf(self, prec):
- from sympy.mpmath import mp, workprec
+ from mpmath import mp, workprec
from sympy import Expr
z = self.args[0]._to_mpmath(prec)
with workprec(prec):
--- ./sympy/functions/special/error_functions.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/special/error_functions.py 2014-12-04 10:31:04.380339721 -0700
@@ -1339,7 +1339,7 @@ class li(Function):
We can even compute Soldner's constant by the help of mpmath:
- >>> from sympy.mpmath import findroot
+ >>> from mpmath import findroot
>>> findroot(li, 2)
1.45136923488338
--- ./sympy/functions/special/gamma_functions.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/special/gamma_functions.py 2014-12-04 14:05:59.241169397 -0700
@@ -296,7 +296,7 @@ class lowergamma(Function):
return (cls(a + 1, x) + x**a * C.exp(-x))/a
def _eval_evalf(self, prec):
- from sympy.mpmath import mp, workprec
+ from mpmath import mp, workprec
from sympy import Expr
a = self.args[0]._to_mpmath(prec)
z = self.args[1]._to_mpmath(prec)
@@ -395,7 +395,7 @@ class uppergamma(Function):
raise ArgumentIndexError(self, argindex)
def _eval_evalf(self, prec):
- from sympy.mpmath import mp, workprec
+ from mpmath import mp, workprec
from sympy import Expr
a = self.args[0]._to_mpmath(prec)
z = self.args[1]._to_mpmath(prec)
--- ./sympy/functions/special/hyper.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/special/hyper.py 2014-12-04 10:31:04.381339719 -0700
@@ -600,7 +600,8 @@ class meijerg(TupleParametersBase):
# (carefully so as not to loose the branch information), and evaluate
# G(z'**(1/r)) = G(z'**n) = G(z).
from sympy.functions import exp_polar, ceiling
- from sympy import mpmath, Expr
+ from sympy import Expr
+ import mpmath
z = self.argument
znum = self.argument._eval_evalf(prec)
if znum.has(exp_polar):
--- ./sympy/functions/special/spherical_harmonics.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/functions/special/spherical_harmonics.py 2014-12-04 14:05:59.242169395 -0700
@@ -219,7 +219,7 @@ class Ynm(Function):
# Note: works without this function by just calling
# mpmath for Legendre polynomials. But using
# the dedicated function directly is cleaner.
- from sympy.mpmath import mp, workprec
+ from mpmath import mp, workprec
from sympy import Expr
n = self.args[0]._to_mpmath(prec)
m = self.args[1]._to_mpmath(prec)
--- ./sympy/geometry/ellipse.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/geometry/ellipse.py 2014-12-04 10:31:04.383339716 -0700
@@ -24,7 +24,7 @@ from .entity import GeometryEntity
from .point import Point
from .line import LinearEntity, Line
from .util import _symbol, idiff
-from sympy.mpmath import findroot as nroot
+from mpmath import findroot as nroot
import random
--- ./sympy/liealgebras/weyl_group.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/liealgebras/weyl_group.py 2014-12-04 10:31:04.383339716 -0700
@@ -3,7 +3,7 @@
from sympy.core import Basic, Rational
from sympy.core.numbers import igcd
from .cartan_type import CartanType
-from sympy.mpmath import fac
+from mpmath import fac
from operator import itemgetter
from itertools import groupby
from sympy.matrices import Matrix, eye
--- ./sympy/matrices/matrices.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/matrices/matrices.py 2014-12-04 10:31:04.384339714 -0700
@@ -1238,7 +1238,7 @@ class MatrixBase(object):
"""Solve the linear system Ax = rhs for x where A = self.
This is for symbolic matrices, for real or complex ones use
- sympy.mpmath.lu_solve or sympy.mpmath.qr_solve.
+ mpmath.lu_solve or mpmath.qr_solve.
See Also
========
@@ -1615,7 +1615,7 @@ class MatrixBase(object):
to use QRsolve.
This is mainly for educational purposes and symbolic matrices, for real
- (or complex) matrices use sympy.mpmath.qr_solve.
+ (or complex) matrices use mpmath.qr_solve.
See Also
========
--- ./sympy/ntheory/partitions_.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/ntheory/partitions_.py 2014-12-04 10:31:04.384339714 -0700
@@ -1,6 +1,6 @@
from __future__ import print_function, division
-from sympy.mpmath.libmp import (fzero,
+from mpmath.libmp import (fzero,
from_man_exp, from_int, from_rational,
fone, fhalf, bitcount, to_int, to_str, mpf_mul, mpf_div, mpf_sub,
mpf_add, mpf_sqrt, mpf_pi, mpf_cosh_sinh, pi_fixed, mpf_cos)
--- ./sympy/physics/quantum/constants.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/physics/quantum/constants.py 2014-12-04 10:31:04.384339714 -0700
@@ -6,7 +6,7 @@ from sympy.core.numbers import NumberSym
from sympy.core.singleton import Singleton
from sympy.core.compatibility import u, with_metaclass
from sympy.printing.pretty.stringpict import prettyForm
-import sympy.mpmath.libmp as mlib
+import mpmath.libmp as mlib
#-----------------------------------------------------------------------------
# Constants
--- ./sympy/physics/quantum/qubit.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/physics/quantum/qubit.py 2014-12-04 10:31:04.385339712 -0700
@@ -24,7 +24,7 @@ from sympy.physics.quantum.represent imp
from sympy.physics.quantum.matrixutils import (
numpy_ndarray, scipy_sparse_matrix
)
-from sympy.mpmath.libmp.libintmath import bitcount
+from mpmath.libmp.libintmath import bitcount
__all__ = [
'Qubit',
--- ./sympy/polys/domains/groundtypes.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/domains/groundtypes.py 2014-12-04 10:31:04.385339712 -0700
@@ -69,7 +69,7 @@ else:
gmpy_qdiv = None
-import sympy.mpmath.libmp as mlib
+import mpmath.libmp as mlib
def python_sqrt(n):
--- ./sympy/polys/domains/mpelements.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/domains/mpelements.py 2014-12-04 10:31:04.385339712 -0700
@@ -4,11 +4,11 @@ from __future__ import print_function, d
from sympy.polys.domains.domainelement import DomainElement
-from sympy.mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant
-from sympy.mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan,
+from mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant
+from mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan,
round_nearest, mpf_mul, mpf_abs, mpf_lt, mpc_abs, repr_dps, int_types,
from_int, from_float, from_str, to_rational)
-from sympy.mpmath.rational import mpq
+from mpmath.rational import mpq
from sympy.utilities import public
--- ./sympy/polys/modulargcd.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/modulargcd.py 2014-12-04 10:31:04.386339711 -0700
@@ -7,7 +7,7 @@ from sympy.polys.polyerrors import Modul
from sympy.polys.domains import PolynomialRing
from sympy.core.compatibility import xrange
-from sympy.mpmath import sqrt
+from mpmath import sqrt
from sympy import Dummy
import random
--- ./sympy/polys/numberfields.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/numberfields.py 2014-12-04 10:31:04.386339711 -0700
@@ -47,7 +47,7 @@ from sympy.core.exprtools import Factors
from sympy.simplify.simplify import _mexpand, _is_sum_surds
from sympy.ntheory import sieve
from sympy.ntheory.factor_ import divisors
-from sympy.mpmath import pslq, mp
+from mpmath import pslq, mp
from sympy.core.compatibility import reduce
from sympy.core.compatibility import xrange
--- ./sympy/polys/polytools.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/polytools.py 2014-12-04 11:04:04.672827949 -0700
@@ -47,8 +47,8 @@ from sympy.polys.polyerrors import (
from sympy.utilities import group, sift, public
import sympy.polys
-import sympy.mpmath
-from sympy.mpmath.libmp.libhyper import NoConvergence
+import mpmath
+from mpmath.libmp.libhyper import NoConvergence
from sympy.polys.domains import FF, QQ, ZZ
from sympy.polys.constructor import construct_domain
@@ -3391,18 +3391,18 @@ class Poly(Expr):
coeffs = [coeff.evalf(n=n).as_real_imag()
for coeff in f.all_coeffs()]
try:
- coeffs = [sympy.mpmath.mpc(*coeff) for coeff in coeffs]
+ coeffs = [mpmath.mpc(*coeff) for coeff in coeffs]
except TypeError:
raise DomainError("Numerical domain expected, got %s" % \
f.rep.dom)
- dps = sympy.mpmath.mp.dps
- sympy.mpmath.mp.dps = n
+ dps = mpmath.mp.dps
+ mpmath.mp.dps = n
try:
# We need to add extra precision to guard against losing accuracy.
# 10 times the degree of the polynomial seems to work well.
- roots = sympy.mpmath.polyroots(coeffs, maxsteps=maxsteps,
+ roots = mpmath.polyroots(coeffs, maxsteps=maxsteps,
cleanup=cleanup, error=False, extraprec=f.degree()*10)
# Mpmath puts real roots first, then complex ones (as does all_roots)
@@ -3414,7 +3414,7 @@ class Poly(Expr):
'convergence to root failed; try n < %s or maxsteps > %s' % (
n, maxsteps))
finally:
- sympy.mpmath.mp.dps = dps
+ mpmath.mp.dps = dps
return roots
--- ./sympy/polys/ring_series.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/ring_series.py 2014-12-04 11:09:16.774704452 -0700
@@ -3,10 +3,10 @@
from sympy.polys.domains import QQ
from sympy.polys.rings import ring, PolyElement
from sympy.polys.monomials import monomial_min, monomial_mul
-from sympy.mpmath.libmp.libintmath import ifac
+from mpmath.libmp.libintmath import ifac
from sympy.core.numbers import Rational
from sympy.core.compatibility import as_int
-from sympy.mpmath.libmp.libintmath import giant_steps
+from mpmath.libmp.libintmath import giant_steps
import math
def _invert_monoms(p1):
--- ./sympy/polys/rootoftools.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/rootoftools.py 2014-12-04 14:05:59.247169386 -0700
@@ -28,8 +28,8 @@ from sympy.polys.polyerrors import (
from sympy.polys.domains import QQ
-from sympy.mpmath import mp, mpf, mpc, findroot, workprec
-from sympy.mpmath.libmp.libmpf import prec_to_dps
+from mpmath import mp, mpf, mpc, findroot, workprec
+from mpmath.libmp.libmpf import prec_to_dps
from sympy.utilities import lambdify, public
--- ./sympy/polys/tests/test_polyroots.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/polys/tests/test_polyroots.py 2014-12-04 14:06:31.622109815 -0700
@@ -17,6 +17,7 @@ from sympy.utilities.iterables import ca
from sympy.utilities.pytest import raises, XFAIL
from sympy.utilities.randtest import verify_numerically
import sympy
+import mpmath
a, b, c, d, e, q, t, x, y, z = symbols('a,b,c,d,e,q,t,x,y,z')
@@ -584,7 +585,7 @@ def test_nroots1():
n = 64
p = legendre_poly(n, x, polys=True)
- raises(sympy.mpmath.mp.NoConvergence, lambda: p.nroots(n=3, maxsteps=5))
+ raises(mpmath.mp.NoConvergence, lambda: p.nroots(n=3, maxsteps=5))
roots = p.nroots(n=3)
# The order of roots matters. They are ordered from smallest to the
--- ./sympy/printing/latex.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/printing/latex.py 2014-12-04 10:31:04.391339702 -0700
@@ -15,8 +15,8 @@ from .printer import Printer
from .conventions import split_super_sub, requires_partial
from .precedence import precedence, PRECEDENCE
-import sympy.mpmath.libmp as mlib
-from sympy.mpmath.libmp import prec_to_dps
+import mpmath.libmp as mlib
+from mpmath.libmp import prec_to_dps
from sympy.core.compatibility import default_sort_key, xrange
from sympy.utilities.iterables import has_variety
--- ./sympy/printing/repr.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/printing/repr.py 2014-12-04 10:31:04.392339701 -0700
@@ -9,8 +9,8 @@ from __future__ import print_function, d
from sympy.core.function import AppliedUndef
from .printer import Printer
-import sympy.mpmath.libmp as mlib
-from sympy.mpmath.libmp import prec_to_dps, repr_dps
+import mpmath.libmp as mlib
+from mpmath.libmp import prec_to_dps, repr_dps
class ReprPrinter(Printer):
--- ./sympy/printing/str.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/printing/str.py 2014-12-04 10:31:04.392339701 -0700
@@ -10,8 +10,8 @@ from sympy.core.numbers import Integer
from .printer import Printer
from sympy.printing.precedence import precedence, PRECEDENCE
-import sympy.mpmath.libmp as mlib
-from sympy.mpmath.libmp import prec_to_dps
+import mpmath.libmp as mlib
+from mpmath.libmp import prec_to_dps
from sympy.utilities import default_sort_key
--- ./sympy/sets/sets.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/sets/sets.py 2014-12-04 11:10:31.446662910 -0700
@@ -13,7 +13,7 @@ from sympy.core.decorators import deprec
from sympy.core.mul import Mul
from sympy.sets.contains import Contains
-from sympy.mpmath import mpi, mpf
+from mpmath import mpi, mpf
from sympy.logic.boolalg import And, Or, Not, true, false
from sympy.utilities import default_sort_key, subsets
--- ./sympy/sets/tests/test_sets.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/sets/tests/test_sets.py 2014-12-04 11:10:10.615676162 -0700
@@ -2,7 +2,7 @@ from sympy import (Symbol, Set, Union, I
GreaterThan, LessThan, Max, Min, And, Or, Eq, Ge, Le, Gt, Lt, Float,
FiniteSet, Intersection, imageset, I, true, false, ProductSet, E,
sqrt, Complement, EmptySet, sin, cos, Lambda, ImageSet, pi)
-from sympy.mpmath import mpi
+from mpmath import mpi
from sympy.utilities.pytest import raises
from sympy.utilities.pytest import raises, XFAIL
--- ./sympy/simplify/simplify.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/simplify/simplify.py 2014-12-04 10:31:04.393339699 -0700
@@ -34,7 +34,7 @@ from sympy.ntheory.factor_ import multip
from sympy.polys import (Poly, together, reduced, cancel, factor,
ComputationFailed, lcm, gcd)
-import sympy.mpmath as mpmath
+import mpmath
def _mexpand(expr):
--- ./sympy/solvers/solvers.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/solvers/solvers.py 2014-12-04 10:31:04.394339698 -0700
@@ -47,7 +47,7 @@ from sympy.utilities.lambdify import lam
from sympy.utilities.misc import filldedent
from sympy.utilities.iterables import uniq, generate_bell, flatten
-from sympy.mpmath import findroot
+from mpmath import findroot
from sympy.solvers.polysys import solve_poly_system
from sympy.solvers.inequalities import reduce_inequalities
@@ -2417,8 +2417,8 @@ def nsolve(*args, **kwargs):
Overdetermined systems are supported.
>>> from sympy import Symbol, nsolve
- >>> import sympy
- >>> sympy.mpmath.mp.dps = 15
+ >>> import mpmath, sympy
+ >>> mpmath.mp.dps = 15
>>> x1 = Symbol('x1')
>>> x2 = Symbol('x2')
>>> f1 = 3 * x1**2 - 2 * x2**2 - 1
--- ./sympy/solvers/tests/test_numeric.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/solvers/tests/test_numeric.py 2014-12-04 10:31:04.395339696 -0700
@@ -1,5 +1,5 @@
from sympy import Eq, Matrix, pi, sin, sqrt, Symbol, Integral, Piecewise, symbols
-from sympy.mpmath import mnorm, mpf
+from mpmath import mnorm, mpf
from sympy.solvers import nsolve
from sympy.utilities.lambdify import lambdify
from sympy.utilities.pytest import raises, XFAIL
--- ./sympy/utilities/decorator.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/utilities/decorator.py 2014-12-04 10:31:06.039336987 -0700
@@ -81,7 +81,7 @@ def conserve_mpmath_dps(func):
"""After the function finishes, resets the value of mpmath.mp.dps to
the value it had before the function was run."""
import functools
- from sympy import mpmath
+ import mpmath
def func_wrapper():
dps = mpmath.mp.dps
--- ./sympy/utilities/lambdify.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/utilities/lambdify.py 2014-12-04 10:31:06.040336985 -0700
@@ -93,7 +93,7 @@ NUMEXPR_TRANSLATIONS = {}
# Available modules:
MODULES = {
"math": (MATH, MATH_DEFAULT, MATH_TRANSLATIONS, ("from math import *",)),
- "mpmath": (MPMATH, MPMATH_DEFAULT, MPMATH_TRANSLATIONS, ("from sympy.mpmath import *",)),
+ "mpmath": (MPMATH, MPMATH_DEFAULT, MPMATH_TRANSLATIONS, ("from mpmath import *",)),
"numpy": (NUMPY, NUMPY_DEFAULT, NUMPY_TRANSLATIONS, ("import_module('numpy')",)),
"sympy": (SYMPY, SYMPY_DEFAULT, {}, (
"from sympy.functions import *",
--- ./sympy/utilities/runtests.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/utilities/runtests.py 2014-12-04 11:05:35.646805355 -0700
@@ -473,7 +473,7 @@ def _test(*paths, **kwargs):
split = kwargs.get('split', None)
blacklist = kwargs.get('blacklist', [])
blacklist.extend([
- "sympy/mpmath", # needs to be fixed upstream
+ "mpmath", # needs to be fixed upstream
])
blacklist = convert_to_native_paths(blacklist)
r = PyTestReporter(verbose=verbose, tb=tb, colors=colors,
@@ -607,7 +607,7 @@ def _doctest(*paths, **kwargs):
split = kwargs.get('split', None)
blacklist.extend([
"doc/src/modules/mpmath", # needs to be fixed upstream
- "sympy/mpmath", # needs to be fixed upstream
+ "mpmath", # needs to be fixed upstream
"doc/src/modules/plotting.rst", # generates live plots
"sympy/utilities/compilef.py", # needs tcc
"sympy/physics/gaussopt.py", # raises deprecation warning
--- ./sympy/utilities/tests/diagnose_imports.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/utilities/tests/diagnose_imports.py 2014-12-04 10:31:06.041336983 -0700
@@ -117,7 +117,7 @@ if __name__ == "__main__":
"""Is module relevant for import checking?
Only imports between relevant modules will be checked."""
- return in_module(module, 'sympy') and not in_module(module, 'sympy.mpmath')
+ return in_module(module, 'sympy') and not in_module(module, 'mpmath')
sorted_messages = []
--- ./sympy/utilities/tests/test_lambdify.py.orig 2014-11-20 13:00:41.000000000 -0700
+++ ./sympy/utilities/tests/test_lambdify.py 2014-12-04 10:31:06.041336983 -0700
@@ -3,7 +3,7 @@ from sympy import (
symbols, lambdify, sqrt, sin, cos, tan, pi, atan, acos, acosh, Rational,
Float, Matrix, Lambda, exp, Integral, oo, I, Abs, Function, true, false)
from sympy.printing.lambdarepr import LambdaPrinter
-from sympy import mpmath
+import mpmath
from sympy.utilities.lambdify import implemented_function
from sympy.utilities.pytest import skip
from sympy.utilities.decorator import conserve_mpmath_dps

View File

@ -1,353 +0,0 @@
--- doc/src/gotchas.rst.orig 2015-09-03 14:34:00.000000000 -0600
+++ doc/src/gotchas.rst 2015-11-21 15:24:18.475852154 -0700
@@ -148,7 +148,7 @@ See the Python docs for more information
If you define a circular relationship, you will get a
-:exc:`RuntimeError`.
+:exc:`RecursionError`.
>>> def a():
... return b()
@@ -169,7 +169,7 @@ If you define a circular relationship, y
File "<...>", line 2, in a
return b()
...
- RuntimeError: maximum recursion depth exceeded
+ RecursionError: maximum recursion depth exceeded
.. note::
--- sympy/concrete/expr_with_limits.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/concrete/expr_with_limits.py 2015-11-21 15:26:31.337139532 -0700
@@ -25,12 +25,12 @@ def _process_limits(*symbols):
limits = []
orientation = 1
for V in symbols:
- if isinstance(V, Symbol):
+ if isinstance(V, Symbol) or getattr(V, '_diff_wrt', False):
limits.append(Tuple(V))
continue
elif is_sequence(V, Tuple):
V = sympify(flatten(V))
- if V[0].is_Symbol:
+ if V[0].is_Symbol or getattr(V[0], '_diff_wrt', False):
newsymbol = V[0]
if len(V) == 2 and isinstance(V[1], Interval):
V[1:] = [V[1].start, V[1].end]
--- sympy/parsing/sympy_parser.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/parsing/sympy_parser.py 2015-11-21 15:28:46.742218940 -0700
@@ -568,6 +568,8 @@ def lambda_notation(tokens, local_dict,
if tokNum == OP and tokVal == ':':
tokVal = ','
flag = True
+ if not flag and tokNum == OP and tokVal in ['*', '**']:
+ raise TokenError("Starred arguments in lambda not supported")
if flag:
result.insert(-1, (tokNum, tokVal))
else:
--- sympy/physics/vector/frame.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/physics/vector/frame.py 2015-11-21 15:30:46.308575762 -0700
@@ -45,7 +45,11 @@ class CoordinateSym(Symbol):
"""
def __new__(cls, name, frame, index):
- obj = super(CoordinateSym, cls).__new__(cls, name)
+ # We can't use the cached Symbol.__new__ because this class depends on
+ # frame and index, which are not passed to Symbol.__xnew__.
+ assumptions = {}
+ super(CoordinateSym, cls)._sanitize(assumptions, cls)
+ obj = super(CoordinateSym, cls).__xnew__(cls, name, **assumptions)
_check_frame(frame)
if index not in range(0, 3):
raise ValueError("Invalid index specified")
--- sympy/printing/pretty/pretty.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/printing/pretty/pretty.py 2015-11-21 15:35:28.750796441 -0700
@@ -761,82 +761,77 @@ class PrettyPrinter(Printer):
if not self._use_unicode:
raise NotImplementedError("ASCII pretty printing of BasisDependent is not implemented")
- class Fake(object):
- baseline = 0
- # slf to distinguish from self from _print_BasisDependent
- def render(slf, *args, **kwargs):
- if expr == expr.zero:
- return expr.zero._pretty_form
- o1 = []
- vectstrs = []
- if isinstance(expr, Vector):
- items = expr.separate().items()
+ if expr == expr.zero:
+ return prettyForm(expr.zero._pretty_form)
+ o1 = []
+ vectstrs = []
+ if isinstance(expr, Vector):
+ items = expr.separate().items()
+ else:
+ items = [(0, expr)]
+ for system, vect in items:
+ inneritems = list(vect.components.items())
+ inneritems.sort(key = lambda x: x[0].__str__())
+ for k, v in inneritems:
+ #if the coef of the basis vector is 1
+ #we skip the 1
+ if v == 1:
+ o1.append(u("") +
+ k._pretty_form)
+ #Same for -1
+ elif v == -1:
+ o1.append(u("(-1) ") +
+ k._pretty_form)
+ #For a general expr
else:
- items = [(0, expr)]
- for system, vect in items:
- inneritems = list(vect.components.items())
- inneritems.sort(key = lambda x: x[0].__str__())
- for k, v in inneritems:
- #if the coef of the basis vector is 1
- #we skip the 1
- if v == 1:
- o1.append(u("") +
- k._pretty_form)
- #Same for -1
- elif v == -1:
- o1.append(u("(-1) ") +
- k._pretty_form)
- #For a general expr
- else:
- #We always wrap the measure numbers in
- #parentheses
- arg_str = self._print(
- v).parens()[0]
+ #We always wrap the measure numbers in
+ #parentheses
+ arg_str = self._print(
+ v).parens()[0]
- o1.append(arg_str + ' ' + k._pretty_form)
- vectstrs.append(k._pretty_form)
+ o1.append(arg_str + ' ' + k._pretty_form)
+ vectstrs.append(k._pretty_form)
- #outstr = u("").join(o1)
- if o1[0].startswith(u(" + ")):
- o1[0] = o1[0][3:]
- elif o1[0].startswith(" "):
- o1[0] = o1[0][1:]
- #Fixing the newlines
- lengths = []
- strs = ['']
- for i, partstr in enumerate(o1):
- # XXX: What is this hack?
- if '\n' in partstr:
- tempstr = partstr
- tempstr = tempstr.replace(vectstrs[i], '')
- tempstr = tempstr.replace(u('\u239e'),
- u('\u239e')
- + ' ' + vectstrs[i])
- o1[i] = tempstr
- o1 = [x.split('\n') for x in o1]
- n_newlines = max([len(x) for x in o1])
- for parts in o1:
- lengths.append(len(parts[0]))
- for j in range(n_newlines):
- if j+1 <= len(parts):
- if j >= len(strs):
- strs.append(' ' * (sum(lengths[:-1]) +
- 3*(len(lengths)-1)))
- if j == 0:
- strs[0] += parts[0] + ' + '
- else:
- strs[j] += parts[j] + ' '*(lengths[-1] -
- len(parts[j])+
- 3)
- else:
- if j >= len(strs):
- strs.append(' ' * (sum(lengths[:-1]) +
- 3*(len(lengths)-1)))
- strs[j] += ' '*(lengths[-1]+3)
+ #outstr = u("").join(o1)
+ if o1[0].startswith(u(" + ")):
+ o1[0] = o1[0][3:]
+ elif o1[0].startswith(" "):
+ o1[0] = o1[0][1:]
+ #Fixing the newlines
+ lengths = []
+ strs = ['']
+ for i, partstr in enumerate(o1):
+ # XXX: What is this hack?
+ if '\n' in partstr:
+ tempstr = partstr
+ tempstr = tempstr.replace(vectstrs[i], '')
+ tempstr = tempstr.replace(u('\N{RIGHT PARENTHESIS UPPER HOOK}'),
+ u('\N{RIGHT PARENTHESIS UPPER HOOK}')
+ + ' ' + vectstrs[i])
+ o1[i] = tempstr
+ o1 = [x.split('\n') for x in o1]
+ n_newlines = max([len(x) for x in o1])
+ for parts in o1:
+ lengths.append(len(parts[0]))
+ for j in range(n_newlines):
+ if j+1 <= len(parts):
+ if j >= len(strs):
+ strs.append(' ' * (sum(lengths[:-1]) +
+ 3*(len(lengths)-1)))
+ if j == 0:
+ strs[0] += parts[0] + ' + '
+ else:
+ strs[j] += parts[j] + ' '*(lengths[-1] -
+ len(parts[j])+
+ 3)
+ else:
+ if j >= len(strs):
+ strs.append(' ' * (sum(lengths[:-1]) +
+ 3*(len(lengths)-1)))
+ strs[j] += ' '*(lengths[-1]+3)
- return u('\n').join([s[:-3] for s in strs])
- return Fake()
+ return prettyForm(u('\n').join([s[:-3] for s in strs]))
def _print_Piecewise(self, pexpr):
--- sympy/printing/pretty/stringpict.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/printing/pretty/stringpict.py 2015-11-21 15:36:01.748135163 -0700
@@ -29,6 +29,7 @@ class stringPict(object):
"""Initialize from string.
Multiline strings are centered.
"""
+ self.s = s
#picture is a string that just can be printed
self.picture = stringPict.equalLengths(s.splitlines())
#baseline is the line number of the "base line"
--- sympy/printing/pretty/tests/test_pretty.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/printing/pretty/tests/test_pretty.py 2015-11-21 15:37:58.227740936 -0700
@@ -14,6 +14,8 @@ from sympy.functions import (Abs, Chi, C
lowergamma, meijerg, sin, sqrt, subfactorial, tan, uppergamma,
elliptic_k, elliptic_f, elliptic_e, elliptic_pi)
+from sympy.matrices import Adjoint, Inverse, MatrixSymbol, Transpose
+
from sympy.printing.pretty import pretty as xpretty
from sympy.printing.pretty import pprint
@@ -2478,7 +2480,6 @@ u("""\
def test_Adjoint():
- from sympy.matrices import Adjoint, Inverse, MatrixSymbol, Transpose
X = MatrixSymbol('X', 2, 2)
Y = MatrixSymbol('Y', 2, 2)
assert pretty(Adjoint(X)) == " +\nX "
@@ -2511,6 +2512,26 @@ def test_Adjoint():
u(" T\n⎛ †⎞ \n⎝X ⎠ ")
+def test_MatrixExpressions():
+ n = Symbol('n', integer=True)
+ X = MatrixSymbol('X', n, n)
+
+ assert pretty(X) == upretty(X) == "X"
+
+ Y = X[1:2:3, 4:5:6]
+
+ ascii_str = ucode_str = "X[1:3, 4:6]"
+
+ assert pretty(Y) == ascii_str
+ assert upretty(Y) == ucode_str
+
+ Z = X[1:10:2]
+
+ ascii_str = ucode_str = "X[1:10:2, :n]"
+
+ assert pretty(Z) == ascii_str
+ assert upretty(Z) == ucode_str
+
def test_pretty_piecewise():
expr = Piecewise((x, x < 1), (x**2, True))
ascii_str = \
--- sympy/vector/coordsysrect.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/vector/coordsysrect.py 2015-11-21 15:44:01.012479961 -0700
@@ -436,6 +436,12 @@ class CoordSysCartesian(Basic):
final_matrix = orienters.rotation_matrix(self)
else:
final_matrix = orienters.rotation_matrix()
+ # TODO: trigsimp is needed here so that the matrix becomes
+ # canonical (scalar_map also calls trigsimp; without this, you can
+ # end up with the same CoordinateSystem that compares differently
+ # due to a differently formatted matrix). However, this is
+ # probably not so good for performance.
+ final_matrix = trigsimp(final_matrix)
else:
final_matrix = Matrix(eye(3))
for orienter in orienters:
--- sympy/vector/deloperator.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/vector/deloperator.py 2015-11-21 15:44:44.065004287 -0700
@@ -3,6 +3,7 @@ from sympy.core.function import Derivati
from sympy.vector.vector import Vector
from sympy.vector.functions import express
from sympy.vector.coordsysrect import CoordSysCartesian
+from sympy.vector.scalar import BaseScalar
from sympy.core import S
@@ -171,6 +172,6 @@ def _diff_conditional(expr, base_scalar)
"""
new_expr = express(expr, base_scalar.system, variables = True)
- if base_scalar in new_expr.atoms():
+ if base_scalar in new_expr.atoms(BaseScalar):
return Derivative(new_expr, base_scalar)
return S(0)
--- sympy/vector/functions.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/vector/functions.py 2015-11-21 15:46:08.050224073 -0700
@@ -69,9 +69,8 @@ def express(expr, system, system2=None,
#If variables attribute is True, substitute
#the coordinate variables in the Vector
system_list = []
- for x in expr.atoms():
- if (isinstance(x, (BaseScalar, BaseVector))
- and x.system != system):
+ for x in expr.atoms(BaseScalar, BaseVector):
+ if x.system != system:
system_list.append(x.system)
system_list = set(system_list)
subs_dict = {}
@@ -113,8 +112,8 @@ def express(expr, system, system2=None,
system_set = set([])
expr = sympify(expr)
#Subsitute all the coordinate variables
- for x in expr.atoms():
- if isinstance(x, BaseScalar)and x.system != system:
+ for x in expr.atoms(BaseScalar):
+ if x.system != system:
system_set.add(x.system)
subs_dict = {}
for f in system_set:
--- sympy/vector/point.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/vector/point.py 2015-11-21 15:47:51.025910739 -0700
@@ -15,11 +15,11 @@ class Point(Basic):
def __new__(cls, name, position=Vector.zero, parent_point=None):
#Check the args first
if not isinstance(position, Vector):
- raise TypeError("position should be a Vector instance")
+ raise TypeError("position should be an instance of Vector, not %s" % type(position))
if (not isinstance(parent_point, Point)
and parent_point is not None):
- raise TypeError("parent_point should be a Point instance")
- #Create an object
+ raise TypeError("parent_point should be an instance of Point, not %s" % type(parent_point))
+ # Super class construction
if parent_point is None:
arg_parent = Symbol('default')
arg_self = Symbol(name)
--- sympy/vector/tests/test_field_functions.py.orig 2015-09-03 14:34:00.000000000 -0600
+++ sympy/vector/tests/test_field_functions.py 2015-11-21 15:55:13.935154218 -0700
@@ -219,4 +219,4 @@ def test_scalar_potential_difference():
(P.x*cos(q) - P.y*sin(q))**2)
assert (scalar_potential_difference(grad_field, P, P.origin,
genericpointP).simplify() ==
- potential_diff_P)
+ potential_diff_P.simplify())

33
sympy-test.patch Normal file
View File

@ -0,0 +1,33 @@
--- sympy/plotting/tests/test_plot_implicit.py.orig 2016-03-08 11:35:33.000000000 -0700
+++ sympy/plotting/tests/test_plot_implicit.py 2016-03-26 14:46:10.574521937 -0600
@@ -55,14 +55,12 @@ def plot_implicit_tests(name):
#Test plots which cannot be rendered using the adaptive algorithm
with warnings.catch_warnings(record=True) as w:
plot_and_save(Eq(y, re(cos(x) + I*sin(x))), name=name)
- assert len(w) == 1
- assert issubclass(w[-1].category, UserWarning)
+ assert issubclass(w[0].category, UserWarning)
assert "Adaptive meshing could not be applied" in str(w[0].message)
with warnings.catch_warnings(record=True) as w:
plot_and_save(x**2 - 1, legend='An implicit plot')
- assert len(w) == 1
- assert issubclass(w[-1].category, UserWarning)
+ assert issubclass(w[0].category, UserWarning)
assert 'No labelled objects found' in str(w[0].message)
def test_line_color():
--- sympy/plotting/tests/test_plot.py.orig 2016-03-08 11:35:33.000000000 -0700
+++ sympy/plotting/tests/test_plot.py 2016-03-26 14:45:27.323017358 -0600
@@ -244,8 +244,9 @@ def plot_and_save(name):
p.save(tmp_file('%s_advanced_integral' % name))
p._backend.close()
# Make sure no other warnings were raised
- assert len(w) == 1
- assert issubclass(w[-1].category, UserWarning)
+ assert len(w) == 2
+ assert issubclass(w[0].category, UserWarning)
+ assert issubclass(w[1].category, FutureWarning)
assert "The evaluation of the expression is problematic" in str(w[0].message)
s = Sum(1/x**y, (x, 1, oo))

View File

@ -1,16 +1,12 @@
Name: sympy
Version: 0.7.6.1
Release: 3%{?dist}
Version: 1.0
Release: 1%{?dist}
Summary: A Python library for symbolic mathematics
License: BSD
URL: http://sympy.org/
Source0: https://github.com/%{name}/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
# Upstream tried to graft in another project as a private copy; we rip
# it out (rhbz# 551576):
Patch0: %{name}-0.7.6-strip-internal-mpmath.patch
Patch1: https://github.com/AadityaNair/sympy/commit/1be64700c1063eff2b2747ce63ca03eac797b4a4.patch
# This is https://github.com/sympy/sympy/pull/10084/ adapted to 0.7.6.1
Patch2: %{name}-python35.patch
Source0: https://github.com/%{name}/%{name}/archive/%{name}-%{version}.tar.gz
# Fix two test failures with recent mpmath versions
Patch0: %{name}-test.patch
BuildArch: noarch
BuildRequires: gcc-gfortran
@ -21,24 +17,26 @@ BuildRequires: librsvg2-tools
BuildRequires: numpy python3-numpy
BuildRequires: numpy-f2py python3-numpy-f2py
BuildRequires: python2-devel python3-devel
BuildRequires: python-fastcache python3-fastcache
BuildRequires: python-gmpy2 python3-gmpy2
BuildRequires: python-matplotlib python3-matplotlib
BuildRequires: python2-fastcache python3-fastcache
BuildRequires: python2-gmpy2 python3-gmpy2
BuildRequires: python2-matplotlib python3-matplotlib
BuildRequires: python-mpmath python3-mpmath
BuildRequires: python-sphinx
BuildRequires: scipy python3-scipy
BuildRequires: python2-scipy python3-scipy
BuildRequires: python2-sphinx
BuildRequires: tex(latex)
BuildRequires: tex-dvipng
BuildRequires: xorg-x11-fonts-Type1
BuildRequires: xorg-x11-server-Xvfb
Requires: python-fastcache
Requires: python-gmpy2
Requires: python-matplotlib
Requires: mesa-libGLU
Requires: python2-fastcache
Requires: python2-gmpy2
Requires: python2-matplotlib
Requires: python-mpmath
Requires: python-pyglet
Recommends: python-theano
Recommends: python2-scipy
Recommends: python2-theano
%description
SymPy aims to become a full-featured computer algebra system (CAS)
@ -48,12 +46,14 @@ Python and does not require any external libraries.
%package -n python3-%{name}
Summary: A Python3 library for symbolic mathematics
Requires: mesa-libGLU
Requires: python3-fastcache
Requires: python3-gmpy2
Requires: python3-matplotlib
Requires: python3-mpmath
Requires: python3-pyglet
Recommends: python3-scipy
Recommends: python3-theano
%description -n python3-%{name}
@ -84,58 +84,54 @@ Provides: bundled(jquery)
%description doc
HTML documentation for sympy.
%global sympydir %{name}-%{name}-%{version}
%prep
%setup -q
%patch0 -b .mpmath
%patch1 -p1
rm -rf sympy/mpmath doc/src/modules/mpmath
rm -rf %{name}-%{version}/sympy/mpmath %{name}-%{version}/doc/src/module/mpmath
%setup -q -c
fixtimestamp() {
touch -r $1.orig $1
rm -f $1.org
}
# One plotting test expects one warning, but the same warning is triggered in
# a different spot with recent versions of python, leading to an assertion
# failure.
sed -e '/import warnings/ifrom sympy.utilities.pytest import XFAIL' \
-e '/^def test_matplotlib():/i@XFAIL' \
-i.orig sympy/plotting/tests/test_plot_implicit.py
fixtimestamp sympy/plotting/tests/test_plot_implicit.py
# Do not depend on env
for fil in $(grep -Frl "%{_bindir}/env python" .); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python,' $fil
touch -r $fil.orig $fil
rm -f $fil.orig
done
# The classic sphinx theme is explicitly needed.
sed -i '/html_theme/ihtml_theme = "classic"' doc/src/conf.py
sed -i "/html_style/ahtml_theme = 'classic'" %{sympydir}/doc/src/conf.py
# Make a copy for building the python3 version
rm -rf %{py3dir}
cp -a . %{py3dir}
pushd %{py3dir}
%patch2
cp -a %{sympydir} python3
pushd python3
%patch0
popd
%build
# Build the python2 version
pushd %{sympydir}
%py2_build
popd
# Build the python3 version
pushd %{py3dir}
pushd python3
%py3_build
popd
# Build the documentation
cd doc
pushd %{sympydir}/doc
make html
make cheatsheet
pushd %{py3dir}/doc
popd
pushd python3/doc
make cheatsheet
popd
%install
# Install the python3 version
pushd %{py3dir}
pushd python3
%py3_install
sed -i 's/env python/python3/' %{buildroot}%{_bindir}/isympy
sed -i 's,%{_bindir}/python,&3,' %{buildroot}%{_bindir}/isympy
chmod a+x %{buildroot}%{_bindir}/isympy
touch -r bin/isympy %{buildroot}%{_bindir}/isympy
mv %{buildroot}%{_bindir}/isympy %{buildroot}%{_bindir}/python3-isympy
mv %{buildroot}%{_mandir}/man1/isympy.1 \
@ -143,69 +139,82 @@ mv %{buildroot}%{_mandir}/man1/isympy.1 \
popd
# Install the python2 version
pushd %{sympydir}
%py2_install
sed -i 's/env python/python2/' %{buildroot}%{_bindir}/isympy
touch -r bin/isympy %{buildroot}%{_bindir}/isympy
popd
## Remove extra files
rm -f %{buildroot}%{_bindir}/{,doc}test
## Install the TeXmacs integration
pushd %{sympydir}
sed 's/python/python2/' data/TeXmacs/bin/tm_sympy > \
%{buildroot}%{_bindir}/tm_sympy
chmod a+x %{buildroot}%{_bindir}/tm_sympy
touch -r data/TeXmacs/bin/tm_sympy %{buildroot}%{_bindir}/tm_sympy
mkdir -p %{buildroot}%{_datadir}/TeXmacs/plugins/sympy
cp -a data/TeXmacs/progs %{buildroot}%{_datadir}/TeXmacs/plugins/sympy
chmod a-x %{buildroot}%{_datadir}/TeXmacs/plugins/sympy/progs/*.scm
# Don't let an executable script go into the documentation
chmod a-x examples/all.py
# Convert the README to HTML
python2 %{_bindir}/rst2html --no-datestamp README.rst README.html
# Install the HTML documentation
mkdir -p %{buildroot}%{_docdir}/%{name}-doc
cp -a doc/_build/html %{buildroot}%{_docdir}/%{name}-doc
rm -f %{buildroot}%{_docdir}/%{name}-doc/html/.buildinfo
rm -fr %{buildroot}%{_docdir}/%{name}-doc/i18n
# Stash the python3 build of the cheatsheet where %%doc can find it
cp -p %{py3dir}/doc/_build/cheatsheet/combinatoric_cheatsheet.pdf .
popd
%check
let "dnum = $RANDOM % 90 + 10"
xvfb-run -n $dnum python2 setup.py test
pushd %{py3dir}
xvfb-run -n $dnum python3 setup.py test
pushd %{sympydir}
xvfb-run -a -n $dnum python2 setup.py test
popd
pushd python3
xvfb-run -a -n $dnum python3 setup.py test
popd
%files
%doc AUTHORS README.rst doc/_build/cheatsheet/combinatoric_cheatsheet.pdf
%license LICENSE
%doc %{sympydir}/AUTHORS %{sympydir}/CODE_OF_CONDUCT.md %{sympydir}/README.html
%doc %{sympydir}/doc/_build/cheatsheet/combinatoric_cheatsheet.pdf
%license %{sympydir}/LICENSE
%{python2_sitelib}/sympy/
%{python2_sitelib}/sympy-%{version}-*.egg-info
%{_bindir}/isympy
%{_mandir}/man1/isympy.1*
%files -n python3-%{name}
%doc AUTHORS README.rst combinatoric_cheatsheet.pdf
%license LICENSE
%doc python3/AUTHORS python3/CODE_OF_CONDUCT.md %{sympydir}/README.html
%doc python3/doc/_build/cheatsheet/combinatoric_cheatsheet.pdf
%license python3/LICENSE
%{python3_sitelib}/sympy/
%{python3_sitelib}/sympy-%{version}-*.egg-info
%{_bindir}/python3-isympy
%{_mandir}/man1/python3-isympy.1*
%files texmacs
%license data/TeXmacs/LICENSE
%license %{sympydir}/data/TeXmacs/LICENSE
%{_bindir}/tm_sympy
%{_datadir}/TeXmacs/plugins/sympy/
%files examples
%doc examples
%doc %{sympydir}/examples/*
%files doc
%docdir %{_docdir}/%{name}-doc/html
%{_docdir}/%{name}-doc/html
%changelog
* Thu Mar 31 2016 Jerry James <loganjerry@gmail.com> - 1.0-1
- Update to 1.0
- All patches have been upstreamed; drop them all
- Add -test patch to fix test failures with recent mpmath
- Recommend scipy
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild