Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #32386
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 26, 2021
2 parents b552ee8 + 0d0b58f commit 525c860
Show file tree
Hide file tree
Showing 152 changed files with 48,938 additions and 323 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ __pycache__/
!/src/sage/stats/distributions/dgs_bern.c
!/src/sage/stats/distributions/dgs_gauss_dp.c
!/src/sage/stats/distributions/dgs_gauss_mp.c
!/src/sage/symbolic/ginac/*.cpp
/src/cython_debug

# Temporary build files
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/prep/Programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ Luckily, it's possible to restore symbolic constants.
::

sage: type(e)
<type 'sage.symbolic.constants_c.E'>
<type 'sage.symbolic.expression.E'>

::

Expand Down
7 changes: 3 additions & 4 deletions src/sage/calculus/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,11 @@
from sage.misc.parser import Parser, LookupNameMaker

from sage.symbolic.ring import var, SR, is_SymbolicVariable
from sage.symbolic.expression import Expression
from sage.symbolic.expression import Expression, symbol_table
from sage.symbolic.function import Function
from sage.symbolic.function_factory import function_factory
from sage.symbolic.integration.integral import (indefinite_integral,
definite_integral)
from sage.libs.pynac.pynac import symbol_table

from sage.misc.lazy_import import lazy_import
lazy_import('sage.interfaces.maxima_lib', 'maxima')
Expand Down Expand Up @@ -2151,11 +2150,11 @@ def _is_function(v):
Check that :trac:`31756` is fixed::
sage: from sage.libs.pynac.pynac import symbol_table
sage: from sage.symbolic.expression import symbol_table
sage: _is_function(symbol_table['mathematica']['Gamma'])
True
sage: from sage.libs.pynac.pynac import register_symbol
sage: from sage.symbolic.expression import register_symbol
sage: foo = lambda x: x^2 + 1
sage: register_symbol(foo, dict(mathematica='Foo')) # optional - mathematica
sage: mathematica('Foo[x]').sage() # optional - mathematica
Expand Down
2 changes: 1 addition & 1 deletion src/sage/functions/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from sage.symbolic.constants import pi
from sage.rings.rational import Rational
from sage.rings.infinity import unsigned_infinity
from sage.libs.pynac.pynac import I
from sage.symbolic.expression import I

class Function_erf(BuiltinFunction):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/functions/gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from sage.symbolic.function import GinacFunction, BuiltinFunction
from sage.libs.pynac.pynac import (register_symbol, symbol_table)
from sage.symbolic.expression import register_symbol, symbol_table
from sage.structure.all import parent as s_parent
from sage.rings.all import Rational, ComplexField
from sage.rings.complex_mpfr import is_ComplexNumber
Expand Down
4 changes: 1 addition & 3 deletions src/sage/functions/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@

from sage.libs.mpmath import utils as mpmath_utils
from sage.structure.all import parent as s_parent
from sage.symbolic.expression import Expression
from sage.symbolic.expression import Expression, register_symbol
from sage.rings.real_double import RDF
from sage.rings.complex_double import CDF
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ

from sage.libs.pynac.pynac import register_symbol


class Function_exp(GinacFunction):
r"""
Expand Down
3 changes: 1 addition & 2 deletions src/sage/functions/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
'gamma_inc_lower', 'psi', 'beta'), deprecation=24411)

from sage.symbolic.function import GinacFunction, BuiltinFunction
from sage.symbolic.expression import Expression
from sage.libs.pynac.pynac import (register_symbol, symbol_table, I)
from sage.symbolic.expression import Expression, register_symbol, symbol_table, I
from sage.symbolic.ring import SR
from sage.rings.all import Integer, Rational, RealField, ZZ, ComplexField
from sage.misc.latex import latex
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/fricas.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
from sage.rings.rational_field import QQ
from sage.rings.infinity import infinity
from sage.misc.lazy_import import lazy_import
lazy_import('sage.libs.pynac.pynac', ['symbol_table', 'register_symbol'])
lazy_import('sage.symbolic.expression', ['symbol_table', 'register_symbol'])
lazy_import('sage.calculus.var', ['var', 'function'])
lazy_import('sage.symbolic.constants', ['I', 'e', 'pi'])

Expand Down
4 changes: 2 additions & 2 deletions src/sage/interfaces/giac.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ def _sage_(self, locals={}):
Same but by adding a new entry to the ``symbol_table``::
sage: ex = giac('myFun(x)')
sage: sage.libs.pynac.pynac.register_symbol(sin, {'giac':'myFun'})
sage: sage.symbolic.expression.register_symbol(sin, {'giac':'myFun'})
sage: ex._sage_()
sin(x)
Expand All @@ -1127,7 +1127,7 @@ def _sage_(self, locals={}):
sage: giac(e * i * pi).sage().variables()
()
"""
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
from sage.calculus.calculus import symbolic_expression_from_string, SR_parser_giac

result = repr(self) # string representation
Expand Down
6 changes: 3 additions & 3 deletions src/sage/interfaces/mathematica.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def _sage_(self, locals={}):
sage: mathematica(RealField(100)(1/3)).sage() # optional - mathematica
0.3333333333333333333333333333335
"""
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
from sage.symbolic.constants import constants_name_table as constants
from sage.calculus.calculus import symbolic_expression_from_string
from sage.calculus.calculus import _find_func as find_func
Expand All @@ -815,7 +815,7 @@ def _sage_(self, locals={}):
# Find all the mathematica functions, constants and symbolic variables
# present in `res`. Convert MMA functions and constants to their
# Sage equivalents (if possible), using `locals` and
# `sage.libs.pynac.pynac.symbol_table['mathematica']` as translation
# `sage.symbolic.pynac.symbol_table['mathematica']` as translation
# dictionaries. If a MMA function or constant is not either
# dictionary, then we use a variety of tactics listed in `autotrans`.
# If a MMA variable is not in any dictionary, then create an
Expand Down Expand Up @@ -1275,7 +1275,7 @@ def symbolic_expression_from_mathematica_string(mexpr):
sage: symbolic_expression_from_mathematica_string(u'-Cos[x]')
-cos(x)
"""
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
from sage.symbolic.constants import constants_name_table as constants
from sage.calculus.calculus import symbolic_expression_from_string
from sage.calculus.calculus import _find_func as find_func
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/maxima_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ def sr_to_max(expr):
return maxima(expr).ecl()

# This goes from EclObject to SR
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
max_to_pynac_table = symbol_table['maxima']


Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _sympysage_function_by_name(fname):
import sympy
if getattr(sympy, fname, None) is None:
# symbolic function
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
func = symbol_table['functions'].get(fname)
if func is None:
from sage.calculus.var import function
Expand Down
14 changes: 7 additions & 7 deletions src/sage/libs/giac/giac.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ from sage.structure.element cimport Matrix
from sage.plot.line import line
from sage.plot.scatter_plot import scatter_plot
from sage.libs.pynac.pynac import symbol_table
from sage.symbolic.expression import symbol_table
from sage.calculus.calculus import symbolic_expression_from_string, SR_parser_giac
from sage.symbolic.ring import SR
from sage.symbolic.expression import Expression
Expand Down Expand Up @@ -340,7 +340,7 @@ def _giac(s):
sage: B1 = A.matrix(); B1 # convert the sparse matrix to a matrix, but the size is minimal
[[0,0,2/7,0],[0,0,0,0],[0,0,0,33]]
sage: B2 = B1.redim(4,4) # so we may need to resize B1
sage: B2.pmin(x)
sage: B2.pmin(x)
x^3
Lists of Pygen and Giac lists. Here l1 is a giac list and l2 is a python
Expand Down Expand Up @@ -747,7 +747,7 @@ cdef class GiacSetting(Pygen):
property proba_epsilon:
r"""
Maximum probability of a wrong answer with a probabilist algorithm.
Set this number to 0 to disable probabilist algorithms (slower).
EXAMPLES::
Expand Down Expand Up @@ -1580,7 +1580,7 @@ cdef class Pygen(GiacMethods_base):
Converting a custom name by adding a new entry to the ``symbols_table``::
sage: ex = libgiac('myFun(x)')
sage: sage.libs.pynac.pynac.register_symbol(sin, {'giac':'myFun'})
sage: sage.symbolic.expression.register_symbol(sin, {'giac':'myFun'})
sage: ex.sage()
sin(x)
Expand Down Expand Up @@ -1866,7 +1866,7 @@ cdef class Pygen(GiacMethods_base):
# return GiacMethods[str(name)](self)
##
#test
def giacAiry_Ai(self, *args):
cdef gen result=GIAC_Airy_Ai(self.gptr[0], context_ptr)
Expand Down Expand Up @@ -2220,11 +2220,11 @@ class GiacInstance:
list[x>(ln(sqrt(2)+1))]
sage: libgiac.solve? # doctest: +SKIP
...
Docstring:
Docstring:
From Giac's documentation:
Help for solve: solve(Expr,[Var]) Solves a (or a set of) polynomial
...
"""
"""
def __init__(self):
self.__dict__.update(GiacMethods)
Expand Down
6 changes: 0 additions & 6 deletions src/sage/libs/pynac/constant.pxd

This file was deleted.

17 changes: 17 additions & 0 deletions src/sage/libs/pynac/pynac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from sage.misc.lazy_import import lazy_import

lazy_import('sage.symbolic.expression',
['unpack_operands', 'paramset_from_Expression', 'get_ginac_serial', 'get_fn_serial',
'py_latex_variable_for_doctests', 'py_print_function_pystring',
'py_latex_function_pystring', 'tolerant_is_symbol', 'py_print_fderivative_for_doctests',
'py_latex_fderivative_for_doctests', 'test_binomial', 'py_real_for_doctests',
'py_imag_for_doctests', 'py_is_integer_for_doctests', 'py_is_crational_for_doctest',
'py_numer_for_doctests', 'py_denom_for_doctests', 'py_is_cinteger_for_doctest',
'py_float_for_doctests', 'py_tgamma_for_doctests', 'py_factorial_py', 'doublefactorial',
'py_stieltjes_for_doctests', 'py_zeta_for_doctests', 'py_exp_for_doctests',
'py_log_for_doctests', 'py_atan2_for_doctests', 'py_lgamma_for_doctests',
'py_mod_for_doctests', 'py_li_for_doctests', 'py_psi_for_doctests',
'py_psi2_for_doctests', 'py_li2_for_doctests', 'py_eval_unsigned_infinity_for_doctests',
'py_eval_infinity_for_doctests', 'py_eval_neg_infinity_for_doctests',
'register_symbol', 'init_pynac_I', 'init_function_table'],
deprecation=32386)
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/characteristic_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,6 @@ def _normalize_matrix(self, cmatrix):
from sage.symbolic.constants import pi
fac = 1 / (2 * pi)
if self._class_type != 'Pfaffian':
from sage.libs.pynac.pynac import I
from sage.symbolic.expression import I
fac = fac / I
return fac * cmatrix
5 changes: 4 additions & 1 deletion src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2260,8 +2260,11 @@ def sage_getsourcelines(obj):
([...'class MPolynomialIdeal( MPolynomialIdeal_singular_repr, \\\n',
...)
sage: x = var('x')
sage: lines, lineno = sage_getsourcelines(x); lines[0:2]
sage: lines, lineno = sage_getsourcelines(x); lines[0:5]
['cdef class Expression(CommutativeRingElement):\n',
'\n',
' cdef GEx _gobj\n',
'\n',
' cpdef object pyobject(self):\n']
sage: lines[-1] # last line
' return S\n'
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7990,7 +7990,7 @@ cdef class Polynomial(CommutativeAlgebraElement):
if L is SR:
if self.degree() == 2:
from sage.functions.other import sqrt
from sage.libs.pynac.pynac import I
from sage.symbolic.expression import I
coeffs = self.list()
D = coeffs[1]*coeffs[1] - 4*coeffs[0]*coeffs[2]
l = None
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/power_series_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def _element_constructor_(self, f, prec=infinity, check=True):
prec = integer.Integer(prec)
if prec < 0:
raise ValueError("prec (= %s) must be non-negative" % prec)
from sage.symbolic.series import SymbolicSeries
from sage.symbolic.expression import SymbolicSeries
if isinstance(f, power_series_ring_element.PowerSeries) and f.parent() is self:
if prec >= f.prec():
return f
Expand Down
3 changes: 2 additions & 1 deletion src/sage/rings/real_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,7 @@ cdef class RealBall(RingElement):
else:
# the initializers that trigger imports
import sage.symbolic.constants
import sage.symbolic.expression
if isinstance(mid, sage.rings.infinity.AnInfinity):
if isinstance(mid, sage.rings.infinity.PlusInfinity):
arb_pos_inf(self.value)
Expand Down Expand Up @@ -1409,7 +1410,7 @@ cdef class RealBall(RingElement):
raise TypeError("unsupported constant")
finally:
if _do_sig(prec(self)): sig_off()
elif isinstance(mid, sage.symbolic.constants_c.E):
elif isinstance(mid, sage.symbolic.expression.E):
if _do_sig(prec(self)): sig_on()
arb_const_e(self.value, prec(self))
if _do_sig(prec(self)): sig_off()
Expand Down
6 changes: 3 additions & 3 deletions src/sage/symbolic/all.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from sage.misc.lazy_import import lazy_import

import sage.libs.pynac.pynac # initialize pynac before .ring
lazy_import("sage.libs.pynac.pynac", "I", deprecation=(18036,
lazy_import("sage.symbolic.expression", "I", deprecation=(18036,
"import I from sage.symbolic.constants for the imaginary unit viewed as an element of SR, or from sage.rings.imaginary_unit for the element of ZZ[i]"))
lazy_import("sage.libs.pynac.pynac", "I", as_="i", deprecation=(18036,
lazy_import("sage.symbolic.expression", "I", as_="i", deprecation=(18036,
"import I from sage.symbolic.constants for the imaginary unit viewed as an element of SR, or from sage.rings.imaginary_unit for the element of ZZ[i]"))

import sage.symbolic.expression # initialize pynac before .ring
from .ring import SR
from .constants import (pi, e, NaN, golden_ratio, log2, euler_gamma, catalan,
khinchin, twinprime, mertens, glaisher)
Expand Down
7 changes: 0 additions & 7 deletions src/sage/symbolic/comparison.pxd

This file was deleted.

5 changes: 5 additions & 0 deletions src/sage/symbolic/comparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from sage.misc.lazy_import import lazy_import
lazy_import('sage.symbolic.expression',
['print_order', '_print_key', 'print_sorted', '_math_key',
'math_sorted', 'mixed_order', '_mixed_key', 'mixed_sorted'],
deprecation=32386)
Loading

0 comments on commit 525c860

Please sign in to comment.