hash
stringlengths
64
64
content
stringlengths
0
1.51M
5e3e745ef74e45fa435367636717ba609fc1683b6ee89575291370df22044339
from sympy import (symbols, Symbol, sinh, diff, Function, Derivative, Matrix, Rational, S, I, Eq, sqrt, Mul, pi) from sympy.core.containers import Tuple from sympy.functions import exp, cos, sin, log, tan, Ci, Si, erf, erfi from sympy.matrices import dotprodsimp, NonSquareMatrixError from sympy.solve...
efb4dd0a52b4fe57cee657b4184b0f56585d855056ddd59442bd813219a75762
""" Tests from Michael Wester's 1999 paper "Review of CAS mathematical capabilities". http://www.math.unm.edu/~wester/cas/book/Wester.pdf See also http://math.unm.edu/~wester/cas_review.html for detailed output of each tested system. """ from sympy import (Rational, symbols, Dummy, factorial, sqrt, log, exp, oo, zoo,...
12ceab880da59449913cf445ddf66e86e6a4dc59d06e2e6494d9b5c15d00a9b9
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....
de6f8cb5b7b55f1c99ccb8449babe34d0fd01fa322e07e1c5c907893d39e6ec4
import itertools from sympy.core import S from sympy.core.containers import Tuple from sympy.core.function import _coeff_isneg from sympy.core.mul import Mul from sympy.core.numbers import Number, Rational from sympy.core.power import Pow from sympy.core.symbol import Symbol from sympy.core.sympify import SympifyError...
c6f99d0482a4656c89e814442bbe765baca87a32e39b77a1e0cd89e37bbbb1ed
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...
5a2e4ff62c71a016167c99e1fd4738ba5e422cf307a40f2ea06566a9b027e941
from sympy.tensor.array.expressions.array_expressions import ArraySymbol, ArrayElement from sympy.tensor.toperators import PartialDerivative from sympy import ( Abs, Chi, Ci, CosineTransform, Dict, Ei, Eq, FallingFactorial, FiniteSet, Float, FourierTransform, Function, Indexed, IndexedBase, Integral, Inter...
a5040c59b402162d89564c183331680dd13c7843d434aebb62279c7ea42de2e9
# -*- 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, ...
c531d8c24fb728b82f0e437f0d16ece3ea616b91a69aca189e30bae609815bf2
from sympy import ( Abs, acos, acosh, Add, And, asin, asinh, atan, Ci, cos, sinh, cosh, tanh, Derivative, diff, DiracDelta, E, Ei, Eq, exp, erf, erfc, erfi, EulerGamma, Expr, factor, Function, gamma, gammasimp, I, Idx, im, IndexedBase, integrate, Interval, Lambda, LambertW, log, Matrix, Max, meijerg, Mi...
d91e60d1f085b7430ba9b3323e7cf27011f84009b146ca451c5c39e487715f33
from sympy import (sin, cos, tan, sec, csc, cot, log, exp, atan, asin, acos, Symbol, Integral, integrate, pi, Dummy, Derivative, diff, I, sqrt, erf, Piecewise, Ne, symbols, Rational, And, Heaviside, S, asinh, acosh, atanh, acoth, expand, Functi...
ecaf59a4e389faa0412543bfb5883c00bc5d86b327d65e2af3297480fc32b72f
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...
dd7da38e3205a9529bb4d3e44fc708032f5555d3ba7316f60945ecf8985ab6b7
"""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,...
fde39ccac63530d24f291debac165ce59b543590c503b61a20c1f9c7de595497
from sympy.core import ( Basic, Rational, Symbol, S, Float, Integer, Mul, Number, Pow, Expr, I, nan, pi, symbols, oo, zoo, N) from sympy.core.parameters import global_parameters from sympy.core.tests.test_evalf import NS from sympy.core.function import expand_multinomial from sympy.functions.elementary.miscella...
28dc8f7d18b22e78587cf975c8ec67e214486145e8db397cb876dd5177e47514
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...
6d8d39ec80c5c95b3ceb88dc278e992132efe7bc4c28d7c1570042fa69f324b0
"""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...
fc478d0cd7aa2328f4cc7a2f20b89a0a86b75cba125e1ce91b94c158e80ab1e1
from .lti import (TransferFunction, Series, MIMOSeries, Parallel, MIMOParallel, Feedback, MIMOFeedback, TransferFunctionMatrix) from .control_plots import (pole_zero_numerical_data, pole_zero_plot, step_response_numerical_data, step_response_plot, impulse_response_numerical_data, impulse_response_plot, ramp_res...
86d246fd48d839ff64afbbf4ac26732bbc1e8d7f9cca14eafedbd421ec193c5d
from sympy import Basic, Add, Mul, Pow, degree, Symbol, expand, cancel, Expr, roots from sympy.core.containers import Tuple from sympy.core.evalf import EvalfMixin, prec_to_dps from sympy.core.logic import fuzzy_and from sympy.core.numbers import Integer, ComplexInfinity from sympy.core.symbol import Dummy from sympy.c...
4fddda2a0103a89f7b82bd45b1abc4b4a1d38c4ff210392c88c45ff7d7e0f26b
from sympy import I, log, apart, exp from sympy.core.symbol import Dummy from sympy.external import import_module from sympy.functions import arg, Abs from sympy.integrals.transforms import _fast_inverse_laplace from sympy.physics.control.lti import SISOLinearTimeInvariant from sympy.plotting.plot import LineOver1DRang...
0f426fe80fde8284e1a261f31a1337f61ecaa0c7c9e4b9bbbaa97c48a01ef837
from sympy.core.backend import Symbol from sympy.physics.vector import Point, Vector, ReferenceFrame from sympy.physics.mechanics import RigidBody, Particle, inertia __all__ = ['Body'] # XXX: We use type:ignore because the classes RigidBody and Particle have # inconsistent parallel axis methods that take different n...
1526356b6516ce1567fecba6906ddc2e65d13e633688393a0d4f1012f2cfb62a
__all__ = [ 'vector', 'CoordinateSym', 'ReferenceFrame', 'Dyadic', 'Vector', 'Point', 'cross', 'dot', 'express', 'time_derivative', 'outer', 'kinematic_equations', 'get_motion_params', 'partial_velocity', 'dynamicsymbols', 'vprint', 'vsstrrepr', 'vsprint', 'vpprint', 'vlatex', 'init_vprinting', 'cu...
c69bddd2b66f454c8ef41f936525cd3938873fcc5833795587b300f6cd3bc4fa
from sympy.core.backend import zeros, Matrix, diff, eye from sympy import solve_linear_system_LU from sympy.utilities import default_sort_key from sympy.physics.vector import (ReferenceFrame, dynamicsymbols, partial_velocity) from sympy.physics.mechanics.method import _Methods from sym...
8b953d611e29259ec460b1aff846c8be45270e603d00d78ac9a979c0d0f00330
from sympy.physics.mechanics import (Body, Lagrangian, KanesMethod, LagrangesMethod, RigidBody, Particle) from sympy.physics.mechanics.method import _Methods __all__ = ['JointsMethod'] class JointsMethod(_Methods): """Method for formulating the equations of motion using a set ...
a08a06220b88218b73aea2addcb88e957e7b4d4eae68100dc8362d2d948c1e80
from sympy.core.backend import diff, zeros, Matrix, eye, sympify from sympy.physics.vector import dynamicsymbols, ReferenceFrame from sympy.physics.mechanics.method import _Methods from sympy.physics.mechanics.functions import (find_dynamicsymbols, msubs, _f_list_parser) f...
daf151840efdadae0747a0335411ccaf7a0d9dcadcaa02cb311a9dca27f40eb2
from abc import ABC, abstractmethod class _Methods(ABC): """Abstract Base Class for all methods.""" @abstractmethod def q(self): pass @abstractmethod def u(self): pass @abstractmethod def bodies(self): pass @abstractmethod def loads(self): pass ...
ffc4f2a9560b53bc767cf5f5abc2969c8f20d8edd7d00b1dda158f9f2764ce4e
from sympy.physics.matrices import msigma, mgamma, minkowski_tensor, pat_matrix, mdft from sympy import zeros, eye, I, Matrix, sqrt, Rational, S from sympy.testing.pytest import warns_deprecated_sympy def test_parallel_axis_theorem(): # This tests the parallel axis theorem matrix by comparing to test # matric...
df68db20581eeaef85d1ca8f14cded5a0ee4b04b0a949270c8eff0546f03929a
""" This module can be used to solve 2D beam bending problems with singularity functions in mechanics. """ from sympy.core import S, Symbol, diff, symbols from sympy.solvers import linsolve from sympy.printing import sstr from sympy.functions import SingularityFunction, Piecewise, factorial from sympy.core import symp...
b89d3648928cf4901c7d6a55420d39fefecc0ebf186138a2f4d2910a468a30c5
from sympy import (symbols, factor, Function, simplify, exp, oo, I, S, Mul, Pow, Add, Rational, sqrt, CRootOf, eye) from sympy.core.containers import Tuple from sympy.matrices import ImmutableMatrix, Matrix from sympy.physics.control import (TransferFunction, Series, Parallel, Feedback, TransferFunctionMatrix, ...
f8b5aea73157241f8254420e09fe00f5d306195cf2ee80bd0d7775800eba5f1f
from sympy import Dummy, arg, I, Abs, log from sympy.abc import s, p, a from sympy.external import import_module from sympy.physics.control.control_plots import \ (pole_zero_numerical_data, pole_zero_plot, step_response_numerical_data, step_response_plot, impulse_response_numerical_data, impulse_response_pl...
9b7c2e8d1c721eaf3b19f74f083365cbd41a4e03f68cca6aefc6ea23435a4376
from sympy.core.backend import (cos, expand, Matrix, sin, symbols, tan, sqrt, S, zeros) from sympy import simplify from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point, RigidBody, KanesMethod, inertia, Particle, ...
3db6d98705d689c0a252d1e96f989945652d415645f4fa970511bd550ca0da09
from sympy import symbols, Matrix, cos, sin, expand, trigsimp from sympy.physics.mechanics import (PinJoint, JointsMethod, Body, KanesMethod, PrismaticJoint, LagrangesMethod, inertia) from sympy.physics.vector import dynamicsymbols, ReferenceFrame from sympy.testing.pytest import rai...
aef7db49d1fcf8b45f4596b34f712c0b97983bc5c6395662bbd2a5e8b3b3cb41
from sympy.core.backend import Symbol, symbols, sin, cos, Matrix from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols from sympy.physics.mechanics import inertia, Body from sympy.testing.pytest import raises def test_default(): body = Body('body') assert body.name == 'body' assert body.lo...
281bcfc8f891954e9924928bbf578a430966ab6ad1fc3516e2be0fb9f16bad44
from sympy import Basic from sympy import S from sympy.core.expr import Expr from sympy.core.numbers import Integer from sympy.core.sympify import sympify from sympy.core.kind import Kind, NumberKind, UndefinedKind from sympy.core.compatibility import SYMPY_INTS from sympy.printing.defaults import Printable import ite...
8bf68f2e5d441e91c91844cb11ab5d1d5caa2d392337d77e93ed37f535324c57
from copy import copy from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray from sympy import Symbol, Rational, SparseMatrix, Dict, diff, symbols, Indexed, IndexedBase, S from sympy.matrices import Matrix from sympy.tensor.array.sparse_ndim_array import ImmutableSparseNDimArray from sympy.testing.pyt...
001bb9879f8a3ffc6ed50188629133900381ef70482eaea9c811678ce9210fa7
import itertools from typing import Tuple, Optional, List from functools import singledispatch from itertools import accumulate from sympy import Trace, MatrixExpr, Transpose, DiagMatrix, Mul, ZeroMatrix from sympy.combinatorics.permutations import _af_invert, Permutation from sympy.matrices.common import MatrixCommon...
fb185c01aa7f3ff62969aee8d8a17d886b48f08ee20d3dca2867ecbe1734c053
import operator from functools import reduce import itertools from itertools import accumulate from typing import Optional, List, Dict from sympy import Expr, ImmutableDenseNDimArray, S, Symbol, Integer, ZeroMatrix, Basic, tensorproduct, Add, permutedims, \ Tuple, tensordiagonal, Lambda, Dummy, Function, MatrixExp...
7ac44bf5c7aa4e38f39613f41bf11b2378312e46279cbc598bebc3a8d8eb652d
from sympy import ( symbols, Identity, cos, ZeroMatrix, OneMatrix, sqrt) from sympy.tensor.array.expressions.conv_matrix_to_array import convert_matrix_to_array from sympy.tensor.array.expressions.conv_array_to_matrix import _support_function_tp1_recognize, \ _array_diag2contr_diagmatrix, convert_array_to_matri...
2ff2fceef887a0ee21a66c399a04ae974841eb718446005e6e4e5b94385c4548
import random from sympy import symbols, ImmutableDenseNDimArray, tensorproduct, tensorcontraction, permutedims, MatrixSymbol, \ ZeroMatrix, sin, cos, DiagMatrix from sympy.combinatorics import Permutation from sympy.tensor.array.expressions.array_expressions import ZeroArray, OneArray, ArraySymbol, ArrayElement, ...
8bd0e0810394a1aca1143da09d253381a3b4977132e5f2655982728e90bf78fd
from sympy.matrices.expressions import MatrixExpr from sympy import MatrixBase, Dummy, Lambda, Function, FunctionClass from sympy.core.sympify import sympify, _sympify class ElementwiseApplyFunction(MatrixExpr): r""" Apply function to a matrix elementwise without evaluating. Examples ======== It...
774bd2591ea72bc3e343d94057c38356c652b5ee82692b22214ebcdad0046722
from sympy.core.sympify import _sympify from sympy.matrices.expressions import MatrixExpr from sympy import S, I, sqrt, exp class DFT(MatrixExpr): r""" Returns a discrete Fourier transform matrix. The matrix is scaled with :math:`\frac{1}{\sqrt{n}}` so that it is unitary. Parameters ========== ...
9beaebfef3c5f990a010fb48e2082081734b9f6ef63b627e26d628fadb2cc1af
from sympy import Basic, Expr, sympify, S from sympy.matrices.matrices import MatrixBase from sympy.matrices.common import NonSquareMatrixError class Trace(Expr): """Matrix Trace Represents the trace of a matrix expression. Examples ======== >>> from sympy import MatrixSymbol, Trace, eye >>...
521d5661e750b4cd0dce07a27e5945ef3c052ffe45b2d8978632d0741490d861
from sympy import S, I, ask, Q, Abs, simplify, exp, sqrt, Rational from sympy.core.symbol import symbols from sympy.matrices.expressions.fourier import DFT, IDFT from sympy.matrices import det, Matrix, Identity from sympy.testing.pytest import raises def test_dft_creation(): assert DFT(2) assert DFT(0) ra...
1d1bf3d0448f70c12f8e2b8d6d538bb9721e3072da5941a91cadc2cc5b7ed640
from sympy.core.symbol import symbols, Dummy from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction from sympy import Matrix, Lambda, MatrixSymbol, exp, MatMul, sin, simplify from sympy.testing.pytest import raises from sympy.matrices.common import ShapeError X = MatrixSymbol("X", 3, 3) Y = MatrixS...
59bde399e680cf195b49fd88711d109a51f75114f9a463eb9a1b47389cc3e647
from sympy.core import Lambda, S, symbols from sympy.concrete import Sum from sympy.functions import adjoint, conjugate, transpose from sympy.matrices import eye, Matrix, ShapeError, ImmutableMatrix from sympy.matrices.expressions import ( Adjoint, Identity, FunctionMatrix, MatrixExpr, MatrixSymbol, Trace, Zero...
8e4c3f6a32526779c8c3d18057d5a212ad76b5e21c371c803e7a2c8bc5e17c45
#!/usr/bin/env python """Distutils based setup script for SymPy. This uses Distutils (https://python.org/sigs/distutils-sig/) the standard python mechanism for installing packages. Optionally, you can use Setuptools (https://setuptools.readthedocs.io/en/latest/) to automatically handle dependencies. For the easiest in...
97edca1aa77b656c8ee3fa51d9361b8c3132c8ea87faff82d96ae303fc2f3166
#!/usr/bin/env python """ Run tests involving symengine These are separate from the other optional dependency tests because they need to be run with the USE_SYMENGINE=1 environment variable set. This script does not set the environment variable by default so that the same tests can be run with and without symengine. ...
89e32c873d39e44c1ab105a7a112e66ff7348dc338ad3617c3e6b2993d8b165d
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A tool to generate AUTHORS. We started tracking authors before moving to git, so we have to do some manual rearrangement of the git history authors in order to get the order in AUTHORS. bin/mailmap_update.py should be run before committing the results. """ from __futur...
5250bd84e7effce2b00c6d5fa7f098aefd1ac2b15d15d31b656a9f1fcb8c67f1
#!/usr/bin/env python """ Run tests for specific packages that use optional dependencies. The optional dependencies need to be installed before running this. """ # Add the local sympy to sys.path (needed for CI) from get_sympy import path_hack path_hack() class TestsFailedError(Exception): pass print('Testing...
f8a5fa373c936d909b0ead0ed2104d317f5b15475b46233185c99f0fdc0deb52
#!/usr/bin/env python """ Run tests involving tensorflow These are separate from the other optional dependency tests because tensorflow pins the numpy version. """ # Add the local sympy to sys.path (needed for CI) from get_sympy import path_hack path_hack() class TestsFailedError(Exception): pass test_list = ...
41e7929e49e1f49ae5e44c0d230a162d589b758cd0bf6d7ab5edd8ab45c6b057
#!/usr/bin/env python """ A tool to help keep .mailmap up-to-date with the current git authors. See also bin/authors_update.py """ import codecs import sys import os if sys.version_info < (3, 6): sys.exit("This script requires Python 3.6 or newer") from subprocess import run, PIPE from sympy.external.importtoo...
3ce3da865cccfcd52e47fc8b1e568d5135cab2ff6e2f7dd7e1c42eabc5fa04c2
""" SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python. It depends on mpmath, and other external libraries may be option...
d577a35adf785a149dbfde37eefc88e8c11094bcbfec5d4a1cb8a75c4d302a6f
import sys sys._running_pytest = True # type: ignore from sympy.external.importtools import version_tuple import pytest from sympy.core.cache import clear_cache import re sp = re.compile(r'([0-9]+)/([1-9][0-9]*)') def process_split(config, items): split = config.getoption("--split") if not split: re...
6973c034a8d0d4de705591614fd1fe49bd64637650b39155e346c9f83f91a9f3
__version__ = "1.10.dev"
18a32de1284052e5b27d52384ceeba803327e0951fa63265b91255ccd3d8962b
# # SymPy documentation build configuration file, created by # sphinx-quickstart.py on Sat Mar 22 19:34:32 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are...
0b3d5fb85ee3bd9eb6ce00f8a2998c30e9c093ad8d113e593a0a11b65fa5c8df
""" Continuous Random Variables - Prebuilt variables Contains ======== Arcsin Benini Beta BetaNoncentral BetaPrime BoundedPareto Cauchy Chi ChiNoncentral ChiSquared Dagum Erlang ExGaussian Exponential ExponentialPower FDistribution FisherZ Frechet Gamma GammaInverse Gumbel Gompertz Kumaraswamy Laplace Levy LogCauchy L...
245a004b765c9f2ccf0eff35f716ef9d2dbc7b6bb821e76b6f4329106e0b4953
""" Finite Discrete Random Variables - Prebuilt variable types Contains ======== FiniteRV DiscreteUniform Die Bernoulli Coin Binomial BetaBinomial Hypergeometric Rademacher IdealSoliton RobustSoliton """ from sympy import (S, sympify, Rational, binomial, cacheit, Integer, Dummy, Eq, Intersection, ...
059ec38b45f5c7496305284fd025283c77987eb357e81db784d8db7cb51ba9da
from __future__ import print_function, division import random import itertools from typing import Sequence as tSequence, Union as tUnion, List as tList, Tuple as tTuple from sympy import (Matrix, MatrixSymbol, S, Indexed, Basic, Tuple, Range, Set, And, Eq, FiniteSet, ImmutableMatrix, Integer, igcd,...
d646022f432d467f0938dd794d31583328382206bbf02cc8b514b8f3f4fa389c
from sympy.sets import FiniteSet from sympy import (sqrt, log, exp, FallingFactorial, Rational, Eq, Dummy, piecewise_fold, solveset, Integral) from .rv import (probability, expectation, density, where, given, pspace, cdf, PSpace, characteristic_function, sample, sample_iter, random_symb...
553dbe80c5e0a90a3ec46e23dbc0676ac43d38d967d510c9adbbca4e6db3c801
""" Main Random Variables Module Defines abstract random variable type. Contains interfaces for probability space object (PSpace) as well as standard operators, P, E, sample, density, where, quantile See Also ======== sympy.stats.crv sympy.stats.frv sympy.stats.rv_interface """ from functools import singledispatch...
5ecc58d3f9d459c05675d3e046bac9a1d0139fc43d893deb3e2a20ddfda3ac96
""" Joint Random Variables Module See Also ======== sympy.stats.rv sympy.stats.frv sympy.stats.crv sympy.stats.drv """ from sympy import (Basic, Lambda, sympify, Indexed, Symbol, ProductSet, S, Dummy, prod) from sympy.concrete.products import Product from sympy.concrete.summations import Sum, summ...
37e375d591e1f8233332be843d5e709ae944ad584c3e2dd3f28cd4691c9f47c3
import itertools from sympy import (Expr, Add, Mul, S, Integral, Eq, Sum, Symbol, expand as _expand, Not) from sympy.core.compatibility import default_sort_key from sympy.core.parameters import global_parameters from sympy.core.sympify import _sympify from sympy.core.relational import Relational fr...
515f25204e68748e37bf2ab830cbe0534714ea0dfb05c72b079c6cb6f73c2e9d
from sympy import (Basic, exp, pi, Lambda, Trace, S, MatrixSymbol, Integral, gamma, Product, Dummy, Sum, Abs, IndexedBase, I) from sympy.core.sympify import _sympify from sympy.stats.rv import _symbol_converter, Density, RandomMatrixSymbol, is_random from sympy.stats.joint_rv_types import JointDistri...
73258ec0c2083c67c0c3f39662dd883c92ad70b70fa1c88a6b336a9923656676
from sympy.core.compatibility import as_int from sympy.core.function import Function from sympy.core.numbers import igcd, igcdex, mod_inverse from sympy.core.power import isqrt from sympy.core.singleton import S from .primetest import isprime from .factor_ import factorint, trailing, totient, multiplicity from random i...
c3fbba312ca4f04da66e32779af2b0fa907bdc313dee8eee2cd95529db464a4b
""" Primality testing """ from sympy.core.compatibility import as_int from mpmath.libmp import bitcount as _bitlength def _int_tuple(*i): return tuple(int(_) for _ in i) def is_euler_pseudoprime(n, b): """Returns True if n is prime or an Euler pseudoprime to base b, else False. Euler Pseudoprime : I...
847fd80eed87b6c34d89a93707a4598439dff63b2e6472e696ec528423810ecb
from sympy.core.numbers import igcd, mod_inverse from sympy.ntheory.residue_ntheory import _sqrt_mod_prime_power from sympy.ntheory import isprime from math import log, sqrt import random rgen = random.Random() class SievePolynomial: def __init__(self, modified_coeff=(), a=None, b=None): """This class den...
8063127e3cdbbdcd0c8a31dcf37c332f40874ad4488c2680f977f6942ea0aa26
from random import randrange, choice from math import log from sympy.ntheory import primefactors from sympy import multiplicity, factorint, Symbol from sympy.combinatorics import Permutation from sympy.combinatorics.permutations import (_af_commutes_with, _af_invert, _af_rmul, _af_rmuln, _af_pow, Cycle) from sympy...
2728f15c50a401081edaee5c08abd83a9480b7ab4a174d4589329465e5fd4833
import random from collections import defaultdict from collections.abc import Iterable from functools import reduce from sympy.core.parameters import global_parameters from sympy.core.basic import Atom from sympy.core.expr import Expr from sympy.core.compatibility import \ is_sequence, as_int from sympy.core.numbe...
ebbced9caa7ecdbdeef9f55bd99aad4061ae1d57eea3e223408000aea5849f02
from itertools import combinations from sympy.combinatorics.graycode import GrayCode from sympy.core import Basic class Subset(Basic): """ Represents a basic subset object. Explanation =========== We generate subsets using essentially two techniques, binary enumeration and lexicographic enu...
71743e287c2f0331b2f7fb055dd1aa68d75dad38eaf80ac6530c409e77bcf8e5
from sympy.combinatorics.permutations import Permutation, _af_rmul, \ _af_invert, _af_new from sympy.combinatorics.perm_groups import PermutationGroup, _orbit, \ _orbit_transversal from sympy.combinatorics.util import _distribute_gens_by_base, \ _orbits_transversals_from_bsgs """ References for tensor ...
bf205b360d705c971f9310693dd3d0e01ac34251c8cbd1d1ce52c53a3cf73a52
from sympy.combinatorics import Permutation as Perm from sympy.combinatorics.perm_groups import PermutationGroup from sympy.core import Basic, Tuple from sympy.core.compatibility import as_int from sympy.sets import FiniteSet from sympy.utilities.iterables import (minlex, unflatten, flatten, default_sort_key) rmul = P...
51d56c9c44aea26b222073bb875b8b63b4d922b50ccb69b553894e6bddb7eaeb
import itertools from sympy.combinatorics.fp_groups import FpGroup, FpSubgroup, simplify_presentation from sympy.combinatorics.free_groups import FreeGroup from sympy.combinatorics.perm_groups import PermutationGroup from sympy.core.numbers import igcd from sympy.ntheory.factor_ import totient from sympy import S clas...
0ae4d1af01592d647e88bc2d8a04bfe985cbaecfc8d7811bfad925e097d2f26d
from sympy.core import Basic, Dict, sympify from sympy.core.compatibility import as_int, default_sort_key from sympy.core.sympify import _sympify from sympy.functions.combinatorial.numbers import bell from sympy.matrices import zeros from sympy.sets.sets import FiniteSet, Union from sympy.utilities.iterables import fla...
1a89e810e6a5a530516a767db1cc79dd6094c0728ae2dfef90112512781cb0ce
"""Finitely Presented Groups and its algorithms. """ from sympy import S from sympy.combinatorics.free_groups import (FreeGroup, FreeGroupElement, free_group) from sympy.combinatorics.rewritingsystem import RewritingSystem from sympy.combinatorics.coset_table import (Cos...
5b8abe78c01aeb537f5bdb6ebd61a12c958878e8cf969da1eb6d74078fe5c7a5
from sympy.core.add import Add from sympy.core.compatibility import is_sequence from sympy.core.containers import Tuple from sympy.core.expr import Expr from sympy.core.mul import Mul from sympy.core.relational import Equality, Relational from sympy.core.singleton import S from sympy.core.symbol import Symbol, Dummy fr...
082291307ed02332a30257787858ec406e03817b61975592678979f7c79d51b2
from sympy.calculus.singularities import is_decreasing from sympy.calculus.util import AccumulationBounds from sympy.concrete.expr_with_limits import AddWithLimits from sympy.concrete.expr_with_intlimits import ExprWithIntLimits from sympy.concrete.gosper import gosper_sum from sympy.core.add import Add from sympy.core...
a8ae6081d6780702315ab2db45d1974e0ef2fd6230441d4f23501e2fe7d5feb8
"""Tools to assist importing optional external modules.""" import sys import re # Override these in the module to change the default warning behavior. # For example, you might set both to False before running the tests so that # warnings are not printed to the console, or set both to True for debugging. WARN_NOT_INS...
6052b33909834221f1c9d00d059b18983fc7b7977a48d34236e296b25f4c7a9f
""" This module implements the Residue function and related tools for working with residues. """ from sympy import sympify from sympy.utilities.timeutils import timethis @timethis('residue') def residue(expr, x, x0): """ Finds the residue of ``expr`` at the point x=x0. The residue is defined as the coef...
53483098a1f9c82b47ec3e2e86d7bd4c3d6aa081269889282730fbd0adcb6310
from sympy.core import S, sympify, Expr, Dummy from sympy.core import Add, Mul, expand_power_base, expand_log from sympy.core.cache import cacheit from sympy.core.compatibility import default_sort_key, is_sequence from sympy.core.containers import Tuple from sympy.sets.sets import Complement from sympy.utilities.iterab...
820822e4376be0970bd338e0c81d1c2333e62c72a7616e385a02bd767c99ce3a
from collections import defaultdict from sympy import SYMPY_DEBUG from sympy.core import expand_power_base, sympify, Add, S, Mul, Derivative, Pow, symbols, expand_mul from sympy.core.add import _unevaluated_Add from sympy.core.compatibility import iterable, ordered, default_sort_key from sympy.core.parameters import ...
4bb6c27bb69d22b53d0144593b5ce7f89cf9fcc368908957fea281efa1a85073
from itertools import combinations_with_replacement from sympy.core import symbols, Add, Dummy from sympy.core.numbers import Rational from sympy.polys import cancel, ComputationFailed, parallel_poly_from_expr, reduced, Poly from sympy.polys.monomials import Monomial, monomial_div from sympy.polys.polyerrors import Dom...
032a5198a23ce8977bb85d70dbe1a18c92569ed6b6a28bfccc67e2a07f1ea19b
r""" This module contains the functionality to arrange the nodes of a diagram on an abstract grid, and then to produce a graphical representation of the grid. The currently supported back-ends are Xy-pic [Xypic]. Layout Algorithm ================ This section provides an overview of the algorithms implemented in :cl...
d6d0c60004c02ff1fd79dc08ab8bf4def16b85da3eccadd3606fcf4063df7413
from sympy.core import S, Basic, Dict, Symbol, Tuple, sympify from sympy.core.compatibility import iterable from sympy.core.symbol import Str from sympy.sets import Set, FiniteSet, EmptySet class Class(Set): r""" The base class for any kind of class in the set-theoretic sense. Explanation ===========...
a9c320b44c3e58cd7b8fb2b4963764b03893a35821e20a6ba4b4d7f11f9695c9
# References : # http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/ # https://en.wikipedia.org/wiki/Quaternion from sympy import S, Rational from sympy import re, im, conjugate, sign from sympy import sqrt, sin, cos, acos, exp, ln from sympy import trigsimp from sympy import integrate from sympy...
4de0aaf2dff1894f3368d1b5751aa9a6e12386574dae309b16500e31abbaa3b0
""" This file contains some classical ciphers and routines implementing a linear-feedback shift register (LFSR) and the Diffie-Hellman key exchange. .. warning:: This module is intended for educational purposes only. Do not use the functions in this module for real cryptographic applications. If you wish to ...
876bcaf9f64db85d403d72f00b778785051c020595bfb9b90656df1c1fe75bdc
""" The classes used here are for the internal use of assumptions system only and should not be used anywhere else as these don't possess the signatures common to SymPy objects. For general use of logic constructs please refer to sympy.logic classes And, Or, Not, etc. """ from itertools import combinations, product fro...
154341463b68cfdc658b182284aaa440f8174f7ad8e0b60b07a26d7b312d5f71
""" This module contains functions to: - solve a single equation for a single variable, in any domain either real or complex. - solve a single transcendental equation for a single variable in any domain either real or complex. (currently supports solving in real domain only) - solve a system of lin...
4abc1642855abec94d2158f43b0aedfe0a87cf919dcad46008dc8786f22fd148
"""Solvers of systems of polynomial equations. """ from sympy.core import S from sympy.polys import Poly, groebner, roots from sympy.polys.polytools import parallel_poly_from_expr from sympy.polys.polyerrors import (ComputationFailed, PolificationFailed, CoercionFailed) from sympy.simplify import rcollect from sym...
576c36d6f44b8f72870748d6ba269711156b1a934be0d0e7a377a77eaf8af9f8
"""Tools for solving inequalities and systems of inequalities. """ from sympy.core import Symbol, Dummy, sympify from sympy.core.compatibility import iterable from sympy.core.exprtools import factor_terms from sympy.core.relational import Relational, Eq, Ge, Lt from sympy.sets import Interval from sympy.sets.sets impo...
9e99ea1c0835367203785e793c387f0a61dada210a85777d68aa44d5886cd42d
""" This module contain solvers for all kinds of equations: - algebraic or transcendental, use solve() - recurrence, use rsolve() - differential, use dsolve() - nonlinear (numerically), use nsolve() (you will need a good starting point) """ from sympy import divisors, binomial, expand_func f...
87d9abef62f7db4c2d6d15e403b0b6e905a643778dcfa682ebdee01da76d6c17
""" Singularities ============= This module implements algorithms for finding singularities for a function and identifying types of functions. The differential calculus methods in this module include methods to identify the following function types in the given ``Interval``: - Increasing - Strictly Increasing - Decre...
e160007c63cc7057361cf7286d5eed7c933c1c8c58ee1e41b8494279f778d5dc
from sympy import Order, S, log, limit, lcm_list, im, re, Dummy, Piecewise from sympy.core import Add, Mul, Pow from sympy.core.basic import Basic from sympy.core.compatibility import iterable from sympy.core.expr import AtomicExpr, Expr from sympy.core.function import expand_mul from sympy.core.numbers import _sympify...
7719df4c51dcc3ecef49e9bb357264cecd14aa7918ec2dc42ae06132281f615f
""" This module provides convenient functions to transform sympy expressions to lambda functions which can be used to calculate numerical values very fast. """ from typing import Any, Dict, Iterable import builtins import inspect import keyword import textwrap import linecache from sympy.utilities.exceptions import ...
c3a38c96c4b3e3f58a7b7852ad3c2489f82228807b3dde79465096559bba7506
from collections import defaultdict, OrderedDict from itertools import ( combinations, combinations_with_replacement, permutations, product ) from itertools import product as cartes # noqa: F401 import random from operator import gt from sympy.core import Basic # this is the logical location of these function...
5cd7f9760ea406254daeafb83e029f8f3f22692e3d0fcb8749f5cf58b60481a9
"""Miscellaneous stuff that doesn't really fit anywhere else.""" from typing import List import sys import os import re as _re import struct from textwrap import fill, dedent from sympy.core.compatibility import as_int from sympy.core.decorators import deprecated class Undecidable(ValueError): # an error to be ...
d7eb41aa6b65a2820cf29f007a506ca0ce974905969fce227d484f0c5c1558ff
"""A module providing information about the necessity of brackets""" from sympy.core.function import _coeff_isneg # Default precedence values for some basic types PRECEDENCE = { "Lambda": 1, "Xor": 10, "Or": 20, "And": 30, "Relational": 35, "Add": 40, "Mul": 50, "Pow": 60, "Func": ...
075bbac7b0491068b4a0caf6faad5caf951d247191558a91fe5ad3e0a98f0b67
from sympy.core import S from .pycode import PythonCodePrinter, _known_functions_math, _print_known_const, _print_known_func, _unpack_integral_limits from .codeprinter import CodePrinter _not_in_numpy = 'erf erfc factorial gamma loggamma'.split() _in_numpy = [(k, v) for k, v in _known_functions_math.items() if k not ...
87b3b55341cfe26d214daa7a86366f71678f754f8adb75efca8243e57904aa5e
""" Python code printers This module contains python code printers for plain python as well as NumPy & SciPy enabled code. """ from collections import defaultdict from itertools import chain from sympy.core import S from .precedence import precedence from .codeprinter import CodePrinter _kw_py2and3 = { 'and', 'as...
f65fc8a15054868f7c114f5190d4c7ac88cd47d1547ef984118e2de79f57feee
""" A Printer for generating readable representation of most sympy classes. """ from typing import Any, Dict from sympy.core import S, Rational, Pow, Basic, Mul, Number from sympy.core.mul import _keep_coeff from sympy.core.function import _coeff_isneg from sympy.sets.sets import FiniteSet from .printer import Printe...
41992b7b85a98538d70273009681424ad0c1c62c22c7bb4bcf5aaa5e17b59699
''' Use llvmlite to create executable functions from Sympy expressions This module requires llvmlite (https://github.com/numba/llvmlite). ''' import ctypes from sympy.external import import_module from sympy.printing.printer import Printer from sympy import S, IndexedBase from sympy.utilities.decorator import doctes...
5b2ec6c1d1e2bb6bb4dc6dbfc9df556b7a3326b6c5faa5cbbd3df8b7b11fe36c
""" A Printer which converts an expression into its LaTeX equivalent. """ from typing import Any, Dict import itertools from sympy.core import Add, Float, Mod, Mul, Number, S, Symbol from sympy.core.alphabets import greeks from sympy.core.containers import Tuple from sympy.core.function import _coeff_isneg, AppliedU...
0251d991cae4dc526d474dcc45bd81e1fa3c932c42c28fbc0b191dd51fcf8634
"""Printing subsystem driver SymPy's printing system works the following way: Any expression can be passed to a designated Printer who then is responsible to return an adequate representation of that expression. **The basic concept is the following:** 1. Let the object print itself if it knows how. 2. Take the bes...
65bb8970d8110a8603247ec53138755a847e6e172217517276f9ea6760e9afff
""" Octave (and Matlab) code printer The `OctaveCodePrinter` converts SymPy expressions into Octave expressions. It uses a subset of the Octave language for Matlab compatibility. A complete code generator, which uses `octave_code` extensively, can be found in `sympy.utilities.codegen`. The `codegen` module can be us...