hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
4edb794ca458591559db4919edb04fdb7ba9968d49b9873b6a770de12258b5f7 | from sympy import (meijerg, I, S, integrate, Integral, oo, gamma, cosh, sinc,
hyperexpand, exp, simplify, sqrt, pi, erf, erfc, sin, cos,
exp_polar, polygamma, hyper, log, expand_func, Rational)
from sympy.integrals.meijerint import (_rewrite_single, _rewrite1,
meijerint_ind... |
3f322aec019b58711034b36c3900a91e237e65a9ac5515b0638abea06663db08 | from sympy.integrals.transforms import (mellin_transform,
inverse_mellin_transform, laplace_transform, inverse_laplace_transform,
fourier_transform, inverse_fourier_transform,
sine_transform, inverse_sine_transform,
cosine_transform, inverse_cosine_transform,
hankel_transform, inverse_hankel_transfo... |
554713ca0c984f24ba102179a60c06513f45362f07d13fc7f4db06dc19bf72c7 | """Most of these tests come from the examples in Bronstein's book."""
from sympy.integrals.risch import DifferentialExtension, derivation
from sympy.integrals.prde import (prde_normal_denom, prde_special_denom,
prde_linear_constraints, constant_system, prde_spde, prde_no_cancel_b_large,
prde_no_cancel_b_small, ... |
3a5cfcfe1b8702485cca390c51fbee80af2b89c5272d05a25f20fae05fa43607 | """
Parser for FullForm[Downvalues[]] of Mathematica rules.
This parser is customised to parse the output in MatchPy rules format. Multiple
`Constraints` are divided into individual `Constraints` because it helps the
MatchPy's `ManyToOneReplacer` to backtrack earlier and improve the speed.
Parsed output is formatted ... |
66cb287371ae9d8fc6c5b276f237d4d3fb0584a45a850d5a9d0043ee55e123f2 | import sys
from sympy.external import import_module
from sympy.integrals.rubi.rubimain import LoadRubiReplacer
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.core.symbol import symbo... |
04198e12269a35838090c396b710ad5307608685d30e378617bdb8f2fa622ef4 | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp... |
5d83311a02870211790095b07227495019aa148f4e4071177c2c204fee0e3264 | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp... |
5d20be2b5839c0f666ff516892587eaa38fd282a307f24081deb19f31d3ce50c |
import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, ex... |
c43a8459487ba0bae300737254a5b55db98cd0b527599dbad29f1c5524ce124e | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp... |
c68b37ac433987be3696c89c8ef041705f7f01909e33c6346190a09668717512 | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp... |
4393fd19207db53aff21c3eb8d4039ae128f357e9c7a1d1979253d331e7ffad4 | import sys
from sympy.external import import_module
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from sympy.integrals.rubi.rubi import rubi_integrate
from sympy.functions import log, sqrt, exp... |
b493fa49248087703d442f82eec8d52c58d79669654265f6e2a2091113dabbba | from sympy import (
Symbol, Wild, sin, cos, exp, sqrt, pi, Function, Derivative,
Integer, Eq, symbols, Add, I, Float, log, Rational,
Lambda, atan2, cse, cot, tan, S, Tuple, Basic, Dict,
Piecewise, oo, Mul, factor, nsimplify, zoo, Subs, RootOf,
AccumBounds, Matrix, zeros, ZeroMatrix)
from sympy.core.... |
fca7bc302408abf97fb69e11b85f5082d98687f2989c32854bba015e1c5fcacd | from sympy import (Add, Basic, Expr, S, Symbol, Wild, Float, Integer, Rational, I,
sin, cos, tan, exp, log, nan, oo, sqrt, symbols, Integral, sympify,
WildFunction, Poly, Function, Derivative, Number, pi, NumberSymbol, zoo,
Piecewise, Mul, Pow, nsimplify, ratsimp... |
303d4bc77d0761c3f0229e299370c4d5ba450dea27931c4c3a7e2ff53a5df065 | from sympy.core.compatibility import (default_sort_key, as_int, ordered,
iterable, NotIterable)
from sympy.core.singleton import S
from sympy.testing.pytest import raises
from sympy.abc import x
def test_default_sort_key():
func = lambda x: x
assert sorted([func, x, func], key=default_sort_key) == [func,... |
0ec387e3c2401313197dc43b6367d4ebc8c8ce3884f976db03ea1bdf1e4fe884 | """Test whether all elements of cls.args are instances of Basic. """
# NOTE: keep tests sorted by (module, class name) key. If a class can't
# be instantiated, add it here anyway with @SKIP("abstract class) (see
# e.g. Function).
import os
import re
import io
from sympy import (Basic, S, symbols, sqrt, sin, oo, Inte... |
a4c5bf92f105658a9c3eab120ee7d305c869d2b554ac174ed53527d4d36a0f8e | from sympy import (Symbol, Wild, GreaterThan, LessThan, StrictGreaterThan,
StrictLessThan, pi, I, Rational, sympify, symbols, Dummy)
from sympy.core.symbol import _uniquely_named_symbol, _symbol
from sympy.testing.pytest import raises
from sympy.core.symbol import disambiguate
def test_Symbol():
a = Symbol("... |
d0f9d1f9aff351cc8feb0dfbb5a929301eb3dd4737664992ad049f03c643f504 | from __future__ import absolute_import
import numbers as nums
import decimal
from sympy import (Rational, Symbol, Float, I, sqrt, cbrt, oo, nan, pi, E,
Integer, S, factorial, Catalan, EulerGamma, GoldenRatio,
TribonacciConstant, cos, exp,
Number, zoo, log, Mul, P... |
007e8818080e6ca126c26cd7d3d764af002a28bda7d28f05f786163d5652309b | from sympy.core.basic import Basic
from sympy.core.numbers import Rational
from sympy.core.singleton import S, Singleton
from sympy.core.compatibility import exec_
def test_Singleton():
global instantiated
instantiated = 0
class MySingleton(Basic, metaclass=Singleton):
def __new__(cls):
... |
459add210500e288fe90ee4b2063f8a2d97c8281135eb2cee9d3f84911f9260c | from sympy import Symbol, var, Function, FunctionClass
from sympy.testing.pytest import raises
def test_var():
ns = {"var": var, "raises": raises}
eval("var('a')", ns)
assert ns["a"] == Symbol("a")
eval("var('b bb cc zz _x')", ns)
assert ns["b"] == Symbol("b")
assert ns["bb"] == Symbol("bb")
... |
fc3ad267b1795c93705ed673e0beb6b9feca28383b47cf5e4444eb72cbc054b3 | from sympy import (Lambda, Symbol, Function, Derivative, Subs, sqrt,
log, exp, Rational, Float, sin, cos, acos, diff, I, re, im,
E, expand, pi, O, Sum, S, polygamma, loggamma, expint,
Tuple, Dummy, Eq, Expr, symbols, nfloat, Piecewise, Indexed,
Matrix, Basic, Dict, oo, zoo, nan, Pow)
fro... |
d0f1867013801255a90f7ecc9f9e547af27c59a7e05aa6d3eaf5b59060149191 | """This tests sympy/core/basic.py with (ideally) no reference to subclasses
of Basic or Atom."""
import collections
import sys
from sympy.core.basic import (Basic, Atom, preorder_traversal, as_Basic,
_atomic, _aresame)
from sympy.core.singleton import S
from sympy.core.symbol import symbols, Symbol
from sympy.cor... |
d4ee52bca764cfa323a9ea65d174c142b83c7746a2a096c761028e685dd5f56a | from sympy import Symbol, Function, exp, sqrt, Rational, I, cos, tan, S
from sympy.testing.pytest import XFAIL
def test_add_eval():
a = Symbol("a")
b = Symbol("b")
c = Rational(1)
p = Rational(5)
assert a*b + c + p == a*b + 6
assert c + a + p == a + 6
assert c + a - p == a + (-4)
asser... |
c8bcb025ca283e76f51cf9dfb43df6e6f91cdf8ae83a0a5a91756ed94cb54f7d | from sympy.core.facts import (deduce_alpha_implications,
apply_beta_to_alpha_route, rules_2prereq, FactRules, FactKB)
from sympy.core.logic import And, Not
from sympy.testing.pytest import raises
T = True
F = False
U = None
def test_deduce_alpha_implications():
def D(i):
I = deduce_alpha_implicat... |
5ae4c41137f41b2f4f3344be86f158fe9e231859e7d57e2895b8fb8107e6b63b | from sympy import Integer, S, symbols, Mul
from sympy.core.operations import AssocOp, LatticeOp
from sympy.testing.pytest import raises
from sympy.core.sympify import SympifyError
from sympy.core.add import Add
# create the simplest possible Lattice class
class join(LatticeOp):
zero = Integer(0)
identity = I... |
ce8795680f6e264e44c34ec562366e7515aa00a7c6b309beece70486009bd150 | from sympy import (log, sqrt, Rational as R, Symbol, I, exp, pi, S,
cos, sin, Mul, Pow, O)
from sympy.simplify.radsimp import expand_numer
from sympy.core.function import expand, expand_multinomial, expand_power_base
from sympy.testing.pytest import raises
from sympy.testing.randtest import verify_numerically
fro... |
ea3e1593d502351bfc3b2c7fe22bf578f8e8730060efffb77edad227cbb470fa | from sympy.concrete.summations import Sum
from sympy.core.expr import Expr
from sympy.core.function import (Derivative, Function, diff, Subs)
from sympy.core.numbers import (I, Rational, pi)
from sympy.core.relational import Eq
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.functions... |
3e107951aede468677c624913072a82f1b73fcd4f7276bf8174c0f3074a8bc52 | """Tests for noncommutative symbols and expressions."""
from sympy import (
adjoint,
cancel,
collect,
combsimp,
conjugate,
cos,
expand,
factor,
gammasimp,
posify,
radsimp,
ratsimp,
rcollect,
sin,
simplify,
symbols,
transpose,
trigsimp,
I,
)
fr... |
089d9614b4b5aa8d56d30f55bae46d54467f5270814a5427fb69bb8fb5b514b8 | """Tests for tools for manipulating of large commutative expressions. """
from sympy import (S, Add, sin, Mul, Symbol, oo, Integral, sqrt, Tuple, I,
Function, Interval, O, symbols, simplify, collect, Sum,
Basic, Dict, root, exp, cos, Dummy, log, Rational)
from sympy.core.exprtools... |
7ddf118bd861132ccf04cad0f8c176aea5d8498be8d3ab948ad748a09619fc96 | from sympy import Symbol, Mul, symbols, Basic
from sympy.testing.pytest import XFAIL
class SymbolInMulOnce(Symbol):
# Test class for a symbol that can only appear once in a `Mul` expression.
pass
Basic._constructor_postprocessor_mapping[SymbolInMulOnce] = {
"Mul": [lambda x: x],
"Pow": [lambda x: x.... |
dac21ce5224050cf81ad244f88a65e82aaba652eff0210347f440d2bb31c7acb | from sympy.core import (
Rational, Symbol, S, Float, Integer, Mul, Number, Pow,
Basic, I, nan, pi, symbols, oo, zoo, N)
from sympy.core.tests.test_evalf import NS
from sympy.core.function import expand_multinomial
from sympy.functions.elementary.miscellaneous import sqrt, cbrt
from sympy.functions.elementary.ex... |
510b1b84e94a1486e2b36060fab564636e3567ee6c41cc2e740babd815edecd4 | from sympy import I, sqrt, log, exp, sin, asin, factorial, Mod, pi, oo
from sympy.core import Symbol, S, Rational, Integer, Dummy, Wild, Pow
from sympy.core.facts import InconsistentAssumptions
from sympy import simplify
from sympy.testing.pytest import raises, XFAIL
def test_symbol_unset():
x = Symbol('x', real... |
68f6a7a8396c7b5bb69c30fc40d1dbbcba9a78196e04ab4a055cace16f9e1038 | from sympy.testing.pytest import XFAIL, raises, warns_deprecated_sympy
from sympy import (S, Symbol, symbols, nan, oo, I, pi, Float, And, Or,
Not, Implies, Xor, zoo, sqrt, Rational, simplify, Function,
log, cos, sin, Add, Mul, Pow, floor, ceiling, trigsimp, Reals)
from sympy.core.relational import (Relational, ... |
29174563d3309c81840a2dc21940b8702473ab9db328727dc06dcaaac16bf371 | from collections import defaultdict
from sympy import Matrix, Tuple, symbols, sympify, Basic, Dict, S, FiniteSet, Integer
from sympy.core.compatibility import is_sequence, iterable
from sympy.core.containers import tuple_wrapper
from sympy.core.expr import unchanged
from sympy.core.function import Function, Lambda
fro... |
cce0b5df39df6a9e82da2e1fc3dc0aa66d3d986b5af6712e45242a1fd3154164 | from sympy import (Symbol, exp, Integer, Float, sin, cos, log, Poly, Lambda,
Function, I, S, sqrt, srepr, Rational, Tuple, Matrix, Interval, Add, Mul,
Pow, Or, true, false, Abs, pi, Range, Xor)
from sympy.abc import x, y
from sympy.core.sympify import (sympify, _sympify, SympifyError, kernS,
CantSympify)
fr... |
4160a43ea464dc9d314b9a6911af2503a7db8c3bcf2f21ff2128aa2ae157f71e | from sympy import (Abs, Add, atan, ceiling, cos, E, Eq, exp, factor,
factorial, fibonacci, floor, Function, GoldenRatio, I, Integral,
integrate, log, Mul, N, oo, pi, Pow, product, Product,
Rational, S, Sum, simplify, sin, sqrt, sstr, sympify, Symbol, Max, nfloat, cosh, acosh, acos)
from sympy.core.numbers i... |
2be4f7a9f72da474d44d9b7a4515208738f5f3595ea82c41992856373d5018ba | from sympy import (abc, Add, cos, collect, Derivative, diff, exp, Float, Function,
I, Integer, log, Mul, oo, Poly, Rational, S, sin, sqrt, Symbol, symbols,
Wild, pi, meijerg
)
from sympy.testing.pytest import XFAIL
def test_symbol():
x = Symbol('x')
a, b, c, p, q = map(Wild, 'abcpq')
e = x
a... |
742b08a917cca503e3c621ea6fa9142b924132f583fc696a9d722a0dd0e81e60 | from sympy import (Basic, Symbol, sin, cos, atan, exp, sqrt, Rational,
Float, re, pi, sympify, Add, Mul, Pow, Mod, I, log, S, Max, symbols,
oo, zoo, Integer, sign, im, nan, Dummy, factorial, comp, floor
)
from sympy.core.parameters import distribute
from sympy.core.expr import unchanged
from sympy.utili... |
8b098c5fb8710bfef70ae5fd062cde01c8be70ee090eafb2d6c89c2815c4180e | from sympy.core.rules import Transform
from sympy.testing.pytest import raises
def test_Transform():
add1 = Transform(lambda x: x + 1, lambda x: x % 2 == 1)
assert add1[1] == 2
assert (1 in add1) is True
assert add1.get(1) == 2
raises(KeyError, lambda: add1[2])
assert (2 in add1) is False
... |
aa9ee1204265de46c35f8c3c955d173cb2dec0e16a6c90b589d0eff0d51c2961 | from sympy import symbols, Matrix, Tuple
from sympy.core.trace import Tr
from sympy.testing.pytest import raises
def test_trace_new():
a, b, c, d, Y = symbols('a b c d Y')
A, B, C, D = symbols('A B C D', commutative=False)
assert Tr(a + b) == a + b
assert Tr(A + B) == Tr(A) + Tr(B)
#check trace ... |
06295f54914cf632f3fa8bd3f5a953b98579251abfd3a1c35b773b99b265809a | from sympy.core.logic import (fuzzy_not, Logic, And, Or, Not, fuzzy_and,
fuzzy_or, _fuzzy_group, _torf, fuzzy_nand, fuzzy_xor)
from sympy.testing.pytest import raises
T = True
F = False
U = None
def test_torf():
from sympy.utilities.iterables import cartes
v = [T, F, U]
for i in cartes(*[v]*3):
... |
2b348952e0dcd461c3b8dd1813fe848eded8c85a9fadfcfa9c6c217b14e01b59 | """Tests that the IPython printing module is properly loaded. """
from sympy.interactive.session import init_ipython_session
from sympy.external import import_module
from sympy.testing.pytest import raises
# run_cell was added in IPython 0.11
ipython = import_module("IPython", min_module_version="0.11")
# disable te... |
0b1262a09590eca84facf603d0cde013030730559571ce50912871f69baab4cf | """Benchmarks for polynomials over Galois fields. """
from __future__ import print_function, division
from sympy.polys.galoistools import gf_from_dict, gf_factor_sqf
from sympy.polys.domains import ZZ
from sympy import pi, nextprime
def gathen_poly(n, p, K):
return gf_from_dict({n: K.one, 1: K.one, 0: K.one}, p... |
a52033830255653444f23f154b55ac5e5cbfc32384e98fc964b7d5c837abb83a | """Implementation of :class:`AlgebraicField` class. """
from __future__ import print_function, division
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.domains.field import Field
from sympy.polys.domains.simpledomain import SimpleDomain
from sympy.polys.polyclasses import ANP
fr... |
0f9343fcfb382c1edea76d27f7b835c0aa3e6c5a1b6630c7b56498762c373184 | """Rational number type based on Python integers. """
from __future__ import print_function, division
import operator
from sympy.core.numbers import Rational, Integer
from sympy.core.sympify import converter
from sympy.polys.polyutils import PicklableWithSlots
from sympy.polys.domains.domainelement import DomainElem... |
126a0fdf0c7f0d5708f69af2eccc757ab9f239a457fcd26a27a6f1a841feb89a | """Implementation of mathematical domains. """
__all__ = ['Domain', 'FiniteField', 'IntegerRing', 'RationalField',
'RealField', 'ComplexField', 'PythonFiniteField',
'GMPYFiniteField', 'PythonIntegerRing',
'GMPYIntegerRing', 'PythonRational',
'GMPYRationalField', 'AlgebraicFi... |
49f2e0d1092d9195e7ab2443b397c171ed1bbb5fda175fd88359184d9712dcff | """Implementation of :class:`RealField` class. """
from __future__ import print_function, division
from sympy.core.numbers import Float
from sympy.polys.domains.field import Field
from sympy.polys.domains.simpledomain import SimpleDomain
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy... |
8f2cb0c5b9ab5652be49eb8cb83dbeb1776b25a8a97fde88d886b38d225d6f7b | """Implementation of :class:`PolynomialRing` class. """
from __future__ import print_function, division
from sympy.core.compatibility import iterable
from sympy.polys.agca.modules import FreeModulePolyRing
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.domains.compositedomain i... |
f8141c4e55d82f96124082af0373da46b0c2f76e92f08f689e6ca20f784a846e | """Implementation of :class:`ComplexField` class. """
from __future__ import print_function, division
from sympy.core.numbers import Float, I
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.domains.field import Field
from sympy.polys.domains.mpelements import MPContext
from symp... |
aa234cdf932d1cae9802563404c20e02dc5fb0cf0aa81f496423febe4ee7ec38 | """Implementation of :class:`ExpressionDomain` class. """
from __future__ import print_function, division
from sympy.core import sympify, SympifyError
from sympy.polys.domains.characteristiczero import CharacteristicZero
from sympy.polys.domains.field import Field
from sympy.polys.domains.simpledomain import SimpleDo... |
7f18f2d47dd2c67f647f7a4ad5877d9b3b18702c3a077499c82923c3a855da27 | """Implementation of :class:`ModularInteger` class. """
from __future__ import print_function, division
from typing import Any, Dict, Tuple, Type
import operator
from sympy.polys.polyutils import PicklableWithSlots
from sympy.polys.polyerrors import CoercionFailed
from sympy.polys.domains.domainelement import Domai... |
c150b0ae1d79b16dcfcc2ecaf6ebcb09d5dce74bc93cd9345b3b580a97b7d352 | """Ground types for various mathematical domains in SymPy. """
from __future__ import print_function, division
from sympy.core.compatibility import builtins, HAS_GMPY
PythonInteger = builtins.int
PythonReal = builtins.float
PythonComplex = builtins.complex
from .pythonrational import PythonRational
from sympy.core... |
2ba8534ac871b4f6c644c53a19a3bec4c3f76eb3687a09ffbb78612f799da559 | """Implementation of :class:`Domain` class. """
from __future__ import print_function, division
from typing import Any, Optional, Type
from sympy.core import Basic, sympify
from sympy.core.compatibility import HAS_GMPY, is_sequence
from sympy.core.decorators import deprecated
from sympy.polys.domains.domainelement i... |
64dd2d57e2f6a975dbb6561e03b9a1ed0797db4987fafdb9fc3e74d3bf3ea0d6 | """Real and complex elements. """
from __future__ import print_function, division
from sympy.polys.domains.domainelement import DomainElement
from sympy.utilities import public
from mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant
from mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan,
... |
8510d753a52beed9077b484451338207d0e63c1248276235f33c2e88de22f25b | """Tools for polynomial factorization routines in characteristic zero. """
from sympy.polys.rings import ring, xring
from sympy.polys.domains import FF, ZZ, QQ, RR, EX
from sympy.polys import polyconfig as config
from sympy.polys.polyerrors import DomainError
from sympy.polys.polyclasses import ANP
from sympy.polys.s... |
116a61830d29a164e4567b63c04dda643e4b1d87f7aaca1e8380e1576aeb4e81 | from sympy.polys.domains import QQ, EX, RR
from sympy.polys.rings import ring
from sympy.polys.ring_series import (_invert_monoms, rs_integrate,
rs_trunc, rs_mul, rs_square, rs_pow, _has_constant_term, rs_hadamard_exp,
rs_series_from_list, rs_exp, rs_log, rs_newton, rs_series_inversion,
rs_compose_add, rs_a... |
bf6767ca8f8397834716d10a4396196b7a093134a4601e0527084e69d2d555b7 | """Tests for tools and arithmetics for monomials of distributed polynomials. """
from sympy.polys.monomials import (
itermonomials, monomial_count,
monomial_mul, monomial_div,
monomial_gcd, monomial_lcm,
monomial_max, monomial_min,
monomial_divides, monomial_pow,
Monomial,
)
from sympy.polys.p... |
c2c00a80e2ae2d8adad78a8c4bc114b7f3dd6bf4a805f3fdd17dbe4efd561bb0 | from sympy.polys.rings import ring
from sympy.polys.domains import ZZ
from sympy.polys.heuristicgcd import heugcd
def test_heugcd_univariate_integers():
R, x = ring("x", ZZ)
f = x**4 + 8*x**3 + 21*x**2 + 22*x + 8
g = x**3 + 6*x**2 + 11*x + 6
h = x**2 + 3*x + 2
cff = x**2 + 5*x + 4
cfg = x + ... |
da96127b112d97ae833e4f45cf55ec4eb0982a1d0325e75dc7c3d7069add9c13 | """Test sparse polynomials. """
from operator import add, mul
from sympy.polys.rings import ring, xring, sring, PolyRing, PolyElement
from sympy.polys.fields import field, FracField
from sympy.polys.domains import ZZ, QQ, RR, FF, EX
from sympy.polys.orderings import lex, grlex
from sympy.polys.polyerrors import Gener... |
d6fae98d8c34b2fc8c59e710dd617653166bd1acc75b609c9425a0472a7574d0 | """Tests for Dixon's and Macaulay's classes. """
from sympy import Matrix, factor
from sympy.core import symbols
from sympy.tensor.indexed import IndexedBase
from sympy.polys.multivariate_resultants import (DixonResultant,
MacaulayResultant)
c, d = symbols("a, b")
x, ... |
1e9b01166d5bbd88187da976c30504789417830405ada14e17b921a51f06a675 | """Tests for algorithms for partial fraction decomposition of rational
functions. """
from sympy.polys.partfrac import (
apart_undetermined_coeffs,
apart,
apart_list, assemble_partfrac_list
)
from sympy import (S, Poly, E, pi, I, Matrix, Eq, RootSum, Lambda,
Symbol, Dummy, factor, toget... |
54f9ce9c552d4fca469452bcd7188dbd276e6eae7b8665f72ddf5e106bc81ab7 | """Tests for computational algebraic number field theory. """
from sympy import (S, Rational, Symbol, Poly, sqrt, I, oo, Tuple, expand,
pi, cos, sin, exp, GoldenRatio, TribonacciConstant, cbrt)
from sympy.solvers.solveset import nonlinsolve
from sympy.geometry import Circle, intersection
from sympy.testing.pytest ... |
10e3468200543566954b08bcd7b0b32c16098244de845abcfa6f9076a7acf7ce | """Tests for functions that inject symbols into the global namespace. """
from sympy.polys.rings import vring
from sympy.polys.fields import vfield
from sympy.polys.domains import QQ
def test_vring():
ns = {'vring':vring, 'QQ':QQ}
exec('R = vring("r", QQ)', ns)
exec('assert r == R.gens[0]', ns)
exec(... |
eb080ddf8fb7a2eae6d38e24cbb37d422af453322087444031ba159b383102a0 | """Tests for dense recursive polynomials' arithmetics. """
from sympy.polys.densebasic import (
dup_normal, dmp_normal,
)
from sympy.polys.densearith import (
dup_add_term, dmp_add_term,
dup_sub_term, dmp_sub_term,
dup_mul_term, dmp_mul_term,
dup_add_ground, dmp_add_ground,
dup_sub_ground, dmp... |
60343b39725030c76b0ba4be5254d1860172f33b719e30d8921dea43202b4610 | """Tests for dense recursive polynomials' tools. """
from sympy.polys.densebasic import (
dup_normal, dmp_normal,
dup_from_raw_dict,
dmp_convert, dmp_swap,
)
from sympy.polys.densearith import dmp_mul_ground
from sympy.polys.densetools import (
dup_clear_denoms, dmp_clear_denoms,
dup_integrate, d... |
12a830d5e6235e9a16884a38a124308b45567e7e1fd865191a3c6a3a288c18c1 | """Tests for high-level polynomials manipulation functions. """
from sympy.polys.polyfuncs import (
symmetrize, horner, interpolate, rational_interpolate, viete,
)
from sympy.polys.polyerrors import (
MultivariatePolynomialError,
)
from sympy import symbols, S
from sympy.testing.pytest import raises
from sy... |
40974c2d5bd03a23e6f1962be0e11257bd5de4083d41c2b574c52462fde9639a | """Tests for square-free decomposition algorithms and related tools. """
from sympy.polys.rings import ring
from sympy.polys.domains import FF, ZZ, QQ
from sympy.polys.specialpolys import f_polys
from sympy.testing.pytest import raises
f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_polys()
def test_dup_sqf():
R, x = rin... |
7579a3868cd7e58cdbec3b2bb5b7454ea0318bd675519349bc6c63faf1ccedc3 | """Tests for sparse distributed modules. """
from sympy.polys.distributedmodules import (
sdm_monomial_mul, sdm_monomial_deg, sdm_monomial_divides,
sdm_add, sdm_LM, sdm_LT, sdm_mul_term, sdm_zero, sdm_deg,
sdm_LC, sdm_from_dict,
sdm_spoly, sdm_ecart, sdm_nf_mora, sdm_groebner,
sdm_from_vector, sdm_... |
8a4c704910035e8077c3ceb26b3d196a5844d485914f88e2cb070a201ce56645 | """Test sparse rational functions. """
from sympy.polys.fields import field, sfield, FracField, FracElement
from sympy.polys.rings import ring
from sympy.polys.domains import ZZ, QQ
from sympy.polys.orderings import lex
from sympy.testing.pytest import raises, XFAIL
from sympy.core import symbols, E
from sympy import... |
7fac22c4b323d782933291640fc0184ccce9d23adf1579a7acc0992497110cc0 | """Tests for the implementation of RootOf class and related tools. """
from sympy.polys.polytools import Poly
from sympy.polys.rootoftools import (rootof, RootOf, CRootOf, RootSum,
_pure_key_dict as D)
from sympy.polys.polyerrors import (
MultivariatePolynomialError,
GeneratorsNeeded,
PolynomialError,... |
e1b9376a2279d9f3a8ce373be2e2d9912f95a525fc53cdd7f461480362326c17 | """Tests for user-friendly public interface to polynomial functions. """
from sympy.polys.polytools import (
Poly, PurePoly, poly,
parallel_poly_from_expr,
degree, degree_list,
total_degree,
LC, LM, LT,
pdiv, prem, pquo, pexquo,
div, rem, quo, exquo,
half_gcdex, gcdex, invert,
subre... |
bc4ca3e3c7888e6ebe29142d4e135f23889cfd50cd07a97b8cca2ec49005f471 | """Tests for Euclidean algorithms, GCDs, LCMs and polynomial remainder sequences. """
from sympy.polys.rings import ring
from sympy.polys.domains import ZZ, QQ, RR
from sympy.polys.specialpolys import (
f_polys,
dmp_fateman_poly_F_1,
dmp_fateman_poly_F_2,
dmp_fateman_poly_F_3)
f_0, f_1, f_2, f_3, f_4... |
c57e248fb97939a4a077b6b102314452b9e49c65c8c7c7aaf41e7644238964a5 |
from sympy.polys.galoistools import (
gf_crt, gf_crt1, gf_crt2, gf_int,
gf_degree, gf_strip, gf_trunc, gf_normal,
gf_from_dict, gf_to_dict,
gf_from_int_poly, gf_to_int_poly,
gf_neg, gf_add_ground, gf_sub_ground, gf_mul_ground,
gf_add, gf_sub, gf_add_mul, gf_sub_mul, gf_mul, gf_sqr,
gf_div, ... |
a7b0ad2491f08073bffdda57913eb8d39abe3d33fdfcb8e8cf43dc1d600df426 | """Tests for PythonRational type. """
from sympy.polys.domains import PythonRational as QQ
from sympy.testing.pytest import raises
def test_PythonRational__init__():
assert QQ(0).p == 0
assert QQ(0).q == 1
assert QQ(0, 1).p == 0
assert QQ(0, 1).q == 1
assert QQ(0, -1).p == 0
assert QQ(0, -1).q... |
d9603a85e563561a822153bf52a0a2d755c361aadfd0bf962f201e5839c7300e | """Tests for real and complex root isolation and refinement algorithms. """
from sympy.polys.rings import ring
from sympy.polys.domains import ZZ, QQ, EX
from sympy.polys.polyerrors import DomainError, RefinementFailed
from sympy.testing.pytest import raises
def test_dup_sturm():
R, x = ring("x", QQ)
assert ... |
4a2b1533631b14ef55f8c869632963f399eaa5f4fff642a1fe9f4ba880147433 | """Tests for functions for generating interesting polynomials. """
from sympy import Poly, ZZ, symbols, sqrt, prime, Add
from sympy.utilities.iterables import permute_signs
from sympy.testing.pytest import raises
from sympy.polys.specialpolys import (
swinnerton_dyer_poly,
cyclotomic_poly,
symmetric_poly,... |
6561c170208e54dc03c6e25683558fa3492b4c7c759b5c133e2d9c3983ec013e | """Tests for Groebner bases. """
from sympy.polys.groebnertools import (
groebner, sig, sig_key,
lbp, lbp_key, critical_pair,
cp_key, is_rewritable_or_comparable,
Sign, Polyn, Num, s_poly, f5_reduce,
groebner_lcm, groebner_gcd, is_groebner,
is_reduced
)
from sympy.polys.fglmtools import _repre... |
2834fc787005bdee4a5e64e3e4d74f40f08d6dd44ff2414855646db7225e6422 | """Tests for efficient functions for generating orthogonal polynomials. """
from sympy import Poly, S, Rational as Q
from sympy.testing.pytest import raises
from sympy.polys.orthopolys import (
jacobi_poly,
gegenbauer_poly,
chebyshevt_poly,
chebyshevu_poly,
hermite_poly,
legendre_poly,
lag... |
32c4eddf9c21aae125b1b2ff8e28051247be16c05b7629641e23c3b9630332bf | """Tests for OO layer of several polynomial representations. """
from sympy.polys.domains import ZZ, QQ
from sympy.polys.polyclasses import DMP, DMF, ANP
from sympy.polys.polyerrors import ExactQuotientFailed, NotInvertible
from sympy.polys.specialpolys import f_polys
from sympy.testing.pytest import raises
f_0, f_1,... |
27d2d38f69baf2faa4717b7984cde4d714c8045c8215e947859136910d60923e | """Tests for options manager for :class:`Poly` and public API functions. """
from sympy.polys.polyoptions import (
Options, Expand, Gens, Wrt, Sort, Order, Field, Greedy, Domain,
Split, Gaussian, Extension, Modulus, Symmetric, Strict, Auto,
Frac, Formal, Polys, Include, All, Gen, Symbols, Method)
from sym... |
8266cc9f6f9be816f1a083b7bdbeeb1b7c7049ea77ca260ff9ced3d7361b03b1 | """Tests for dense recursive polynomials' basic tools. """
from sympy.polys.densebasic import (
dup_LC, dmp_LC,
dup_TC, dmp_TC,
dmp_ground_LC, dmp_ground_TC,
dmp_true_LT,
dup_degree, dmp_degree,
dmp_degree_in, dmp_degree_list,
dup_strip, dmp_strip,
dmp_validate,
dup_reverse,
dup... |
6ddb08b2a253149095c993513001950d7564efd95dc3dae60067a34bf97028fd | """Tests of monomial orderings. """
from sympy.polys.orderings import (
monomial_key, lex, grlex, grevlex, ilex, igrlex,
LexOrder, InverseOrder, ProductOrder, build_product_order,
)
from sympy.abc import x, y, z, t
from sympy.core import S
from sympy.testing.pytest import raises
def test_lex_order():
ass... |
deeb98316ce3f420781b36a61aeaac80cc328824740531b5a42dbefd637a276d | """Tests for useful utilities for higher level polynomial classes. """
from sympy import (S, Integer, sin, cos, sqrt, symbols, pi,
Eq, Integral, exp, Mul)
from sympy.testing.pytest import raises
from sympy.polys.polyutils import (
_nsort,
_sort_gens,
_unify_gens,
_analyze_gens,
_sort_factors,
... |
9b833f3d22e5a9c8b8f15bd81a7321353a20c531e2cde685e1a8a2fdc26cbc76 | """Tests for algorithms for computing symbolic roots of polynomials. """
from sympy import (S, symbols, Symbol, Wild, Rational, sqrt,
powsimp, sin, cos, pi, I, Interval, re, im, exp, ZZ, Piecewise,
acos, root, conjugate)
from sympy.polys import Poly, cyclotomic_poly, intervals, nroots, rootof
from sympy.poly... |
e8dcd28d6e5d8a97570e1cd6c91d8b235f7b246422c444724867d3b0b687e65e | """
Computations with modules over polynomial rings.
This module implements various classes that encapsulate groebner basis
computations for modules. Most of them should not be instantiated by hand.
Instead, use the constructing routines on objects you already have.
For example, to construct a free module over ``QQ[x... |
30b6b054d3e9387b837146b96e04b1f525992b3cf250d70880e4c9d9524d8433 | """
Computations with homomorphisms of modules and rings.
This module implements classes for representing homomorphisms of rings and
their modules. Instead of instantiating the classes directly, you should use
the function ``homomorphism(from, to, matrix)`` to create homomorphism objects.
"""
from __future__ import p... |
4104b878a07c0bf0c15ca3aa1e3d34851fd5227bfcc39b448dba17712b02046e | """Finite extensions of ring domains."""
from __future__ import print_function, division
from sympy.polys.polyerrors import CoercionFailed
from sympy.polys.polytools import Poly
class ExtensionElement(object):
"""
Element of a finite extension.
A class of univariate polynomials modulo the ``modulus``
... |
220dab0b90648b707d4b72db150c73fb91ff76dc7a755ec3ebf4f465da1f0da5 | """Tests for quotient rings."""
from sympy import QQ, ZZ
from sympy.abc import x, y
from sympy.polys.polyerrors import NotReversible
from sympy.testing.pytest import raises
def test_QuotientRingElement():
R = QQ.old_poly_ring(x)/[x**10]
X = R.convert(x)
assert X*(X + 1) == R.convert(x**2 + x)
asse... |
816f368dcc4bd89e672ab0388830ae93cf0ad5baa97c01bbcf7d98f75f7598a5 | """Tests for the PolynomialRing classes. """
from sympy.polys.domains import QQ, ZZ
from sympy.polys.polyerrors import ExactQuotientFailed, CoercionFailed, NotReversible
from sympy.abc import x, y
from sympy.testing.pytest import raises
def test_build_order():
R = QQ.old_poly_ring(x, y, order=(("lex", x), ("il... |
dd436001adeed54daa5a8eca27aa7caf0b854ffe0694db7f51e0a0c72b72362d | """Tests for classes defining properties of ground domains, e.g. ZZ, QQ, ZZ[x] ... """
from sympy import S, sqrt, sin, oo, Poly, Float, Rational
from sympy.abc import x, y, z
from sympy.polys.domains import ZZ, QQ, RR, CC, FF, GF, EX
from sympy.polys.domains.realfield import RealField
from sympy.polys.rings import r... |
c3beaa5cefbf1cde8b41b57b97787b80966c33e0d9da2a365fe90f5a21d844dc | """Test ideals.py code."""
from sympy.polys import QQ, ilex
from sympy.abc import x, y, z
from sympy.testing.pytest import raises
def test_ideal_operations():
R = QQ.old_poly_ring(x, y)
I = R.ideal(x)
J = R.ideal(y)
S = R.ideal(x*y)
T = R.ideal(x, y)
assert not (I == J)
assert I == I
... |
4b9a8aa24da2130df1818e02a858d840fbc146dcee5f4199b4ea9198a1ff4036 | """Test modules.py code."""
from sympy.polys.agca.modules import FreeModule, ModuleOrder, FreeModulePolyRing
from sympy.polys import CoercionFailed, QQ, lex, grlex, ilex, ZZ
from sympy.abc import x, y, z
from sympy.testing.pytest import raises
from sympy import Rational
def test_FreeModuleElement():
M = QQ.old_p... |
e661fe858128cd4bccdf3e5e1fe0f6015272cdfa9feb88b197ba9d325302a9ab | """Tests for homomorphisms."""
from sympy import QQ, S
from sympy.abc import x, y
from sympy.polys.agca import homomorphism
from sympy.testing.pytest import raises
def test_printing():
R = QQ.old_poly_ring(x)
assert str(homomorphism(R.free_module(1), R.free_module(1), [0])) == \
'Matrix([[0]]) : QQ[... |
d0ef32dc3412e03af23a984427f3ffc649950b142ce4c18efbd2cdef9269150a | """
Checks that SymPy does not contain indirect imports.
An indirect import is importing a symbol from a module that itself imported the
symbol from elsewhere. Such a constellation makes it harder to diagnose
inter-module dependencies and import order problems, and is therefore strongly
discouraged.
(Indirect imports... |
6864e181e14ec3c1a722998769ff4133b319d926a9f4b8689c5da2f48dd4c45e | #!/usr/bin/env python
"""
Import diagnostics. Run bin/diagnose_imports.py --help for details.
"""
from __future__ import print_function
from typing import Dict
if __name__ == "__main__":
import sys
import inspect
from sympy.core.compatibility import builtins
import optparse
from os.path impor... |
1937dd52ab30a55d383de5d987772cd9ad4b673f95cd2c8b31d8cfe3bbca73b9 | import warnings
from sympy.testing.pytest import (raises, warns, ignore_warnings,
warns_deprecated_sympy, Failed)
from sympy.utilities.exceptions import SymPyDeprecationWarning
# Test callables
def test_expected_exception_is_silent_callable():
def f():
raise ValueEr... |
3dfc3e44f96e3c5b17ab6b4a6502a8d4e51f92ecb8cc8363ba7bf766a3c167b2 | # coding=utf-8
from os import walk, sep, pardir
from os.path import split, join, abspath, exists, isfile
from glob import glob
import re
import random
import ast
from sympy.testing.pytest import raises
from sympy.testing.quality_unicode import test_this_file_encoding
# System path separator (usually slash or backsla... |
831594f02b8c52008e0643389f6c686ea5715691627862f57afe8faf8302776f | from sympy.vector.vector import Vector
from sympy.vector.coordsysrect import CoordSys3D
from sympy.vector.functions import express, matrix_to_vector, orthogonalize
from sympy import symbols, S, sqrt, sin, cos, ImmutableMatrix as Matrix, Rational
from sympy.testing.pytest import raises
N = CoordSys3D('N')
q1, q2, q3, q... |
ecb8c39ca7d065e836472dc31804b733459f57a84c71573aa582ac859da4b657 | from sympy.core import Rational
from sympy.simplify import simplify, trigsimp
from sympy import pi, sqrt, symbols, ImmutableMatrix as Matrix, \
sin, cos, Function, Integral, Derivative, diff
from sympy.vector.vector import Vector, BaseVector, VectorAdd, \
VectorMul, VectorZero
from sympy.vector.coordsysrect i... |
ff9a2093bf43383cacc96ff03af57997369b7d7a1bb781cc7ae6c9039bd5fb61 | from sympy import sin, cos, symbols, pi, ImmutableMatrix as Matrix, \
simplify
from sympy.vector import (CoordSys3D, Vector, Dyadic,
DyadicAdd, DyadicMul, DyadicZero,
BaseDyadic, express)
A = CoordSys3D('A')
def test_dyadic():
a, b = symbols('a, b')
a... |
2052d1b28233d3d37dea9653340cd161dd7a3647f8dc872d1d3b908f2aa2c2b8 | from sympy.core.function import Derivative
from sympy.vector.vector import Vector
from sympy.vector.coordsysrect import CoordSys3D
from sympy.simplify import simplify
from sympy.core.symbol import symbols
from sympy.core import S
from sympy import sin, cos
from sympy.vector.vector import Dot
from sympy.vector.operators... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.