hash
stringlengths
64
64
content
stringlengths
0
1.51M
ffc3c602158c43f0347f60d02dd0de32ba71635f7cf3d3f9221f47e354599fcb
from sympy.printing.tree import tree from sympy.testing.pytest import XFAIL # Remove this flag after making _assumptions cache deterministic. @XFAIL def test_print_tree_MatAdd(): from sympy.matrices.expressions import MatrixSymbol A = MatrixSymbol('A', 3, 3) B = MatrixSymbol('B', 3, 3) test_str = [ ...
b8ab7e289b6b4e93b4d9453a830d257f6e52d5b9b85645dd8749cabe4ac0df35
from sympy import diff, Integral, Limit, sin, Symbol, Integer, Rational, cos, \ tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, E, I, oo, \ pi, GoldenRatio, EulerGamma, Sum, Eq, Ne, Ge, Lt, Float, Matrix, Basic, \ S, MatrixSymbol, Function, Derivative, log, true, false, Range, Min, Max, \ ...
3f2e9916df6ff8786fac12f45de3bafcc6a100da78f64ff060c24ffca884e2fe
from sympy.printing.dot import (purestr, styleof, attrprint, dotnode, dotedges, dotprint) from sympy import Symbol, Integer, Basic, Expr, srepr, Float, symbols from sympy.abc import x def test_purestr(): assert purestr(Symbol('x')) == "Symbol('x')" assert purestr(Basic(1, 2)) == "Basic(1, 2)" asse...
fc164c355f1248a5270e6d7edc9ba3667ffb7c7ebb985ab74df427f14e806261
# -*- 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, ...
04cc556457d07d08cfca2d78ac39effa974ad4b050c1c277bdd29f70042e6a73
from sympy import sqrt, Abs from sympy.core import S, Rational from sympy.integrals.intpoly import (decompose, best_origin, distance_to_side, polytope_integrate, point_sort, hyperplane_parameters, main_integrate3d, ...
20f9cf6533908f6fd981a5410d7fc5406d4b065a47927665f34c85faca4159ba
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...
f68104ed629c936fe161d1666ad44a2ba39704710685d5c59ee7fbbac8be7eb3
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...
048562cf0a901305e49e9d0f3afffbfde37d4a627df121b410ef22536475f80e
"""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,...
c3186071c0c115ecea2178749c843f021daa2c7711ff55da8617be4f30229df2
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, Pow, Tuple, latex, Gt, Lt, Ge, Le, ...
f3c659be4317a22204e9ed72b7676274b96a5cad6271605326150a9dccc62445
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...
a55dd24e97975e8673fbc863b6085a0243d7bd48ca3a2e91affaa272e16b99a0
from sympy import Integer, S, Symbol, symbols, Expr 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, add from sympy.core.mul import Mul, mul # create the simplest possible Lattice class class join(...
83d7465bea93eb8ef22f8ba4d43fefdccd92f2b815d568b8241505c934b052de
from sympy.core.decorators import call_highest_priority from sympy.core.expr import Expr from sympy.core.mod import Mod from sympy.core.numbers import Integer from sympy.core.symbol import Symbol from sympy.functions.elementary.integers import floor class Higher(Integer): ''' Integer of value 1 and _op_priori...
17f56223e306a70c9df740eaf3acebe64dfc3a0784d4b3739402f3412c67c532
from sympy.core import ( Basic, Rational, Symbol, S, Float, Integer, Mul, Number, Pow, Expr, 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.element...
f24aa9527bbcaf567ee0b74205fc3f5c07394e2630523f1b36532bca4e8f521e
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...
b3c400446f967ea05c49110b2b10cf3f915ac6556ce999e000fd5fbd430270ce
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...
8f75141d9eb66b3a253b9fd7a6a5763d2add7b07fec95bacbb6ec3739faed070
"""Implementation of :class:`Ring` class. """ from __future__ import print_function, division from sympy.polys.domains.domain import Domain from sympy.polys.polyerrors import ExactQuotientFailed, NotInvertible, NotReversible from sympy.utilities import public @public class Ring(Domain): """Represents a ring dom...
5e03ddc3efca5035a7e7ad880becfed9a40785268cf071e0c943051167e78f3f
"""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...
46191f37eb12fca79def72cce827b8a8f30609a7befcb9ad3d33c44649914c9b
"""Implementation of :class:`GMPYRationalField` class. """ from __future__ import print_function, division from sympy.polys.domains.groundtypes import ( GMPYRational, SymPyRational, gmpy_numer, gmpy_denom, gmpy_factorial, ) from sympy.polys.domains.rationalfield import RationalField from sympy.polys.polyerror...
547eaae229ae2a9cf2131432e691b9386d7c9c3924a8b0f8aa36cf749dd0b00d
"""Implementation of :class:`QuotientRing` class.""" from __future__ import print_function, division 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 # - suc...
62441ae068d8580e5ef6c991aa73a1568cf7272e5ac4d53a097efe08c0cb49b6
"""Implementation of :class:`Field` class. """ from __future__ import print_function, division from sympy.polys.domains.ring import Ring from sympy.polys.polyerrors import NotReversible, DomainError from sympy.utilities import public @public class Field(Ring): """Represents a field domain. """ is_Field = Tr...
844adb1845d651f619e56d2e6b814392f2d0b032345f84f7e9f1a08e18ccf113
"""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...
0c808b87a171a5a2021eb80b59bccacba020d7d53585f767d9e20e5d6a35944f
"""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 Dom...
36cdf3439ade7c6c1592cfe904bfb298faedc1f807ea2d43dd88cd4a091d727e
"""Implementation of :class:`Domain` class. """ from __future__ import print_function, division from typing import Any, Optional 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 import ...
f61a8768268eb11f5720ab910b22bf7f75796a1def89e3fa5b105cba047279d9
"""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...
ee4d62828f717cdf5ba46b719ce778b99dd28e4360df3334ee0a958fb77d12ca
"""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...
e2931bca5b708a7c1176cfc4ee111001069c240d18feb6ba83a478a7e9152832
"""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...
6ce434dce228f9622855378e9b1b072487d438da52cee73a8010b36c045fe623
""" 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...
10a7f344b23f4c99dc2b996c0d32375357b05c2b66cbd9b1e317c6ca6bb0cf93
""" 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...
bedd847fc6ea993e4290e374592f56c19e0f0ed57f0a4ffaaa06487635e7620c
from sympy import Add, Basic, symbols, Symbol, And from sympy.core.symbol import Str from sympy.unify.core import Compound, Variable from sympy.unify.usympy import (deconstruct, construct, unify, is_associative, is_commutative) from sympy.abc import x, y, z, n def test_deconstruct(): expr = Basic(1, 2,...
88c948be4d41132100ce55db291728d3f71eaafae5cd7fb8cb1411909b56160f
from sympy import sin, cos, pi, S, sqrt from sympy.testing.pytest import raises from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.integrals import ParametricIntegral, vector_integrate from sympy.vector.parametricregion import ParametricRegion from sympy.vector.implicitregion import ImplicitRegion from ...
36a3f17a0b1b663a77d4799a16f5628e2f1311b43805c7e896e76964facbea14
from sympy import Eq, S, sqrt from sympy.abc import x, y, z, s, t from sympy.sets import FiniteSet, EmptySet from sympy.geometry import Point from sympy.vector import ImplicitRegion from sympy.testing.pytest import raises def test_ImplicitRegion(): ellipse = ImplicitRegion((x, y), (x**2/4 + y**2/16 - 1)) asse...
0a33f63ec0ddeed5b02f4c2573d56ba708f02732315d819e08aeb38f3b043720
# -*- coding: utf-8 -*- from sympy import Integral, latex, Function from sympy import pretty as xpretty from sympy.vector import CoordSys3D, Vector, express from sympy.abc import a, b, c from sympy.testing.pytest import XFAIL def pretty(expr): """ASCII pretty-printing""" return xpretty(expr, use_unicode=False...
be3ff5d302a3d602ede21f672a8acf94cb7f2b314ac9bfd748a46703837ba0a6
from sympy import Eq, Rational, S, Symbol, symbols, pi, sqrt, oo, Point2D, Segment2D, Abs, sec from sympy.geometry import (Circle, Ellipse, GeometryError, Line, Point, Polygon, Ray, RegularPolygon, Segment, Triangle, intersection) from sympy.testing.pytest import ...
a2d1a2040993f4bc613b8732cbb4c23101d9eeefc8f89125718a8679deb37503
# -*- coding: utf-8 -*- import sys from sympy.core import Symbol, Function, Float, Rational, Integer, I, Mul, Pow, Eq from sympy.functions import exp, factorial, factorial2, sin from sympy.logic import And from sympy.series import Limit from sympy.testing.pytest import raises, skip from sympy.parsing.sympy_parser ...
3adb16bf25f7dee323a2cfde3f4123f6dc494c579fcc0160dd9842adf6bbc576
from sympy.testing.pytest import raises, XFAIL from sympy.external import import_module from sympy import ( Symbol, Mul, Add, Eq, Abs, sin, asin, cos, Pow, csc, sec, Limit, oo, Derivative, Integral, factorial, sqrt, root, StrictLessThan, LessThan, StrictGreaterThan, GreaterThan, Sum, Product, E, log, t...
919ba77b1ca2a879cec408d847da535a7e9051e60e67373f056633922531d057
# 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 .errors import LaTeXParsingError LaTeXParser = LaTeXLexer = MathErrorListener = None try: LaTeXP...
5ebfd3e5cd90cc43d665e60e27014e50185cbbe79892169712ab7c783f1a554e
# encoding: utf-8 # *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND *** # # Generated from ../LaTeX.g4, derived from latex2sympy # latex2sympy is licensed under the MIT license # https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt # # Generated with antlr4 # antlr4 is licensed under th...
be7173262c40e13cd48299fe0f760ea416fe95ff7a44a8a3cad1499ecd785ef3
# encoding: utf-8 # *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND *** # # Generated from ../LaTeX.g4, derived from latex2sympy # latex2sympy is licensed under the MIT license # https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt # # Generated with antlr4 # antlr4 is licensed under th...
3c323fbff1fbbd7a87ad64d148b5814fb5954dd7fef1b7292cc5062e7ad20fe2
from sympy import Basic, Mul, Pow, degree, Symbol, expand, cancel, Expr, exp, roots from sympy.core.evalf import EvalfMixin from sympy.core.logic import fuzzy_and from sympy.core.numbers import Integer from sympy.core.sympify import sympify, _sympify from sympy.polys import Poly, rootof from sympy.series import limit ...
29e1339bc0f5308b5f9af37ce72d7c7dd5708db1893b861ef9d2e78763df26e4
"""An implementation of qubits and gates acting on them. Todo: * Update docstrings. * Update tests. * Implement apply using decompose. * Implement represent using decompose or something smarter. For this to work we first have to implement represent for SWAP. * Decide if we want upper index to be inclusive in the co...
6094ce714b0d0ef42f2a717d11c1a2ee680171afff9614fd04be2fe5777039f6
"""Abstract tensor product.""" from __future__ import print_function, division from sympy import Expr, Add, Mul, Matrix, Pow, sympify from sympy.core.trace import Tr from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.qexpr import QuantumError from sympy.physics.quantum.dagger import D...
1c87c51a64a7dc3210fc05e215e9ad1b2df3e3d260605a9c5fbff1ee723cc2da
"""The anti-commutator: ``{A,B} = A*B + B*A``.""" from __future__ import print_function, division 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__ = [ 'AntiC...
82e2c3e12c0c0ea4d79c45a2e92c21ad1c10e8476435b7add5ac7297f29811bc
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr import QExpr, dispatch_method __all__ = [ ...
228e57c0fe3d511b2bf6705215df50664f40cf87f6b2a17760d338ad65785323
"""Operators and states for 1D cartesian position and momentum. TODO: * Add 3D classes to mappings in operatorset.py """ from __future__ import print_function, division from sympy import DiracDelta, exp, I, Interval, pi, S, sqrt from sympy.physics.quantum.constants import hbar from sympy.physics.quantum.hilbert i...
4fff05179b70435ad0c2aa7f8f9fb953cacc246422640fb3d6c0d1d31bcd4bc7
"""An implementation of gates that act on qubits. Gates are unitary operators that act on the space of qubits. Medium Term Todo: * Optimize Gate._apply_operators_Qubit to remove the creation of many intermediate Qubit objects. * Add commutation relationships to all operators and use this in gate_sort. * Fix gate_s...
612c3dfab6dd1a4445e56f3fa14fcf4229d0a93e557a7f2a30cec15b135d1a82
"""Logic for representing operators in state in various bases. TODO: * Get represent working with continuous hilbert spaces. * Document default basis functionality. """ from __future__ import print_function, division from sympy import Add, Expr, I, integrate, Mul, Pow from sympy.physics.quantum.dagger import Dagger...
f831d166c6a3df841cdc4c602e7f5fa4d87a48a230e8b1a506539b58bb0211e8
from __future__ import print_function, division from sympy import Expr, sympify, Symbol, Matrix from sympy.printing.pretty.stringpict import prettyForm from sympy.core.containers import Tuple from sympy.core.compatibility import is_sequence from sympy.physics.quantum.dagger import Dagger from sympy.physics.quantum.ma...
4061c526078967aee5682b35dd584a80ec57bde82c59a7603a9a39a4176a2d92
"""Grover's algorithm and helper functions. Todo: * W gate construction (or perhaps -W gate based on Mermin's book) * Generalize the algorithm for an unknown function that returns 1 on multiple qubit states, not just one. * Implement _represent_ZGate in OracleGate """ from __future__ import print_function, divisio...
01cca235073eccdad8080d60bb4d7f0ab76e9252f0ee21ce2b9ac164061bf28b
"""The commutator: [A,B] = A*B - B*A.""" from __future__ import print_function, division 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' ...
c47bfbb0c6eccb654550121c3bba57f5a8520a19a64ad18a7754fcbd25a3e980
"""Quantum mechanical angular momemtum.""" from __future__ import print_function, division from sympy import (Add, binomial, cos, exp, Expr, factorial, I, Integer, Mul, pi, Rational, S, sin, simplify, sqrt, Sum, symbols, sympify, Tuple, Dummy) from sympy.matrices import zeros fro...
f018afd5ce46e69d51b8374038d136ad0a26d2c542cf293cd9afc2e6e61b6c8e
"""Constants (like hbar) related to quantum mechanics.""" from __future__ import print_function, division from sympy.core.numbers import NumberSymbol from sympy.core.singleton import Singleton from sympy.printing.pretty.stringpict import prettyForm import mpmath.libmp as mlib #---------------------------------------...
7f4a94e855b421a9177609b0b0c5d93a056eb14f5b194a2539ad303bf8871ae0
"""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...
16d0a63078425351d9428d816f3a56648d35051d4685f5f40d2fcd48dd511be3
"""Fermionic quantum operators.""" from sympy import Integer from sympy.physics.quantum import Operator from sympy.physics.quantum import HilbertSpace, Ket, Bra from sympy.functions.special.tensor_functions import KroneckerDelta __all__ = [ 'FermionOp', 'FermionFockKet', 'FermionFockBra' ] class Fermio...
f11cd9945236d14fe62d2ff90bfd06545e3ca60b7e34bf6ce147e13796265438
"""Hilbert spaces for quantum mechanics. Authors: * Brian Granger * Matt Curry """ from __future__ import print_function, division from sympy import Basic, Interval, oo, sympify from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.qexpr import QuantumError from sympy.core.compatibilit...
9b9b50aa5ff0dc4ae66ea2b15ed3b6f9e61a5414143bd348eb436eb934ef5520
"""Bosonic quantum operators.""" from sympy import Mul, Integer, exp, sqrt, conjugate from sympy.physics.quantum import Operator from sympy.physics.quantum import HilbertSpace, FockSpace, Ket, Bra, IdentityOperator from sympy.functions.special.tensor_functions import KroneckerDelta __all__ = [ 'BosonOp', 'Bo...
eb8bacf861b4db2089ad79eb3b7c2dffc17544d4bed43a401c03504d71aeb740
"""Simple Harmonic Oscillator 1-Dimension""" from __future__ import print_function, division from sympy import sqrt, I, Symbol, Integer, S from sympy.physics.quantum.constants import hbar from sympy.physics.quantum.operator import Operator from sympy.physics.quantum.state import Bra, Ket, State from sympy.physics.qua...
2758df06011f839c4ccf56b17bbf7e60f0893eded6c964493e942a57c179c4a2
from __future__ import print_function, division 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....
a5294c6ec7f028bc1234caf1a27203ea5ca0530061658e76a8bd074b0ff3f391
from __future__ import print_function, division from sympy.utilities import dict_merge from sympy.utilities.iterables import iterable from sympy.physics.vector import (Dyadic, Vector, ReferenceFrame, Point, dynamicsymbols) from sympy.physics.vector.printing import (vprint, vsprint, vp...
7040b98ab8b847670addafadf980e8e594904ccbeaf6e9ec1869eb6b8cf8d5cb
""" 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...
53502efd21e983963f1dd0220eafd5eac7f68179c4bbdae36c4a01f85c0e2cc4
""" Module defining unit prefixe class and some constants. Constant dict for SI and binary prefixes are defined as PREFIXES and BIN_PREFIXES. """ from sympy import Expr, sympify class Prefix(Expr): """ This class represent prefixes, with their name, symbol and factor. Prefixes are used to create derived...
1b4eaa58761584ee3e763baa65473e2ef8fc8baf219965bf1e5490cc59da1c63
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...
16983bc82bfe9d2d6d86341a4dc9dc2b2f03923ad94e382074336413705ff875
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 __all__ = ['Vector'] class Vector(Printable): """The class used to define vectors. It alon...
f2c947f7d5fe598d19961f7ab146bcc59a75f8b13697c5ae49d93961361f3537
from __future__ import print_function, division from .vector import Vector, _check_vector from .frame import _check_frame __all__ = ['Point'] class Point(object): """This object represents a point in a dynamic system. It stores the: position, velocity, and acceleration of a point. The position is a vect...
1e062a43ee29cd287e74515db4fd0a613793eaeaea9b6bab134f5031de335c0f
from sympy.core.backend import (diff, expand, sin, cos, sympify, eye, symbols, ImmutableMatrix as Matrix, MatrixBase) from sympy import (trigsimp, solve, Symbol, Dummy) from sympy.physics.vector.vector import Vector, _check_vector from sympy.utilities.misc import translate __all__ = ['CoordinateSym'...
96b99cafcb5512dc51dd7b67136bf56d7ab4ce580dd945cfc3a6a13f8f441645
from sympy.core.backend import sympify, Add, ImmutableMatrix as Matrix from sympy.printing.defaults import Printable __all__ = ['Dyadic'] class Dyadic(Printable): """A Dyadic object. See: https://en.wikipedia.org/wiki/Dyadic_tensor Kane, T., Levinson, D. Dynamics Theory and Applications. 1985 McGraw...
9d9124545e8f7489eb7271091c44b013b0548ea1fb9606aa8dfebe1c4d007252
#!/usr/bin/env python # -*- coding: utf-8 -*- u""" 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...
db6ab755fbc3f4c0a019527e9514607198e517b6e515619eb310d0fbbe053002
from sympy import symbols, Matrix, factor, Function, simplify, exp, pi, oo, I, \ Rational, sqrt, CRootOf from sympy.physics.control.lti import TransferFunction, Series, Parallel, Feedback from sympy.testing.pytest import raises a, x, b, s, g, d, p, k, a0, a1, a2, b0, b1, b2 = symbols('a, x, b, s, g, d, p, k, a0:3,...
a69ba9ee065672f16fda2425a232f529e9b0eff37b242fb2fb466b1348858372
# -*- 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...
e7468bf18c9c3fbaa6345fd76250fab76947ce9538a517b85aca0b0bb2b68543
from sympy.physics.vector import dynamicsymbols, Point, ReferenceFrame from sympy.testing.pytest import raises def test_point_v1pt_theorys(): q, q2 = dynamicsymbols('q q2') qd, q2d = dynamicsymbols('q q2', 1) qdd, q2dd = dynamicsymbols('q q2', 2) N = ReferenceFrame('N') B = ReferenceFrame('B') ...
0786f15e2cd481148668c388c2dfbf98abb66a141c17afae0b6890e26b47cb20
# -*- coding: utf-8 -*- from sympy import symbols, sin, asin, cos, sqrt, Function from sympy.physics.vector import ReferenceFrame, dynamicsymbols, Dyadic from sympy.physics.vector.printing import (VectorLatexPrinter, vpprint, vsprint, vsstrrepr, vlatex) a, b, c = symbols('a...
af26d18110e6ec6c6188e2b87ddd3909831e32129cbdc0c48fac99b20979c0b0
from sympy import Derivative, Integer, Expr from sympy.matrices.common import MatrixCommon from .ndim_array import NDimArray from .arrayop import derive_by_array from sympy import MatrixExpr from sympy import ZeroMatrix from sympy.matrices.expressions.matexpr import _matrix_derivative class ArrayDerivative(Derivative...
96de920d389b95d1ea833d5c37c95d6ce66d4ed50e1c3c09b14f94e1768f8457
import itertools from sympy import S, Tuple, diff, Basic from sympy.core.compatibility import Iterable from sympy.tensor.array.ndim_array import NDimArray from sympy.tensor.array.dense_ndim_array import DenseNDimArray, ImmutableDenseNDimArray from sympy.tensor.array.sparse_ndim_array import SparseNDimArray def _arr...
efe70eac2445b07a26fb5c4548cc748ddea4923b00c9fbee99a7b6814e241353
from __future__ import print_function, division 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.compatibility import SYMPY_INTS, Iterable from sympy.printing.defaults import Printable import iter...
d2b2f58252232ac5eadd666103ee95d5ad7606ad7993f57c74df36504e09676d
from functools import wraps from sympy import Matrix, eye, Integer, expand, Indexed, Sum from sympy.combinatorics import Permutation from sympy.core import S, Rational, Symbol, Basic, Add from sympy.core.containers import Tuple from sympy.core.symbol import symbols from sympy.functions.elementary.miscellaneous import ...
a61537673aeecc050218848af85bd982d57e942c82ddc9480c293ea269314edd
from sympy import Matrix, symbols, MatrixSymbol, NDimArray from sympy.matrices.common import MatrixCommon from sympy.tensor.array.array_derivatives import ArrayDerivative x, y, z, t = symbols("x y z t") m = Matrix([[x, y], [z, t]]) M = MatrixSymbol("M", 3, 2) N = MatrixSymbol("N", 4, 3) def test_array_derivative_c...
81d722ee5ef7503f127544b850a8432e34a52fcbb4faa6f4e38ada6341da32af
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...
9806364bcd70884898fd26e24c8b7bedf49dadc5fe6212796322444542a4af56
from copy import copy from sympy.tensor.array.dense_ndim_array import MutableDenseNDimArray from sympy import Symbol, Rational, SparseMatrix, diff, sympify, S from sympy.matrices import Matrix from sympy.tensor.array.sparse_ndim_array import MutableSparseNDimArray from sympy.testing.pytest import raises def test_ndi...
1b2239c09db3500dcd61c454b540c9131f48ff067041f81541ecb107f63262ed
from typing import Dict, Any from sympy.multipledispatch import dispatch from sympy.multipledispatch.conflict import AmbiguityWarning from sympy.testing.pytest import raises, warns from functools import partial test_namespace = dict() # type: Dict[str, Any] orig_dispatch = dispatch dispatch = partial(dispatch, name...
ac8ec57a56d2503099064d19f4f93886d6a6897c88d6c47621b52b3bd3afd711
from sympy.multipledispatch.dispatcher import (Dispatcher, MDNotImplementedError, MethodDispatcher, halt_ordering, restart_ordering, ambiguity_register_error_ignore_dup) from sympy.testing.pytest i...
8845fe40a1d2bb2a895823639105db41a465b7342d0638335911e74eec01c577
from sympy import ( I, Rational, S, Symbol, simplify, symbols, sympify, expand_mul) from sympy.matrices.matrices import (ShapeError, NonSquareMatrixError) from sympy.matrices import ( ImmutableMatrix, Matrix, eye, ones, ImmutableDenseMatrix, dotprodsimp) from sympy.testing.pytest import raises from sympy.matric...
2a157c28352c5a779d7aec742922433f11b26f60373f6560aecf20f6a7ff77a0
from sympy.assumptions import Q from sympy.core.expr import Expr from sympy.core.add import Add from sympy.core.function import Function from sympy.core.numbers import I, Integer, oo, pi, Rational from sympy.core.singleton import S from sympy.core.symbol import Symbol, symbols from sympy.functions.elementary.complexes ...
7d8dc6cc8113f2bc652f48ed3c19d41b2f29a881479f268d6d53d4000be745de
import random import concurrent.futures from sympy import ( Abs, Add, E, Float, I, Integer, Max, Min, Poly, Pow, PurePoly, Rational, S, Symbol, cos, exp, log, oo, pi, signsimp, simplify, sin, sqrt, symbols, sympify, trigsimp, tan, sstr, diff, Function, expand) from sympy.matrices.matrices import (ShapeErro...
d70e6222385a7eacd8f488a3c271a18a480777d5e87e7352d31f8a61ee19d1d1
from sympy import Number from sympy.core import Mul, Basic, sympify, S from sympy.core.mul import mul from sympy.functions import adjoint from sympy.strategies import (rm_id, unpack, typed, flatten, exhaust, do_one, new) from sympy.matrices.common import ShapeError, NonInvertibleMatrixError from sympy.matrices....
62353cd3a515eb8938368b0ef5fa9f8cb275edfc50d93ff3ffa9cde2e8e2af2b
from sympy.core.logic import FuzzyBool from functools import wraps, reduce import collections from sympy.core import S, Symbol, Integer, Basic, Expr, Mul, Add from sympy.core.decorators import call_highest_priority from sympy.core.compatibility import SYMPY_INTS, default_sort_key from sympy.core.symbol import Str fro...
07552cfac20502e023d9df6b75fc10e5aab14d35af5584a54f7ac5ce1c3a1d4f
"""Implementation of the Kronecker product""" from sympy.core import Mul, prod, sympify from sympy.functions import adjoint from sympy.matrices.common import ShapeError from sympy.matrices.expressions.matexpr import MatrixExpr from sympy.matrices.expressions.transpose import transpose from sympy.matrices.expressions....
11a386e94b15a2b85fa6eef8696c1035828044b3acd080b02cb961a99481eff8
from sympy.core import Mul, sympify from sympy.matrices.common import ShapeError from sympy.matrices.expressions.matexpr import MatrixExpr from sympy.matrices.expressions.special import ZeroMatrix, OneMatrix from sympy.strategies import ( unpack, flatten, condition, exhaust, rm_id, sort ) def hadamard_product(*ma...
371d82a07cc04241bc67fb7b49e790714fed74d962c32018c7aa5089ea8f8ebb
from sympy.core.compatibility import reduce import operator from sympy.core import Add, Basic, sympify from sympy.core.add import add from sympy.functions import adjoint from sympy.matrices.common import ShapeError from sympy.matrices.matrices import MatrixBase from sympy.matrices.expressions.transpose import transpos...
95f139a31470c0b780b9d57ade53179b6b8cbe20e73e9aaab56233c9020592bb
from sympy.matrices.expressions import MatrixSymbol, MatAdd, MatPow, MatMul from sympy.matrices.expressions.special import GenericZeroMatrix, ZeroMatrix from sympy.matrices import eye, ImmutableMatrix from sympy.core import Add, Basic, S from sympy.core.add import add from sympy.testing.pytest import XFAIL, raises X =...
2490411d90be8121955583c0b8c04a46419840b6c8ff673292d2c6c46bdf43e1
from sympy.core import I, symbols, Basic, Mul, S from sympy.core.mul import mul from sympy.functions import adjoint, transpose from sympy.matrices import (Identity, Inverse, Matrix, MatrixSymbol, ZeroMatrix, eye, ImmutableMatrix) from sympy.matrices.expressions import Adjoint, Transpose, det, MatPow from sympy....
d72a00e4a4fc717374de7bdf3a70b33a2a02fa28e2815ee1e6140257c75e8bb2
""" Some examples have been taken from: http://www.math.uwaterloo.ca/~hwolkowi//matrixcookbook.pdf """ from sympy import (MatrixSymbol, Inverse, symbols, Determinant, Trace, sin, exp, cos, tan, log, S, sqrt, hadamard_product, DiagMatrix, OneMatrix, HadamardProdu...
d85a9e44a53fd8dac329c3c2a0d9f863c701b885788431c66a61083f452d753f
from sympy import (plot_implicit, cos, Symbol, symbols, Eq, sin, re, And, Or, exp, I, tan, pi) from sympy.plotting.plot import unset_show from tempfile import NamedTemporaryFile, mkdtemp from sympy.testing.pytest import skip, warns from sympy.external import import_module from sympy.testing.tmpfiles ...
e170df905800b9241b5fc35226851d12fc93cc0bf394b9e2895b483b40c1e096
from __future__ import print_function, division from threading import RLock # it is sufficient to import "pyglet" here once try: import pyglet.gl as pgl except ImportError: raise ImportError("pyglet is required for plotting.\n " "visit http://www.pyglet.org/") from sympy.core.compatibil...
e8bae3ed8e06010beeed5d12bfe3b19c99c9f9fd26e56718a2eb0bcb316b788a
from __future__ import print_function, division import pyglet.gl as pgl from sympy.core import S from sympy.core.compatibility import is_sequence from sympy.plotting.pygletplot.color_scheme import ColorScheme from sympy.plotting.pygletplot.plot_mode import PlotMode from time import sleep from threading import Thread, ...
26b6a884865e42aa43d84f60acb2e26b17e8208846ab6253abaa62687d2c9aa3
from __future__ import print_function, division from pyglet.window import key from pyglet.window.mouse import LEFT, RIGHT, MIDDLE from sympy.plotting.pygletplot.util import get_direction_vectors, get_basis_vectors class PlotController(object): normal_mouse_sensitivity = 4.0 modified_mouse_sensitivity = 1.0 ...
d974cccf37bb0bc76fa37a64bb43f8b4733e8599de3d8d7d75a7f2941a7b5cda
from __future__ import print_function, division import pyglet.gl as pgl from pyglet import font from sympy.core import S from sympy.core.compatibility import is_sequence from sympy.plotting.pygletplot.plot_object import PlotObject from sympy.plotting.pygletplot.util import billboard_matrix, dot_product, \ get...
7d39f3038a5a1219bf9dd31b00111ca6591ea88cea2b48d0fae9b729b663e521
""" Interval Arithmetic for plotting. This module does not implement interval arithmetic accurately and hence cannot be used for purposes other than plotting. If you want to use interval arithmetic, use mpmath's interval arithmetic. The module implements interval arithmetic using numpy and python floating points. The ...
10a8488c24740825db9c62ac1bd41be08cfa8da02984005d16b0e4f84669216e
#!/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...
9d4976addd946d8859745f17c3d6dbfb6bda959601b0cb32cb1ca671511263db
#!/usr/bin/env python # # Tests that a useful message is give in the ImportError when trying to import # sympy from Python 2. This is tested on Travis to ensure that we don't get a # Py2 SyntaxError from sympy/__init__.py import sys assert sys.version_info[:2] == (2, 7), "This test is for Python 2.7 only" import os t...
d16ec3ad49da027d768881bc7f305d671e7644af9a55f6d4c839045b5ec83f00
#!/usr/bin/env python3 from subprocess import check_output import sys import os.path def main(tarname, gitroot): """Run this as ./compare_tar_against_git.py TARFILE GITROOT Args ==== TARFILE: Path to the built sdist (sympy-xx.tar.gz) GITROOT: Path ro root of git (dir containing .git) """ ...
b42663da36b5d23aa0d5742e59116ae24286c665cabdb7a8d5ba19e4e27f34af
""" 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...