Skip to content

Commit

Permalink
Merge pull request #84 from skirpichev/remove-sage-supp
Browse files Browse the repository at this point in the history
Removed sage support
  • Loading branch information
skirpichev committed May 17, 2015
2 parents 5e8d658 + 763f1d9 commit a7c1fba
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 509 deletions.
16 changes: 1 addition & 15 deletions .travis.yml
Expand Up @@ -15,9 +15,6 @@ matrix:
- python: 2.7
env:
- TEST_SPHINX="true"
- python: 2.7
env:
- TEST_SAGE="true"
- python: "pypy3"
env:
- TEST_DOCTESTS="true"
Expand All @@ -27,10 +24,6 @@ matrix:
- python: "pypy3"
env:
- SPLIT="2/2"
allow_failures:
- python: 2.7
env:
- TEST_SAGE="true"
before_install:
- if [[ "${TEST_SPHINX}" == "true" ]]; then
sudo apt-get update;
Expand All @@ -43,11 +36,6 @@ before_install:
travis_wait 30 pip install numpy==1.7.1 scipy==0.12.0 gmpy==1.16 Theano==0.6;
travis_wait 30 pip install --allow-external matplotlib==1.2.1;
fi
- if [[ "${TEST_SAGE}" == "true" ]]; then
sudo apt-add-repository -y ppa:aims/sagemath;
sudo apt-get update;
travis_wait 30 sudo apt-get install sagemath-upstream-binary;
fi
- if [[ "${TEST_PEP}" == "true" ]]; then
pip install pep8==1.6.2;
fi
Expand All @@ -56,9 +44,7 @@ before_install:
pip install pytest-cov coveralls --use-mirrors;
fi
install:
- if [[ "${TEST_SAGE}" != "true" ]]; then
python setup.py install;
fi
python setup.py install;
script:
- if [[ "${TEST_PEP}" == "true" ]]; then
pep8;
Expand Down
3 changes: 0 additions & 3 deletions bin/test_travis.sh
Expand Up @@ -5,9 +5,6 @@ set -e -x # exit on error and echo each command
if [[ "${TEST_SPHINX}" == "true" ]]; then
make -C doc html-errors man latex
LATEXOPTIONS="-interaction=nonstopmode" make -C doc/_build/latex
elif [[ "${TEST_SAGE}" == "true" ]]; then
sage -v
sage -python py.test sympy/external/tests/test_sage.py
else
if [[ "${TEST_DOCTESTS}" == "true" ]]; then
cat << EOF | python
Expand Down
6 changes: 0 additions & 6 deletions sympy/core/add.py
Expand Up @@ -725,12 +725,6 @@ def _eval_transpose(self):
def __neg__(self):
return self.func(*[-t for t in self.args])

def _sage_(self):
s = 0
for x in self.args:
s += x._sage_()
return s

def primitive(self):
"""
Return ``(R, self/R)`` where ``R``` is the Rational GCD of ``self```.
Expand Down
18 changes: 0 additions & 18 deletions sympy/core/function.py
Expand Up @@ -676,13 +676,6 @@ def _eval_as_leading_term(self, x):
else:
return self.func(*args)

def _sage_(self):
import sage.all as sage
fname = self.func.__name__
func = getattr(sage, fname)
args = [arg._sage_() for arg in self.args]
return func(*args)


class AppliedUndef(Function):
"""
Expand All @@ -698,12 +691,6 @@ def __new__(cls, *args, **options):
def _eval_as_leading_term(self, x):
return self

def _sage_(self):
import sage.all as sage
fname = str(self.func)
args = [arg._sage_() for arg in self.args]
func = sage.function(fname, *args)
return func

class UndefinedFunction(FunctionClass):
"""
Expand Down Expand Up @@ -1320,11 +1307,6 @@ def _eval_nseries(self, x, n, logx):
def _eval_as_leading_term(self, x):
return self.args[0].as_leading_term(x)

def _sage_(self):
import sage.all as sage
args = [arg._sage_() for arg in self.args]
return sage.derivative(*args)


class Lambda(Expr):
"""
Expand Down
6 changes: 0 additions & 6 deletions sympy/core/mul.py
Expand Up @@ -1465,12 +1465,6 @@ def _eval_transpose(self):
def _eval_adjoint(self):
return self.func(*[t.adjoint() for t in self.args[::-1]])

def _sage_(self):
s = 1
for x in self.args:
s *= x._sage_()
return s

def as_content_primitive(self, radical=False):
"""Return the tuple (R, self/R) where R is the positive Rational
extracted from self.
Expand Down
46 changes: 0 additions & 46 deletions sympy/core/numbers.py
Expand Up @@ -1032,10 +1032,6 @@ def __hash__(self):
def epsilon_eq(self, other, epsilon="1e-15"):
return abs(self - other) < Float(epsilon)

def _sage_(self):
import sage.all as sage
return sage.RealNumber(str(self))

def __format__(self, format_spec):
return format(decimal.Decimal(str(self)), format_spec)

Expand Down Expand Up @@ -1557,10 +1553,6 @@ def lcm(self, other):
def as_numer_denom(self):
return Integer(self.p), Integer(self.q)

def _sage_(self):
import sage.all as sage
return sage.Integer(self.p)/sage.Integer(self.q)

def as_content_primitive(self, radical=False):
"""Return the tuple (R, self/R) where R is the positive Rational
extracted from self.
Expand Down Expand Up @@ -2471,10 +2463,6 @@ def _eval_power(self, expt):
def _as_mpf_val(self, prec):
return mlib.finf

def _sage_(self):
import sage.all as sage
return sage.oo

def __hash__(self):
return super(Infinity, self).__hash__()

Expand Down Expand Up @@ -2682,10 +2670,6 @@ def _eval_power(self, expt):
def _as_mpf_val(self, prec):
return mlib.fninf

def _sage_(self):
import sage.all as sage
return -(sage.oo)

def __hash__(self):
return super(NegativeInfinity, self).__hash__()

Expand Down Expand Up @@ -2835,10 +2819,6 @@ def __div__(self, other):
def _as_mpf_val(self, prec):
return _mpf_nan

def _sage_(self):
import sage.all as sage
return sage.NaN

def __hash__(self):
return super(NaN, self).__hash__()

Expand Down Expand Up @@ -2927,10 +2907,6 @@ def _eval_power(self, expt):
else:
return S.Zero

def _sage_(self):
import sage.all as sage
return sage.UnsignedInfinityRing.gen()


zoo = S.ComplexInfinity

Expand Down Expand Up @@ -3107,9 +3083,6 @@ def _eval_rewrite_as_cos(self):
I = S.ImaginaryUnit
return cos(I) + I*cos(I + S.Pi/2)

def _sage_(self):
import sage.all as sage
return sage.e
E = S.Exp1


Expand Down Expand Up @@ -3175,9 +3148,6 @@ def approximation_interval(self, number_cls):
elif issubclass(number_cls, Rational):
return (Rational(223, 71), Rational(22, 7))

def _sage_(self):
import sage.all as sage
return sage.pi
pi = S.Pi


Expand Down Expand Up @@ -3238,10 +3208,6 @@ def approximation_interval(self, number_cls):
elif issubclass(number_cls, Rational):
pass

def _sage_(self):
import sage.all as sage
return sage.golden_ratio


class EulerGamma(with_metaclass(Singleton, NumberSymbol)):
r"""The Euler-Mascheroni constant.
Expand Down Expand Up @@ -3298,10 +3264,6 @@ def approximation_interval(self, number_cls):
elif issubclass(number_cls, Rational):
return (S.Half, Rational(3, 5))

def _sage_(self):
import sage.all as sage
return sage.euler_gamma


class Catalan(with_metaclass(Singleton, NumberSymbol)):
r"""Catalan's constant.
Expand Down Expand Up @@ -3351,10 +3313,6 @@ def approximation_interval(self, number_cls):
elif issubclass(number_cls, Rational):
return (Rational(9, 10), S.One)

def _sage_(self):
import sage.all as sage
return sage.catalan


class ImaginaryUnit(with_metaclass(Singleton, AtomicExpr)):
r"""The imaginary unit, `i = \sqrt{-1}`.
Expand Down Expand Up @@ -3431,10 +3389,6 @@ def _eval_power(self, expt):
def as_base_exp(self):
return S.NegativeOne, S.Half

def _sage_(self):
import sage.all as sage
return sage.I

I = S.ImaginaryUnit


Expand Down
3 changes: 0 additions & 3 deletions sympy/core/power.py
Expand Up @@ -1317,9 +1317,6 @@ def _taylor_term(self, n, x, *previous_terms): # of (1+x)**e
from sympy import binomial
return binomial(self.exp, n) * self.func(x, n)

def _sage_(self):
return self.args[0]._sage_()**self.args[1]._sage_()

def as_content_primitive(self, radical=False):
"""Return the tuple (R, self/R) where R is the positive Rational
extracted from self.
Expand Down
4 changes: 0 additions & 4 deletions sympy/core/symbol.py
Expand Up @@ -148,10 +148,6 @@ def as_real_imag(self, deep=True, **hints):
else:
return (re(self), im(self))

def _sage_(self):
import sage.all as sage
return sage.var(self.name)

def is_constant(self, *wrt, **flags):
if not wrt:
return False
Expand Down
13 changes: 0 additions & 13 deletions sympy/core/tests/test_sympify.py
Expand Up @@ -212,19 +212,6 @@ def test_sympify_factorial():
raises(SympifyError, lambda: sympify("x!!!"))


def test_sage():
# how to effectivelly test for the _sage_() method without having SAGE
# installed?
assert hasattr(x, "_sage_")
assert hasattr(Integer(3), "_sage_")
assert hasattr(sin(x), "_sage_")
assert hasattr(cos(x), "_sage_")
assert hasattr(x**2, "_sage_")
assert hasattr(x + y, "_sage_")
assert hasattr(exp(x), "_sage_")
assert hasattr(log(x), "_sage_")


def test_issue_3595():
assert sympify("a_") == Symbol("a_")
assert sympify("_a") == Symbol("_a")
Expand Down

0 comments on commit a7c1fba

Please sign in to comment.