hash
stringlengths
64
64
content
stringlengths
0
1.51M
0c21ad1abc5fe86808e695667638f6272d38fc2400599cfbe7571c7172383eb6
from sympy.core import S from sympy.core.relational import Eq, Ne from sympy.logic.boolalg import BooleanFunction from sympy.utilities.misc import func_name class Contains(BooleanFunction): """ Asserts that x is an element of the set S. Examples ======== >>> from sympy import Symbol, Integer, S ...
4cf826ec0b92bfdd329a32c7d391250e9ceb1cd179c231181ea5f0ae71e44d07
from sympy.core import Basic, Integer import operator class OmegaPower(Basic): """ Represents ordinal exponential and multiplication terms one of the building blocks of the Ordinal class. In OmegaPower(a, b) a represents exponent and b represents multiplicity. """ def __new__(cls, a, b): ...
7b998574ceaf0ea57dea378c2be8c817b9b18019332e508b87cfbb830e13589b
from sympy.core import Expr from sympy.core.decorators import call_highest_priority, _sympifyit from sympy.sets import ImageSet from sympy.sets.sets import set_add, set_sub, set_mul, set_div, set_pow, set_function class SetExpr(Expr): """An expression that can take on values of a set. Examples ======== ...
37825f6e4742a2aec3ffc05719a25f96493efd2f0229cced08b8cddeeaf8cb5f
from functools import reduce from sympy.core.basic import Basic from sympy.core.containers import Tuple from sympy.core.expr import Expr from sympy.core.function import Lambda from sympy.core.logic import fuzzy_not, fuzzy_or, fuzzy_and from sympy.core.numbers import oo, Integer from sympy.core.relational import Eq fro...
b1c00b48ec8c9ef6d6a356a51deb3fc8d38ed4c1daec6be7a1f0a07db90bbf49
from typing import Optional from collections import defaultdict import inspect from sympy.core.basic import Basic from sympy.core.compatibility import iterable, ordered, reduce from sympy.core.containers import Tuple from sympy.core.decorators import (deprecated, sympify_method_args, sympify_return) from sympy.co...
bc24ff7a54fd7bfb75fa09c5a2e350bd115b076e58c36005f0743be80073d4ab
"""Implicit plotting module for SymPy. Explanation =========== The module implements a data series called ImplicitSeries which is used by ``Plot`` class to plot implicit plots for different backends. The module, by default, implements plotting using interval arithmetic. It switches to a fall back algorithm if the exp...
8a23704f3c221ecd10cbf60dfd25eb34a307709410c53024e434f43383dde61f
"""Plotting module for Sympy. A plot is represented by the ``Plot`` class that contains a reference to the backend and a list of the data series to be plotted. The data series are instances of classes meant to simplify getting points and meshes from sympy expressions. ``plot_backends`` is a dictionary with all the bac...
f163e3abcaa429eb8e040cfad4c3a132ae0dc4430c847a7ca55a0e4f3ce40b80
""" rewrite of lambdify - This stuff is not stable at all. It is for internal use in the new plotting module. It may (will! see the Q'n'A in the source) be rewritten. It's completely self contained. Especially it does not use lambdarepr. It does not aim to replace the current lambdify. Most importantly it will never...
6009fe7258db97893b58861b8cd675b9edc650ce4ce70c2322ddb6e9e003fd01
from sympy import (S, Symbol, Interval, binomial, nan, exp, Or, symbols, Eq, cos, And, Tuple, integrate, oo, sin, Sum, Basic, Indexed, DiracDelta, Lambda, log, pi, FallingFactorial, Rational, Matrix) from sympy.stats import (Die, Normal, Exponential, FiniteRV, P, E, H, variance, density, given, ...
312bf40152d0f7810df014b889b3516f392892dacec3c97026675fe7bc6c43bc
from sympy import (FiniteSet, S, Symbol, sqrt, nan, beta, Rational, symbols, simplify, Eq, cos, And, Tuple, Or, Dict, sympify, binomial, cancel, exp, I, Piecewise, Sum, Dummy, harmonic, Function) from sympy.external import import_module from sympy.matrices import Matrix from sympy....
3eea14cdef80ef347a4a1df53e04994502fd9e20de5f853b27c7b2523e1af73a
from sympy import (S, symbols, FiniteSet, Eq, Matrix, MatrixSymbol, Float, And, ImmutableMatrix, Ne, Lt, Le, Gt, Ge, exp, Not, Rational, Lambda, erf, Piecewise, factorial, Interval, oo, Contains, sqrt, pi, ceiling, gamma, lowergamma, Sum, Range, Tuple, ImmutableD...
d2f5fd4dcf9a31179890403cc1a0e56beb7e88b7e38c0f6399c3e605ca5eed50
from sympy import (S, Symbol, Sum, I, lambdify, re, im, log, simplify, sqrt, zeta, pi, besseli, Dummy, oo, Piecewise, Rational, beta, floor, FiniteSet) from sympy.core.relational import Eq, Ne from sympy.functions.elementary.exponential import exp from sympy.logic.boolalg import Or...
9083ad98b6e8f3d4469aff2b85f482a7d9886569590df66cd1573854f1642618
from sympy import E as e from sympy import (Symbol, Abs, exp, expint, S, pi, simplify, Interval, erf, erfc, Ne, EulerGamma, Eq, log, lowergamma, uppergamma, symbols, sqrt, And, gamma, beta, Piecewise, Integral, sin, cos, tan, sinh, cosh, besseli, floor, expand_fu...
b0fedf7357c767e6521103194bc91f6499911bf285cd5a1787878ff2074ecc51
from sympy import sin, cos, exp, E, series, oo, S, Derivative, O, Integral, \ Function, PoleError, log, sqrt, N, Symbol, Subs, pi, symbols, atan, LambertW, Rational from sympy.abc import x, y, n, k from sympy.testing.pytest import raises from sympy.series.gruntz import calculate_series def test_sin(): e1 = si...
d8dc9eae153b170363bc7b008ee88c4e935dcb5fe8fc28462596103d6e81c70d
from sympy import (Symbol, Rational, Order, exp, ln, log, nan, oo, O, pi, I, S, Integral, sin, cos, sqrt, conjugate, expand, transpose, symbols, Function, Add) from sympy.core.expr import unchanged from sympy.testing.pytest import raises from sympy.abc import w, x, y, z def test_caching_bug(): #needs to b...
c592cff8265be1196112572819499c60a19de0fe3670c5a39ccdc39d08f41ea5
from itertools import product as cartes from sympy import ( limit, exp, oo, log, sqrt, Limit, sin, floor, cos, ceiling, atan, Abs, gamma, Symbol, S, pi, Integral, Rational, I, tan, cot, integrate, Sum, sign, Function, subfactorial, symbols, binomial, simplify, frac, Float, sec, zoo, fresnelc, fresnels,...
531c49b89639760ab143869d580257a4ea57e7170c679bf847cbfabe847d0f63
from sympy import ( Add, Mul, S, Symbol, cos, cot, pi, I, sin, sqrt, tan, root, csc, sec, powsimp, symbols, sinh, cosh, tanh, coth, sech, csch, Dummy, Rational) from sympy.simplify.fu import ( L, TR1, TR10, TR10i, TR11, _TR11, TR12, TR12i, TR13, TR14, TR15, TR16, TR111, TR2, TR2i, TR3, TR5, TR6, TR7, TR...
5084e3319a53e2bc509b0046456bf57cdc3bc06aaab6a671643e7b5e79bce86d
from sympy import ( Abs, acos, Add, asin, atan, Basic, binomial, besselsimp, cos, cosh, count_ops, csch, diff, E, Eq, erf, exp, exp_polar, expand, expand_multinomial, factor, factorial, Float, Function, gamma, GoldenRatio, hyper, hypersimp, I, Integral, integrate, KroneckerDelta, log, logcombine, Lt...
23dff82909ea8cb1257fda7c6a887632c907a4f013b391d23c9569e148d82c49
from sympy import symbols, IndexedBase, Identity, cos, Inverse, tensorcontraction, permutedims, tensorproduct from sympy.codegen.array_utils import (CodegenArrayContraction, CodegenArrayTensorProduct, CodegenArrayDiagonal, CodegenArrayPermute...
b228ee285bb693d5b4e983c0abca55bbcf46e55f80d8bbfa5f7ba97ce53d1c9a
import tempfile import sympy as sp from sympy.codegen.ast import Assignment from sympy.codegen.algorithms import newtons_method, newtons_method_function from sympy.codegen.fnodes import bind_C from sympy.codegen.futils import render_as_module as f_module from sympy.codegen.pyutils import render_as_module as py_module f...
3bd9d065f3b7f15185744ba23dcd346276276a9ca04b8df12defdc6b6bf676dc
""" Handlers for keys related to number theory: prime, even, odd, etc. """ from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler from sympy.ntheory import isprime from sympy.core import S, Float class AskPrimeHandler(CommonHandler): """ Handler for key 'prime'. Explan...
a2e17045ced3145854c946acb92b70b0022dc3d2c60b58a76eed6cad975bf7bf
""" This module contains query handlers responsible for calculus queries: infinitesimal, finite, etc. """ from sympy.logic.boolalg import conjuncts from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler class AskFiniteHandler(CommonHandler): """ Handler for key 'finite'. ...
52f6cbfd403a420fa15eb436d47e5f9823ef4eb3b3f185474b3fd9198344b821
from sympy.core.logic import _fuzzy_group from sympy.logic.boolalg import conjuncts from sympy.assumptions import Q, ask class AskHandler: """Base class that all Ask Handlers must inherit.""" pass class CommonHandler(AskHandler): """Defines some useful methods common to most Handlers. """ @staticme...
e85bfb512998b3ddfadc5e8a67ef1f0770139797e2e0740948a1731d082ad5f6
""" This module contains query handlers responsible for calculus queries: infinitesimal, bounded, etc. """ from sympy.logic.boolalg import conjuncts from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler, test_closed_group from sympy.matrices.expressions import MatMul, MatrixExpr fro...
bc93b5a09265c51e5730513d3d9c9438d7e7f4769c144462ade510bd853a1cd4
""" AskHandlers related to order relations: positive, negative, etc. """ from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler from sympy.core.logic import fuzzy_not, fuzzy_and, fuzzy_or class AskNegativeHandler(CommonHandler): """ This is called by ask() when key='negativ...
5e28a3e40efe7a340e9f16cab07369fe225d6bb35568e2c73e70db78d644c393
""" Handlers for predicates related to set membership: integer, rational, etc. """ from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler, test_closed_group from sympy.core.numbers import pi from sympy.core.logic import fuzzy_bool from sympy.functions.elementary.exponential import ex...
0ef83bd8bf03b979f06cc06adbea62217113d6db894e735a82e6498d2bc25229
from typing import List from functools import reduce from sympy.core import S, sympify, Dummy, Mod from sympy.core.cache import cacheit from sympy.core.compatibility import HAS_GMPY from sympy.core.function import Function, ArgumentIndexError from sympy.core.logic import fuzzy_and from sympy.core.numbers import Intege...
6ca4089999ada8204c0b0336041b307beb55bbb053c20759e2543f58d1bca43a
from sympy.core import Basic, S, Function, diff, Tuple, Dummy from sympy.core.basic import as_Basic from sympy.core.numbers import Rational, NumberSymbol from sympy.core.relational import (Equality, Unequality, Relational, _canonical) from sympy.functions.elementary.miscellaneous import Max, Min from sympy.logic.bo...
96b3e74c063309ca30d16a95adb410e3e3fdb02bb8cc8a92ec2f704b174d358e
from sympy.core import sympify from sympy.core.add import Add from sympy.core.cache import cacheit from sympy.core.function import (Function, ArgumentIndexError, _coeff_isneg, expand_mul) from sympy.core.logic import fuzzy_and, fuzzy_not, fuzzy_or from sympy.core.mul import Mul from sympy.core.numbers import In...
a6db92047b3966bec12db8822c3e97c0b8260aaab4cd0c935852425894e7ed25
"""Hypergeometric and Meijer G-functions""" from functools import reduce from sympy.core import S, I, pi, oo, zoo, ilcm, Mod from sympy.core.function import Function, Derivative, ArgumentIndexError from sympy.core.containers import Tuple from sympy.core.mul import Mul from sympy.core.symbol import Dummy from sympy.f...
4b945409f3e5f7f21471b69d09b810da890233d78d0688222af4ea96f1feeaff
from sympy import ( symbols, log, ln, Float, nan, oo, zoo, I, pi, E, exp, Symbol, LambertW, sqrt, Rational, expand_log, S, sign, adjoint, conjugate, transpose, O, refine, sin, cos, sinh, cosh, tanh, exp_polar, re, simplify, AccumBounds, MatrixSymbol, Pow, gcd, Sum, Product) from sympy.functions.elem...
37a4d3beb968f47f48b7b1e6b0a62c48902b0638865044a15581a8e325ab5c1d
from sympy import ( adjoint, And, Basic, conjugate, diff, expand, Eq, Function, I, ITE, Integral, integrate, Interval, KroneckerDelta, lambdify, log, Max, Min, oo, Or, pi, Piecewise, piecewise_fold, Rational, solve, symbols, transpose, cos, sin, exp, Abs, Ne, Not, Symbol, S, sqrt, Sum, Tuple, zoo, Float...
36eecad3a49e08182b20284577d1916b91ff92de91b1bae2f08ee58f96efa7c6
from sympy.core.add import Add from sympy.core.assumptions import check_assumptions from sympy.core.containers import Tuple from sympy.core.compatibility import as_int, is_sequence, ordered from sympy.core.exprtools import factor_terms from sympy.core.function import _mexpand from sympy.core.mul import Mul from sympy.c...
a9214d601fcc5394857626b662d080729ca7592d50d19023bfb7adbffafafac7
r""" This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper functions that it uses. :py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations. See the docstring on the various functions for their uses. Note that partial differential equations support is in ``pde.py``. Note t...
0211befc65a77c85addcd7380f184ecb0d864e161919929172eb786b8c74dbb0
from sympy import Eq, factor, factorial, Function, Lambda, rf, S, sqrt, symbols, I, \ expand, binomial, Rational, Symbol, cos, sin, Abs from sympy.solvers.recurr import rsolve, rsolve_hyper, rsolve_poly, rsolve_ratio from sympy.testing.pytest import raises, slow from sympy.abc import a, b y = Function('y') n, k = ...
9d5b5278db727ddda16249f06a69112257815efdfee3551a722771d0fea38fb2
from sympy import (acos, acosh, atan, cos, Derivative, diff, Dummy, Eq, Ne, exp, Function, I, Integral, LambertW, log, O, pi, Rational, rootof, S, sin, sqrt, Subs, Symbol, tan, asin, sinh, Piecewise, symbols, Poly, sec, re, im, atan2, collect) from sympy.solvers.ode import (classify_ode, homogeneous_or...
582e57c0135f8d11ea7a5084bf1e2c3a3fd02e4b0f95ba2dcea817cdcd081789
# # The main tests for the code in single.py are currently located in # sympy/solvers/tests/test_ode.py # r""" This File contains test functions for the individual hints used for solving ODEs. Examples of each solver will be returned by _get_examples_ode_sol_name_of_solver. Examples should have a key 'XFAIL' which st...
c540e0a5480036bb51503514983f78a1439cfd8269a443094a080e083e9ed56d
""" Generic SymPy-Independent Strategies """ def identity(x): yield x def exhaust(brule): """ Apply a branching rule repeatedly until it has no effect """ def exhaust_brl(expr): seen = {expr} for nexpr in brule(expr): if nexpr not in seen: seen.add(nexpr) ...
3e7d5cbd621fd1ffe9c93dccbe809f67292a122388af443be62a889a02a2fb8d
from sympy.strategies.tree import treeapply, greedy, allresults, brute from functools import partial, reduce def test_treeapply(): tree = ([3, 3], [4, 1], 2) assert treeapply(tree, {list: min, tuple: max}) == 3 add = lambda *args: sum(args) mul = lambda *args: reduce(lambda a, b: a*b, args, 1) ass...
0e55aa5faecc13c9f7f2692567cb019bf8f36f368d0727b9ed99d49cfb919e5e
from sympy import S from sympy.strategies.core import (null_safe, exhaust, memoize, condition, chain, tryit, do_one, debug, switch, minimize) def test_null_safe(): def rl(expr): if expr == 1: return 2 safe_rl = null_safe(rl) assert rl(1) == safe_rl(1) assert rl(3) == N...
30e3f2604122fd48399827d138ee71c1f5a1476daad4a4a4c7a512eb9899cb46
from sympy.strategies.branch.core import (exhaust, debug, multiplex, condition, notempty, chain, onaction, sfilter, yieldify, do_one, identity) def posdec(x): if x > 0: yield x-1 else: yield x def branch5(x): if 0 < x < 5: yield x-1 elif 5 < x < 10: yiel...
d728982735ccf02e4d4695df201a91775c682d0da125016e655f081df2a2137c
# Tests that require installed backends go into # sympy/test_external/test_autowrap import os import tempfile import shutil from io import StringIO from sympy.core import symbols, Eq from sympy.utilities.autowrap import (autowrap, binary_function, CythonCodeWrapper, UfuncifyCodeWrapper, CodeWrapper) from ...
c8177a5b82c25657889f69b195aa5cf4489d235343402aabd28c3e33678ff2cd
from io import StringIO from sympy.core import S, symbols, Eq, pi, Catalan, EulerGamma, Function from sympy import Piecewise from sympy import Equality from sympy.matrices import Matrix, MatrixSymbol from sympy.utilities.codegen import OctaveCodeGen, codegen, make_routine from sympy.testing.pytest import raises from s...
57f874f0ad61e23f04bdd591b37e0a84b1789db9353d4f56ee9e56d56fa2966e
from sympy import symbols from sympy.external import import_module from sympy.utilities.matchpy_connector import WildDot, WildPlus, WildStar matchpy = import_module("matchpy") x, y, z = symbols("x y z") def _get_first_match(expr, pattern): from matchpy import ManyToOneMatcher, Pattern matcher = ManyToOneMa...
9b18f782da034de0378cc1eb20126d633de8f0e922d6e7d61f9f000527d9cf4b
from io import StringIO from sympy.core import S, symbols, pi, Catalan, EulerGamma, Function from sympy import Piecewise from sympy import Equality from sympy.utilities.codegen import RustCodeGen, codegen, make_routine from sympy.testing.pytest import XFAIL import sympy x, y, z = symbols('x,y,z') def test_empty_ru...
05a3b2bd911ca308722ae194cadf7fea095f308ea30d422947fd519c36e29420
from textwrap import dedent from itertools import islice, product from sympy import ( symbols, Integer, Integral, Tuple, Dummy, Basic, default_sort_key, Matrix, factorial, true) from sympy.combinatorics import RGS_enum, RGS_unrank, Permutation from sympy.core.compatibility import iterable from sympy.utilities....
5a1ab85fecc22c96d539abc2fd5fcc94fd28afd807a75eb3b166f04060a3b674
from io import StringIO from sympy.core import S, symbols, Eq, pi, Catalan, EulerGamma, Function from sympy import Piecewise from sympy import Equality from sympy.matrices import Matrix, MatrixSymbol from sympy.utilities.codegen import JuliaCodeGen, codegen, make_routine from sympy.testing.pytest import XFAIL import s...
3aa79bd10bce186bc244c26d99e5989066c7010ecf8c230adc406e11826786f5
from io import StringIO from sympy.core import symbols, Eq, pi, Catalan, Lambda, Dummy from sympy import erf, Integral, Symbol from sympy import Equality from sympy.matrices import Matrix, MatrixSymbol from sympy.utilities.codegen import ( codegen, make_routine, CCodeGen, C89CodeGen, C99CodeGen, InputArgument, ...
3b89436a7710e57205d2d1eb48403115b85e9dba792d6a1b2d4bbe399c2feda9
"""Symbolic primitives + unicode/ASCII abstraction for pretty.py""" import sys import warnings from string import ascii_lowercase, ascii_uppercase import unicodedata unicode_warnings = '' def U(name): """ Get a unicode character by name or, None if not found. This exists because older versions of python...
dc5c84636dac71dc11dc0d47d2b1d6a4f3836ca2b96ef7d9203e35bafe3ce61d
from typing import Any, Dict from sympy.testing.pytest import raises from sympy import (symbols, sympify, Function, Integer, Matrix, Abs, Rational, Float, S, WildFunction, ImmutableDenseMatrix, sin, true, false, ones, sqrt, root, AlgebraicNumber, Symbol, Dummy, Wild, MatrixSymbol) from sympy.combinatorics impo...
78dc15baf0f5850965a6d97f921b18fb5486b360aac3b51b516195314bc27f8f
from sympy import symbols from sympy.functions import beta, Ei, zeta, Max, Min, sqrt from sympy.printing.cxx import CXX98CodePrinter, CXX11CodePrinter, CXX17CodePrinter, cxxcode from sympy.codegen.cfunctions import log1p from sympy.testing.pytest import warns_deprecated_sympy x, y, u, v = symbols('x y u v') def tes...
4edb0f7e331818cd790473585248cc4a6a52a5ce4a8a24a09049226a5e6e732d
from sympy import (Add, Abs, Catalan, cos, Derivative, E, EulerGamma, exp, factorial, factorial2, Function, GoldenRatio, TribonacciConstant, I, Integer, Integral, Interval, Lambda, Limit, Matrix, nan, O, oo, pi, Pow, Rational, Float, Rel, S, sin, SparseMatrix, sqrt, summation, Sum, Symbol, symbols, Wild...
0a409b1c3fe6c6d0c82a5d45cc4ee276a072bdedaccf4c6a1997409c974041bc
from sympy.tensor.toperators import PartialDerivative from sympy import ( Abs, Chi, Ci, CosineTransform, Dict, Ei, Eq, FallingFactorial, FiniteSet, Float, FourierTransform, Function, Indexed, IndexedBase, Integral, Interval, InverseCosineTransform, InverseFourierTransform, Derivative, InverseLaplaceTra...
cdb156dee5d367ea78303361f33bcddda38188c67d991181954b93230c248d14
# -*- coding: utf-8 -*- from sympy import ( Add, And, Basic, Derivative, Dict, Eq, Equivalent, FF, FiniteSet, Function, Ge, Gt, I, Implies, Integral, SingularityFunction, Lambda, Le, Limit, Lt, Matrix, Mul, Nand, Ne, Nor, Not, O, Or, Pow, Product, QQ, RR, Rational, Ray, rootof, RootSum, S, Segment, ...
171fc02e36f76d377f02e8c92e430dde037894e37a52844e4afb7db1e0e787e3
"""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 from sympy import (Basic, S, symbols, sqrt, sin, oo, Interval, exp,...
11c16cce29e09325101b982ef5d7e12dec98ed8ab8dfde529261ced31b649de7
from sympy.core.basic import Basic from sympy.core.numbers import Rational from sympy.core.singleton import S, Singleton def test_Singleton(): global instantiated instantiated = 0 class MySingleton(Basic, metaclass=Singleton): def __new__(cls): global instantiated instantia...
3a83348a4fcd5318a2038c8bfbb1c6c64cfbceda4b2d5ae2f9a82586b9822f5a
"""This tests sympy/core/basic.py with (ideally) no reference to subclasses of Basic or Atom.""" import collections 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, Dummy from sympy.core.sy...
8f020e6ce3585e3c620d062488ebb036342179becfd731b2bf67462a5facdac6
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...
0d23d17cbbd22d69090cd7816468b93195b9f350d6dbf8f45dd1607cdcb2d289
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, Poly, FiniteSet ) from sympy.core.parameters import distribute from sympy.core.expr import u...
d26be338ee50e63285353a2d115b42098b59a01b4c2113afcef18000e5d0e051
"""Implementation of :class:`AlgebraicField` class. """ 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 from sympy.polys.polyerrors import CoercionFailed,...
f43ec63c6cb78ecc6ab06299c6f8d0dcbcddc46929b621dd709f5d56a51ad10f
"""Implementation of :class:`QuotientRing` class.""" from sympy.polys.agca.modules import FreeModuleQuotientRing from sympy.polys.domains.ring import Ring from sympy.polys.polyerrors import NotReversible, CoercionFailed from sympy.utilities import public # TODO # - successive quotients (when quotient ideals are impl...
765c45dad7e87d91857d2ecd5b55e394039b78352337b68220dd5efa1c7080cc
"""Implementation of :class:`ExpressionDomain` class. """ 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 SimpleDomain from sympy.polys.polyutils import Picklable...
8b227ba99f4cca18c11bc980360861b0ebfa568907a753ffe6bd5c68e6318bae
"""Ground types for various mathematical domains in SymPy. """ import builtins from sympy.core.compatibility import HAS_GMPY PythonInteger = builtins.int PythonReal = builtins.float PythonComplex = builtins.complex from .pythonrational import PythonRational from sympy.core.numbers import ( igcdex as python_gcde...
cbe176110ce2c795bcd22f3b3245d8c7e3685a4a79df42a3df9ca90cdd1d971c
"""Test sparse polynomials. """ from functools import reduce 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....
966efe7886cb13d3093e303b1d3e77bcc4ccb3c2037efe25dffbc3de9d4f82c2
"""Tests for tools for constructing domains for expressions. """ from sympy.polys.constructor import construct_domain from sympy.polys.domains import ZZ, QQ, ZZ_I, QQ_I, RR, CC, EX from sympy.polys.domains.realfield import RealField from sympy.polys.domains.complexfield import ComplexField from sympy import ( S, ...
c3e03e0666f8f315a6118ed10581b50e887df0d9a9ef5f10b85e21f6e530fbee
"""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 ...
3e4db8c809425e786bc6c4abeff7e361ae2c43ebcfece035d620dd990426a45f
"""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...
2b41cf2d1630b2130b1b67183202ab75ba8f38296834d4d5d526d3f57b2044ae
"""Tests for user-friendly public interface to polynomial functions. """ import pickle 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, in...
3694386f4cc3e0b32b7261ade43abed6148614fa621c9bc313782a3fc9ce6183
from sympy.core.compatibility import HAS_GMPY from sympy.core.numbers import Rational from sympy.functions import sqrt from sympy.matrices.common import (NonInvertibleMatrixError, NonSquareMatrixError, ShapeError) from sympy.matrices.dense import Matrix from sympy.polys import ZZ, QQ from sympy.polys.domainmatrix i...
b088423c6d10fff6c8f44400662caa8dcdc709996dc4ca66d32f2f20ee71f3db
"""Computations with ideals of polynomial rings.""" from functools import reduce from sympy.polys.polyerrors import CoercionFailed class Ideal: """ Abstract base class for ideals. Do not instantiate - use explicit constructors in the ring class instead: >>> from sympy import QQ >>> from sympy....
acbea65b10e3d3577751f7b8df3929cd80e7703cf6327eb84f5040a2463b13c1
""" 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...
a8362c239475bdb79f1d24a28ccffd20b3786934ae26281e9d0373bbe60b016d
"""Finite extensions of ring domains.""" from sympy.polys.polyerrors import CoercionFailed, NotInvertible from sympy.polys.polytools import Poly from sympy.printing.defaults import DefaultPrinting class ExtensionElement(DefaultPrinting): """ Element of a finite extension. A class of univariate polynomia...
3a520ea80915dce601d0695ef99ed4f2caf2cbc4fe8dc3043b60b262e0293ca6
#!/usr/bin/env python """ Import diagnostics. Run bin/diagnose_imports.py --help for details. """ from typing import Dict if __name__ == "__main__": import sys import inspect import builtins import optparse from os.path import abspath, dirname, join, normpath this_file = abspath(__file__) ...
2452330ae26a084a8154a71fdf82a1b57b424801c487b9f53f6b85385d5ac7c6
from sympy import Symbol, Rational, S from sympy.geometry import Circle, Ellipse, Line, Point, Polygon, Ray, RegularPolygon, Segment, Triangle from sympy.geometry.entity import scale, GeometryEntity from sympy.testing.pytest import raises from random import random def test_entity(): x = Symbol('x', real=True) ...
9f6d4842c41c2738e523873c0c700500b342a9981ffd44d6da8e98d7cc0f25d9
from sympy.testing.pytest import raises, XFAIL from sympy.external import import_module from sympy import ( Symbol, Mul, Add, Abs, sin, asin, cos, Pow, csc, sec, Limit, oo, Derivative, Integral, factorial, sqrt, root, StrictLessThan, LessThan, StrictGreaterThan, GreaterThan, Sum, Product, E, log, tan, ...
456198e310bb593c508068f6a996975880911824f0e6ea6a95c5dabbfdb8b62f
import os import subprocess import glob from sympy.utilities.misc import debug here = os.path.dirname(__file__) grammar_file = os.path.abspath(os.path.join(here, "LaTeX.g4")) dir_latex_antlr = os.path.join(here, "_antlr") header = ''' # encoding: utf-8 # *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND *** # ...
0c81381c17d2eef7ce6d0c78f59cd4ed37e0786908eed491d83b6b08f1b419bc
# Ported from latex2sympy by @augustt198 # https://github.com/augustt198/latex2sympy # See license in LICENSE.txt import sympy from sympy.external import import_module from sympy.printing.str import StrPrinter from sympy.physics.quantum.state import Bra, Ket from .errors import LaTeXParsingError LaTeXParser = LaTeX...
f323d5f7de73cda2844ef30b76000b889cad9f1267769117408d5cf4c4cc3bc6
"""Hermitian conjugation.""" from sympy.core import Expr, Mul from sympy.functions.elementary.complexes import adjoint __all__ = [ 'Dagger' ] class Dagger(adjoint): """General Hermitian conjugate operation. Explanation =========== Take the Hermetian conjugate of an argument [1]_. For matrices ...
cd4d542c635f01acd8679014d52058e3620e7fe803ac7c57360d5e8333d40bef
"""The anti-commutator: ``{A,B} = A*B + B*A``.""" from sympy import S, Expr, Mul, Integer from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.operator import Operator from sympy.physics.quantum.dagger import Dagger __all__ = [ 'AntiCommutator' ] #----------------------------------...
cef625a310706076d1b1a8d781f5cf23293cae4f057dd43a97239aac82e92bd3
"""The commutator: [A,B] = A*B - B*A.""" from sympy import S, Expr, Mul, Add, Pow from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.dagger import Dagger from sympy.physics.quantum.operator import Operator __all__ = [ 'Commutator' ] #---------------------------------------------...
9491caf527eec0daff50709992efe2a828d075c74f4988d181cffad12736eaf7
"""Matplotlib based plotting of quantum circuits. Todo: * Optimize printing of large circuits. * Get this to work with single gates. * Do a better job checking the form of circuits to make sure it is a Mul of Gates. * Get multi-target gates plotting. * Get initial and final states to plot. * Get measurements to plo...
cef0ec91f669ce669fa3dc5872999c02c79ed6d5f9d7534570b950a25c24194d
#TODO: # -Implement Clebsch-Gordan symmetries # -Improve simplification method # -Implement new simpifications """Clebsch-Gordon Coefficients.""" from sympy import (Add, expand, Eq, Expr, Mul, Piecewise, Pow, sqrt, Sum, symbols, sympify, Wild) from sympy.printing.pretty.stringpict import prettyForm,...
d874beffb103d9f8164ec0f27fe1b80d7e28f1afcc9d52601467b76c2213937c
"""Primitive circuit operations on quantum circuits.""" from functools import reduce from sympy import Symbol, Tuple, Mul, sympify, default_sort_key from sympy.utilities import numbered_symbols from sympy.physics.quantum.gate import Gate __all__ = [ 'kmp_table', 'find_subcircuit', 'replace_subcircuit', ...
287185e577559233945ddcb43361f4b16729faffe77cd51f9d21045dcc78b54a
"""Hilbert spaces for quantum mechanics. Authors: * Brian Granger * Matt Curry """ from functools import reduce from sympy import Basic, Interval, oo, sympify from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.qexpr import QuantumError __all__ = [ 'HilbertSpaceError', 'Hilbe...
c65c64c8e8e4d1762fdeef6b35a4978b756a2c0e58ff14e45c2217e2a18c5770
__all__ = ['Linearizer'] from sympy.core.backend import Matrix, eye, zeros from sympy import Dummy from sympy.utilities.iterables import flatten from sympy.physics.vector import dynamicsymbols from sympy.physics.mechanics.functions import msubs from collections import namedtuple from collections.abc import Iterable ...
2fd7084c051685c58686a87114e8a135821b06d29e864e1779baee3bbfd9a1ae
""" Definition of physical dimensions. Unit systems will be constructed on top of these dimensions. Most of the examples in the doc use MKS system and are presented from the computer point of view: from a human point, adding length to time is not legal in MKS but it is in natural system; for a computer in natural sys...
c8d51bf72851c9e020113aadb6830b71145b386f44dbbd3a4dfd574e86319d04
""" Several methods to simplify expressions involving unit objects. """ from functools import reduce from collections.abc import Iterable from sympy import Add, Mul, Pow, Tuple, sympify from sympy.core.compatibility import ordered from sympy.matrices.common import NonInvertibleMatrixError from sympy.physics.units.dime...
37d3603d40caf309b4ac1bd61deafedd985ed423872fa80f8ff390bb675b459d
from sympy import Derivative from sympy.core.function import UndefinedFunction, AppliedUndef from sympy.core.symbol import Symbol from sympy.interactive.printing import init_printing from sympy.printing.latex import LatexPrinter from sympy.printing.pretty.pretty import PrettyPrinter from sympy.printing.pretty.pretty_sy...
2fb102754cb71c5868fbb34e2f1738988b1aeefa5b6552a796e455e5e2f25623
from sympy.core.backend import (S, sympify, expand, sqrt, Add, zeros, ImmutableMatrix as Matrix) from sympy import trigsimp from sympy.printing.defaults import Printable from sympy.utilities.misc import filldedent from sympy.core.evalf import EvalfMixin, prec_to_dps __all__ = ['Vector'] class Vector(Printable, E...
cbda8e74146f20ebc226d605faea2c48d8e6878cde963026cb85f99d45062c89
from functools import reduce from sympy.core.backend import (sympify, diff, sin, cos, Matrix, symbols, Function, S, Symbol) from sympy import integrate, trigsimp from .vector import Vector, _check_vector from .frame import CoordinateSym, _check_frame from .dyadic import Dyadic from .pri...
e4b2e3fb35390dffddc31c0dfad1cff19e5fc8299ee841f525f28ca9d8e60477
from sympy.core.backend import sympify, Add, ImmutableMatrix as Matrix from sympy.core.evalf import EvalfMixin, prec_to_dps from sympy.printing.defaults import Printable __all__ = ['Dyadic'] class Dyadic(Printable, EvalfMixin): """A Dyadic object. See: https://en.wikipedia.org/wiki/Dyadic_tensor Kan...
1825d967c0f9557fee78087348bb26094ec82c979ba8a910fa2ed4c246868df3
#!/usr/bin/env python # -*- coding: utf-8 -*- """ The module implements routines to model the polarization of optical fields and can be used to calculate the effects of polarization optical elements on the fields. - Jones vectors. - Stokes vectors. - Jones matrices. - Mueller matrices. Examples ======== We calcul...
74d0798d672910639452b340d258f025d2a74db4df3ef7e15a5974efa8ecb3a9
""" **Contains** * Medium """ from sympy.physics.units import second, meter, kilogram, ampere __all__ = ['Medium'] from sympy import Symbol, sympify, sqrt from sympy.physics.units import speed_of_light, u0, e0 c = speed_of_light.convert_to(meter/second) _e0mksa = e0.convert_to(ampere**2*second**4/(kilogram*meter**...
432c41cb5f7753c6c54f22e9b45311f8e8b04f75f668dfe685c822a06b9fb98b
""" **Contains** * refraction_angle * fresnel_coefficients * deviation * brewster_angle * critical_angle * lens_makers_formula * mirror_formula * lens_formula * hyperfocal_distance * transverse_magnification """ __all__ = ['refraction_angle', 'deviation', 'fresnel_coefficients', 'brew...
78eb4155332fd37d02e248becdea66028a4fdb60c34b6fc57222f67eb4917082
""" This module has all the classes and functions related to waves in optics. **Contains** * TWave """ __all__ = ['TWave'] from sympy import (sympify, pi, sin, cos, sqrt, Symbol, S, symbols, Derivative, atan2) from sympy.core.expr import Expr from sympy.physics.units import speed_of_light, meter, second c = s...
e24496983b0f6553aa0f10f7df3b589a5f342fbf8e62eaa24d5dcd9bf1938cdf
""" Gaussian optics. The module implements: - Ray transfer matrices for geometrical and gaussian optics. See RayTransferMatrix, GeometricRay and BeamParameter - Conjugation relations for geometrical and gaussian optics. See geometric_conj*, gauss_conj and conjugate_gauss_beams The conventions for the distance...
aa74d43d4fb6f4a9c1ee786e6ac2300daa986bff57596de0635676346a4dd907
# -*- encoding: utf-8 -*- """ TODO: * Address Issue 2251, printing of spin states """ from typing import Dict, Any from sympy.physics.quantum.anticommutator import AntiCommutator from sympy.physics.quantum.cg import CG, Wigner3j, Wigner6j, Wigner9j from sympy.physics.quantum.commutator import Commutator from sympy.phy...
1aaf667f7a3f073b080770c19d22210abd7312d59a9b9c3e5947d5e7124069a9
from sympy import (Abs, Add, Function, Number, Rational, S, Symbol, diff, exp, integrate, log, sin, sqrt, symbols) from sympy.physics.units import (amount_of_substance, convert_to, find_unit, volume, kilometer, joule) from sympy.physics.units.definitions import (amu, ...
bc844aba23cf33d4cb9fade803e469ce7fbb674039537b24fef34ee83d5e2968
from sympy import Pow, Tuple, pi, sstr, sympify, symbols from sympy.physics.units import ( G, centimeter, coulomb, day, degree, gram, hbar, hour, inch, joule, kelvin, kilogram, kilometer, length, meter, mile, minute, newton, planck, planck_length, planck_mass, planck_temperature, planck_time, radians, s...
4a8de6be23d8209132d49d3ac5ce82ddda12e30fc9e6e2ecbd4dbad4742ee64b
from sympy import symbols, pi, sin, cos, Float, ImmutableMatrix as Matrix from sympy.physics.vector import ReferenceFrame, Vector, dynamicsymbols, dot from sympy.abc import x, y, z from sympy.testing.pytest import raises Vector.simp = True A = ReferenceFrame('A') def test_Vector(): assert A.x != A.y assert ...