hash
stringlengths
64
64
content
stringlengths
0
1.51M
1c863160bc5e9331e2f5dc62e35637404954dc8c8cf7f64d9a612f8129f0f318
""" A Printer for generating readable representation of most sympy classes. """ from __future__ import print_function, division from typing import Any, Dict from sympy.core import S, Rational, Pow, Basic, Mul from sympy.core.mul import _keep_coeff from .printer import Printer from sympy.printing.precedence import pr...
9a233c06a460c0076236ecfedda5a4799d9c967a940bebe955267cf09cea8add
""" A Printer which converts an expression into its LaTeX equivalent. """ from __future__ import print_function, division from typing import Any, Dict import itertools from sympy.core import S, Add, Symbol, Mod from sympy.core.alphabets import greeks from sympy.core.containers import Tuple from sympy.core.function ...
7ac43117d6ce1b71f85e1a04c808052aed096f35a51cc4c3d9818ccc21d426ec
from __future__ import print_function, division from sympy.core.containers import Tuple from types import FunctionType class TableForm(object): r""" Create a nice table representation of data. Examples ======== >>> from sympy import TableForm >>> t = TableForm([[5, 7], [4, 2], [10, 3]]) ...
4d1585bbe69ff76e7f52f6ce488ed18ae95d9dad13488cbc031db0db9b777e36
""" A Printer for generating executable code. The most important function here is srepr that returns a string so that the relation eval(srepr(expr))=expr holds in an appropriate environment. """ from __future__ import print_function, division from typing import Any, Dict from sympy.core.function import AppliedUndef...
a9b346257945e0f6ee10eb9d5a46982926df185dc1356d418a1a2ca2d0bce5f0
"""Integration method that emulates by-hand techniques. This module also provides functionality to get the steps used to evaluate a particular integral, in the ``integral_steps`` function. This will return nested namedtuples representing the integration rules used. The ``manualintegrate`` function computes the integra...
79918e4f053ca2ad7c9d484f2c4e01955bf19c94fd64a70a84f992e7c7978014
from sympy.functions import SingularityFunction, DiracDelta from sympy.core import sympify from sympy.integrals import integrate def singularityintegrate(f, x): """ This function handles the indefinite integrations of Singularity functions. The ``integrate`` function calls this function internally wheneve...
05c88d954b8dc8dfec82878f08abd124b68d7a61c48d727485d288ef66e004ec
""" Integral Transforms """ from sympy.core import S from sympy.core.compatibility import reduce, iterable from sympy.core.function import Function from sympy.core.relational import _canonical, Ge, Gt from sympy.core.numbers import oo from sympy.core.symbol import Dummy from sympy.integrals import integrate, Integral ...
c69040251cb4abc04e5c33d97d4bbba5bbd5f8a811a12ffaf577c23f1b0ade14
from sympy.core import S, Dummy, pi from sympy.functions.combinatorial.factorials import factorial from sympy.functions.elementary.trigonometric import sin, cos from sympy.functions.elementary.miscellaneous import sqrt from sympy.functions.special.gamma_functions import gamma from sympy.polys.orthopolys import (legendr...
de3f89fd77bda8ecde86e01d6a77b3f67e0972aeed5b984a96777309933ba34f
""" Module to implement integration of uni/bivariate polynomials over 2D Polytopes and uni/bi/trivariate polynomials over 3D Polytopes. Uses evaluation techniques as described in Chin et al. (2015) [1]. References =========== [1] : Chin, Eric B., Jean B. Lasserre, and N. Sukumar. "Numerical integration of homogeneou...
2ba402e75ff5005ee1a694e5245a38e4d90f4964f790828fdd36017b0074c04b
from sympy.concrete.expr_with_limits import AddWithLimits from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.compatibility import is_sequence from sympy.core.containers import Tuple from sympy.core.expr import Expr from sympy.core.function import diff from sympy.core.logic import fuzzy_bo...
f0225bced8bcc8648ba8fb082f2c30580a94e610b6b13a2303704157ec342ba8
from typing import Dict, List from itertools import permutations from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.mul import Mul from sympy.core.symbol import Wild, Dummy from sympy.core.basic import sympify from sympy.core.numbers import Rational, pi, I from sympy.core.relational imp...
507e17d51c1916264f3e6032b425428e15fc8cca10645b3b4530adf7e1f6d9ea
""" Algorithms for solving the Risch differential equation. Given a differential field K of characteristic 0 that is a simple monomial extension of a base field k and f, g in K, the Risch Differential Equation problem is to decide if there exist y in K such that Dy + f*y == g and to find one if there are some. If t i...
339f306dbd59fc17300b54c96f349ae78e384de6e7d3ce268e3133c603434022
""" This module cooks up a docstring when imported. Its only purpose is to be displayed in the sphinx documentation. """ from typing import Any, Dict, List, Tuple, Type from sympy.integrals.meijerint import _create_lookup_table from sympy import latex, Eq, Add, Symbol t = {} # type: Dict[Tuple[Type, ...], List...
a24ae088e3f9d953a9e101454b05fd07b0829c72a5bb645caf9cece496eba508
""" The Risch Algorithm for transcendental function integration. The core algorithms for the Risch algorithm are here. The subproblem algorithms are in the rde.py and prde.py files for the Risch Differential Equation solver and the parametric problems solvers, respectively. All important information concerning the d...
89441edc330f81d377089d470d0b4bc410ba3ec62abca0e9aa532c8f2ecd3f25
"""This module implements tools for integrating rational functions. """ from sympy import S, Symbol, symbols, I, log, atan, \ roots, RootSum, Lambda, cancel, Dummy from sympy.polys import Poly, resultant, ZZ def ratint(f, x, **flags): """ Performs indefinite integration of rational functions. Given ...
1a307f6bda24922fd84801e7fe13677765580df228dc9741052332a39a7bb718
from sympy.core import Mul from sympy.functions import DiracDelta, Heaviside from sympy.core.compatibility import default_sort_key from sympy.core.singleton import S def change_mul(node, x): """change_mul(node, x) Rearranges the operands of a product, bringing to front any simple DiracDelta express...
02d2e2fbcfbfa3b1cd0e43432a80e99e5843e709fe247c11d955814cb54942d4
""" Algorithms for solving Parametric Risch Differential Equations. The methods used for solving Parametric Risch Differential Equations parallel those for solving Risch Differential Equations. See the outline in the docstring of rde.py for more information. The Parametric Risch Differential Equation problem is, giv...
a88156d5cb397ffa0079bac50e4d6f456b9726c4c3d81a6a987bad742fc0b23d
from sympy.core import cacheit, Dummy, Ne, Integer, Rational, S, Wild from sympy.functions import binomial, sin, cos, Piecewise # TODO sin(a*x)*cos(b*x) -> sin((a+b)x) + sin((a-b)x) ? # creating, each time, Wild's and sin/cos/Mul is expensive. Also, our match & # subs are very slow when not cached, and if we create W...
60d9639c4f9a26dc14180d61bb44f455677b95cccaeb1b664e248eb8f8aaa549
""" Integrate functions by rewriting them as Meijer G-functions. There are three user-visible functions that can be used by other parts of the sympy library to solve various integration problems: - meijerint_indefinite - meijerint_definite - meijerint_inversion They can be used to compute, respectively, indefinite i...
adf16d419952b73f32f38794cfc8436bbe8fe327d461f673b3107b746e2af83f
""" SymPy core decorators. The purpose of this module is to expose decorators without any other dependencies, so that they can be easily imported anywhere in sympy/core. """ from functools import wraps from .sympify import SympifyError, sympify from sympy.core.compatibility import get_function_code def deprecated(*...
bd606cd9ab4ebdf44ae977e0ea173920a881eecff4b19222549a5c09424bd0de
greeks = ('alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
3473374f31a88121061ffee3d872ccd1aaccecc93922057ab95a76f6fbc7fb72
"""Base class for all the objects in SymPy""" from collections import defaultdict from itertools import chain, zip_longest from .assumptions import BasicMeta, ManagedProperties from .cache import cacheit from .sympify import _sympify, sympify, SympifyError from .compatibility import iterable, ordered, Mapping from .si...
5867eef7773f2c17c39db6f035bcc4d9b87d8143deaf4e25ee4ce29359632886
from math import log as _log from .sympify import _sympify from .cache import cacheit from .singleton import S from .expr import Expr from .evalf import PrecisionExhausted from .function import (_coeff_isneg, expand_complex, expand_multinomial, expand_mul) from .logic import fuzzy_bool, fuzzy_not, fuzzy_and from ....
54290cc6a5a1505817a7a65ff96f2a4a12912f4975ca943866259897341de7a0
"""Thread-safe global parameters""" from .cache import clear_cache from contextlib import contextmanager from threading import local class _global_parameters(local): """ Thread-local global parameters. Explanation =========== This class generates thread-local container for SymPy's global paramet...
b38c4eb3676f871bb3c6217883b7c5ee730cd4654db77637af45f5fb2369453b
"""Tools for manipulating of large commutative expressions. """ from sympy.core.add import Add from sympy.core.compatibility import iterable, is_sequence, SYMPY_INTS from sympy.core.mul import Mul, _keep_coeff from sympy.core.power import Pow from sympy.core.basic import Basic, preorder_traversal from sympy.core.expr ...
f6c913f995e51d9a966f327169299c69c5b2432148ad560b1b6355fc6aba7f45
""" The core's core. """ # used for canonical ordering of symbolic sequences # via __cmp__ method: # FIXME this is *so* irrelevant and outdated! ordering_of_classes = [ # singleton numbers 'Zero', 'One', 'Half', 'Infinity', 'NaN', 'NegativeOne', 'NegativeInfinity', # numbers 'Integer', 'Rational', 'Flo...
f1af8b70d53bab41c2e922af46373690a87b2bcf2ca16c78980d13018f2c2d21
"""Singleton mechanism""" from typing import Any, Dict, Type from .core import Registry from .assumptions import ManagedProperties from .sympify import sympify class SingletonRegistry(Registry): """ The registry for the singleton classes (accessible as ``S``). This class serves as two separate things....
6af0b3f7ed153bd8c953769a18e9efaa38acc5174923c034f0b63e13e37a7e33
""" This module contains the machinery handling assumptions. All symbolic objects have assumption attributes that can be accessed via .is_<assumption name> attribute. Assumptions determine certain properties of symbolic objects and can have 3 possible values: True, False, None. True is returned if the object has the...
a44f1eba292f05a649c355df92a75f48edd28c9f36aa367c67462ce8f11d2a32
""" There are three types of functions implemented in SymPy: 1) defined functions (in the sense that they can be evaluated) like exp or sin; they have a name and a body: f = exp 2) undefined function which have a name but no body. Undefined functions can be defined using a Function cla...
f9cca92ef89732a0f8bb11f7515a20a4906d7176db69c0e6558d75dbe2b5d43d
"""Core module. Provides the basic operations needed in sympy. """ from .sympify import sympify, SympifyError from .cache import cacheit from .assumptions import assumptions, check_assumptions, failing_assumptions, common_assumptions from .basic import Basic, Atom, preorder_traversal from .singleton import S from .exp...
17bf2b0863613a758dc6c3889a59e6e1016daede0a5f5514cb023475b57c173c
""" Replacement rules. """ class Transform: """ Immutable mapping that can be used as a generic transformation rule. Parameters ---------- transform : callable Computes the value corresponding to any key. filter : callable, optional If supplied, specifies which objects are in t...
1665f6b0047e79cee9e593f901558c99f24dd8ca2da4d573785375a11eef798c
from collections import defaultdict from functools import cmp_to_key from .basic import Basic from .compatibility import reduce, is_sequence from .parameters import global_parameters from .logic import _fuzzy_group, fuzzy_or, fuzzy_not from .singleton import S from .operations import AssocOp from .cache import cacheit ...
70c24b4ead328440040c2459ef1f1dc8ca1bf541f75627fcaf51a859731fa44d
""" Provides functionality for multidimensional usage of scalar-functions. Read the vectorize docstring for more details. """ from sympy.core.decorators import wraps def apply_on_element(f, args, kwargs, n): """ Returns a structure with the same dimension as the specified argument, where each basic elem...
808228a06d21688a29efc0339ae98d0fd4d8d7d3be68bd0eaf10f3d9611a4db4
from typing import Tuple as tTuple from .sympify import sympify, _sympify, SympifyError from .basic import Basic, Atom from .singleton import S from .evalf import EvalfMixin, pure_complex from .decorators import call_highest_priority, sympify_method_args, sympify_return from .cache import cacheit from .compatibility i...
b05fe886662449b982e08196f3aafd3d1758876883334d09ef38ec0431722eee
from typing import Dict, Type, Union from sympy.utilities.exceptions import SymPyDeprecationWarning from .add import _unevaluated_Add, Add from .basic import S, Atom from .compatibility import ordered from .basic import Basic from .expr import Expr from .evalf import EvalfMixin from .sympify import _sympify from .para...
ae04df49ecec60bb877877765d0555266908c2c1d7c99e6ae06f5fda608a7364
import numbers import decimal import fractions import math import re as regex from .containers import Tuple from .sympify import (SympifyError, converter, sympify, _convert_numpy_types, _sympify, _is_numpy_instance) from .singleton import S, Singleton from .expr import Expr, AtomicExpr from .eval...
79ca6bb47bf065e76f6cfcf3cac9fdf047b81d9ada72dd54e16d65193c6e6c72
from typing import Tuple from sympy.core.sympify import _sympify, sympify from sympy.core.basic import Basic from sympy.core.cache import cacheit from sympy.core.compatibility import ordered from sympy.core.logic import fuzzy_and from sympy.core.parameters import global_parameters from sympy.utilities.iterables import...
b09f5cbdbdccbeedf1ff860673103464b1ae5ad1c697253a6190804eaff29b50
from sympy.core.numbers import nan from .function import Function class Mod(Function): """Represents a modulo operation on symbolic expressions. Receives two arguments, dividend p and divisor q. The convention used is the same as Python's: the remainder always has the same sign as the divisor. ...
798fd340c1a9753246d8a9bcf3f7bf1f4b09cab74a68158ba9154b0cfa8d9051
from sympy.core.assumptions import StdFactKB, _assume_defined from sympy.core.compatibility import is_sequence, ordered from .basic import Basic from .sympify import sympify from .singleton import S from .expr import Expr, AtomicExpr from .cache import cacheit from .function import FunctionClass from sympy.core.logic i...
d000945e50af92dec08038cf3e91f8dcb088f1aac5662f73406ac236a8e871b6
""" Reimplementations of constructs introduced in later versions of Python than we support. Also some functions that are needed SymPy-wide and are located here for easy import. """ from typing import Tuple, Type import operator from collections import defaultdict from sympy.external import import_module """ Python 2...
68cedd59031fc4d512a84de610f6aad5ec8e9504e07d4aa2f9ad906789750a1c
"""sympify -- convert objects SymPy internal format""" from typing import Dict, Type, Callable, Any from inspect import getmro from .compatibility import iterable from .parameters import global_parameters class SympifyError(ValueError): def __init__(self, expr, base_exc=None): self.expr = expr ...
3e00c3a178640e5e1e8f7e7cb69f449c2ed041e52bc420e79ab071ce7a4e2f08
from sympy import Expr, Add, Mul, Pow, sympify, Matrix, Tuple from sympy.utilities import default_sort_key def _is_scalar(e): """ Helper method used in Tr""" # sympify to set proper attributes e = sympify(e) if isinstance(e, Expr): if (e.is_Integer or e.is_Float or e.is_Rational o...
38aa49c24ff213764c7b1b78f51f90c2d4ee75969765b993b296aad5930ca405
"""Definitions of common exceptions for :mod:`sympy.core` module. """ class BaseCoreError(Exception): """Base class for core related exceptions. """ class NonCommutativeExpression(BaseCoreError): """Raised when expression didn't have commutative property. """
e2d3929440aead3f8060b364c90d6d8d27c9ec121de039c0e3e5153ba066a10a
""" Adaptive numerical evaluation of SymPy expressions, using mpmath for mathematical functions. """ from typing import Tuple import math import mpmath.libmp as libmp from mpmath import ( make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec) from mpmath import inf as mpmath_inf from mpmath.libmp imp...
85a5ac6b4b2fef3785a2fe8ca5e0f382ae2e0a620f1779f98df024bccb8ee0f5
r"""This is rule-based deduction system for SymPy The whole thing is split into two parts - rules compilation and preparation of tables - runtime inference For rule-based inference engines, the classical work is RETE algorithm [1], [2] Although we are not implementing it in full (or even significantly) it's still ...
d74e1565606962133cc6deb85b15c065c862be284b386c594b616b70337ce624
""" Caching facility for SymPy """ from distutils.version import LooseVersion as V class _cache(list): """ List of cached functions """ def print_cache(self): """print cache info""" for item in self: name = item.__name__ myfunc = item while hasattr(myfunc...
df00b8605010ac5ece210b1119ef741ec80ff307bc8c499c633362f40cfd7c1a
"""Module for SymPy containers (SymPy objects that store other SymPy objects) The containers implemented in this module are subclassed to Basic. They are supposed to work seamlessly within the SymPy framework. """ from collections import OrderedDict from sympy.core import S from sympy.core.basic import ...
1f6af85683673c6aeaa07d3f81ccba40b9fa464665fcc2ced3ba0cebe640a5e6
"""Logic expressions handling NOTE ---- at present this is mainly needed for facts.py , feel free however to improve this stuff for general purpose. """ from typing import Dict, Type, Union # Type of a fuzzy bool FuzzyBool = Union[bool, None] def _torf(args): """Return True if all args are True, False if the...
ae507d675eebe42f61d89eeba51b0d3bbcccc248ca05b8534387ee9e18266b80
from collections import defaultdict from functools import cmp_to_key import operator from .sympify import sympify from .basic import Basic from .singleton import S from .operations import AssocOp from .cache import cacheit from .logic import fuzzy_not, _fuzzy_group, fuzzy_and from .compatibility import reduce from .ex...
25c9bad4093c820db69a6456b036f0eba344af1bb0fb7620e12695e46766d9e6
""" A print function that pretty prints SymPy objects. :moduleauthor: Brian Granger Usage ===== To use this extension, execute: %load_ext sympy.interactive.ipythonprinting Once the extension is loaded, SymPy Basic objects are automatically pretty-printed in the terminal and rendered in LaTeX in the Qt console ...
421f33f19f6518e2f1383b112a220e85919f2f448f87855fadbdfb8a9c3e6758
"""Tools for setting up printing in interactive sessions. """ import sys from distutils.version import LooseVersion as V from io import BytesIO from sympy import latex as default_latex from sympy import preview from sympy.utilities.misc import debug def _init_python_printing(stringify_func, **settings): """Setu...
8484f9b69a80b9997f6e1e7825862149f1f2dd84e5877f4831f84227e858f7a2
"""Tools for setting up interactive sessions. """ from distutils.version import LooseVersion as V from sympy.interactive.printing import init_printing preexec_source = """\ from __future__ import division from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('...
491b21b74f8cd42bc9a3fb03c408ed3805787e794a860e3295d4d2fec2f96b20
"""Definitions of monomial orderings. """ from __future__ import print_function, division from typing import Optional __all__ = ["lex", "grlex", "grevlex", "ilex", "igrlex", "igrevlex"] from sympy.core import Symbol from sympy.core.compatibility import iterable class MonomialOrder(object): """Base class for mo...
5c628554ff309f87c68a0710cc410772653ccc542238fd102ce1195a19c2872d
"""Implementation of RootOf class and related tools. """ from __future__ import print_function, division from sympy.core import (S, Expr, Integer, Float, I, oo, Add, Lambda, symbols, sympify, Rational, Dummy) from sympy.core.cache import cacheit from sympy.core.compatibility import ordered from sympy.polys.domain...
b2a357dd555213349a56dca1aee17e2a41653b9f6cc2ebe2cfc83f9a33ab6200
"""User-friendly public interface to polynomial functions. """ from __future__ import print_function, division from functools import wraps, reduce from operator import mul from sympy.core import ( S, Basic, Expr, I, Integer, Add, Mul, Dummy, Tuple ) from sympy.core.basic import preorder_traversal from sympy.core...
c67adf8e505baab0ebccf575442999b2b6ee3aa0ca37e91add8368ad3523e361
"""Algorithms for computing symbolic roots of polynomials. """ from __future__ import print_function, division import math from sympy.core import S, I, pi from sympy.core.compatibility import ordered, reduce from sympy.core.exprtools import factor_terms from sympy.core.function import _mexpand from sympy.core.logic ...
64cc873cc3b39f6384e088ad195449d9b15691277553780ace5dc83d37e20426
from sympy import Dummy from sympy.ntheory import nextprime from sympy.ntheory.modular import crt from sympy.polys.domains import PolynomialRing from sympy.polys.galoistools import ( gf_gcd, gf_from_dict, gf_gcdex, gf_div, gf_lcm) from sympy.polys.polyerrors import ModularGCDFailed from mpmath import sqrt import r...
40dec025c1522ca8d9f8f976d32624e8410783c9810897b28faa1ae589da6993
"""Useful utilities for higher level polynomial classes. """ from __future__ import print_function, division from sympy.core import (S, Add, Mul, Pow, Eq, Expr, expand_mul, expand_multinomial) from sympy.core.exprtools import decompose_power, decompose_power_rat from sympy.polys.polyerrors import PolynomialError,...
4380e4fa1f0579936e46f9a3d2b8713dfe56b15adcb14737a396faeb3f6cb669
"""Polynomial factorization routines in characteristic zero. """ from __future__ import print_function, division from sympy.polys.galoistools import ( gf_from_int_poly, gf_to_int_poly, gf_lshift, gf_add_mul, gf_mul, gf_div, gf_rem, gf_gcdex, gf_sqf_p, gf_factor_sqf, gf_factor) from sympy.poly...
29388aaa098f0e293ecb80fc574fe07294a2643bf8e4c69ad2e48489a93db371
""" This is our testing framework. Goals: * it should be compatible with py.test and operate very similarly (or identically) * doesn't require any external dependencies * preferably all the functionality should be in this file only * no magic, just import the test file and execute the test functions, that's it * po...
e411a72e2bc172b6a14c99ae71cc813df0981f4d9bbf884ff2f1f95a152accb4
from sympy.core.basic import Basic from sympy import (sympify, eye, sin, cos, rot_axis1, rot_axis2, rot_axis3, ImmutableMatrix as Matrix, Symbol) from sympy.core.cache import cacheit import sympy.vector class Orienter(Basic): """ Super-class for all orienter classes. """ def rotati...
688ee38be06ab184d6b7f742e2389f1decbcd7d73781d0462a2994cbb0954443
from sympy.utilities.exceptions import SymPyDeprecationWarning from sympy.core.basic import Basic from sympy.core.compatibility import Callable from sympy.core.cache import cacheit from sympy.core import S, Dummy, Lambda from sympy import symbols, MatrixBase, ImmutableDenseMatrix from sympy.solvers import solve from sy...
9496081f893bae5be63becd0a26134e783a3ab842990241eaa99b1ce2ccf3185
from sympy.utilities.exceptions import SymPyDeprecationWarning from sympy.core import Basic from sympy.vector.operators import gradient, divergence, curl class Del(Basic): """ Represents the vector differential operator, usually represented in mathematical expressions as the 'nabla' symbol. """ d...
f51abdda733a115e934195b671b953c78f1a4b33292dacd1b1a0315425783850
from typing import Any, Dict from sympy.simplify import simplify as simp, trigsimp as tsimp from sympy.core.decorators import call_highest_priority, _sympifyit from sympy.core.assumptions import StdFactKB from sympy import factor as fctr, diff as df, Integral from sympy.core import S, Add, Mul from sympy.core.expr imp...
fb60189c9a9e67dc6060d5bdc74cbb9a81d6149b661c8d6d007f22112cfbe3cc
from typing import Type from sympy.core.assumptions import StdFactKB from sympy.core import S, Pow, sympify from sympy.core.expr import AtomicExpr, Expr from sympy.core.compatibility import default_sort_key from sympy import sqrt, ImmutableMatrix as Matrix, Add from sympy.vector.coordsysrect import CoordSys3D from sym...
9221693f52383696b32a1538f99f14d36a67c2a3097a8d7c26eefe6103a5697b
import collections from sympy.core.expr import Expr from sympy.core import sympify, S, preorder_traversal from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.vector import Vector, VectorMul, VectorAdd, Cross, Dot from sympy.vector.scalar import BaseScalar from sympy.utilities.exceptions import SymPyDepre...
f13f5f2689a9a24e2a492fdcc5d55161913d522051a0244a97e517becb9a128e
from sympy.core.basic import Basic from sympy.vector.vector import Vector from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.functions import _path from sympy import Symbol from sympy.core.cache import cacheit class Point(Basic): """ Represents a point in 3-D space. """ def __new__(cl...
28c9bca0387fbb3d69499989077e10ea4003b8251f621327ea758d450e7adc83
from sympy.core import AtomicExpr, Symbol, S from sympy.core.sympify import _sympify from sympy.printing.pretty.stringpict import prettyForm from sympy.printing.precedence import PRECEDENCE class BaseScalar(AtomicExpr): """ A coordinate symbol/base scalar. Ideally, users should not instantiate this class...
a334b4a679e49585a24e891fe8ab81bba6e4fc692be5ad49fe06debc3a229f1a
from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.deloperator import Del from sympy.vector.scalar import BaseScalar from sympy.vector.vector import Vector, BaseVector from sympy.vector.operators import gradient, curl, divergence from sympy import diff, integrate, S, simplify from sympy.core import symp...
6674cc5e1d1d47273b335b82c5afccd7075d23b99dc39c8a5b5e89f0c52587d3
from typing import Type from sympy.vector.basisdependent import (BasisDependent, BasisDependentAdd, BasisDependentMul, BasisDependentZero) from sympy.core import S, Pow from sympy.core.expr import AtomicExpr from sympy import ImmutableMatrix as Matrix import sympy.vector clas...
c0ec8e9998f755c9660d0f5de6c148747a62b852de29837cb45c8dac4b278f72
"""Parabolic geometrical entity. Contains * Parabola """ from sympy.core import S from sympy.core.compatibility import ordered from sympy.core.symbol import _symbol from sympy import symbols, simplify, solve # type:ignore from sympy.geometry.entity import GeometryEntity, GeometrySet from sympy.geometry.point import...
5ed50c038e144ddac15adefbd637a0142f935eca1b843888fb5d130c7fd63453
"""Geometry Errors.""" class GeometryError(ValueError): """An exception raised by classes in the geometry module.""" pass
30cd53d93575f9dfb2f649b102c780a3e3717f5d10f74ea278c2b1163c23e455
"""Curves in 2-dimensional Euclidean space. Contains ======== Curve """ from sympy import sqrt from sympy.core import sympify, diff from sympy.core.compatibility import is_sequence from sympy.core.containers import Tuple from sympy.core.symbol import _symbol from sympy.geometry.entity import GeometryEntity, Geometry...
5571f35eca0c6ee306e5e01c01c15fe23891fca0e8d239d801b50180213023a2
"""Geometrical Points. Contains ======== Point Point2D Point3D When methods of Point require 1 or more points as arguments, they can be passed as a sequence of coordinates or Points: >>> from sympy.geometry.point import Point >>> Point(1, 1).is_collinear((2, 2), (3, 4)) False >>> Point(1, 1).is_collinear(Point(2, 2)...
8c3bec9f80fe7e1faa3e9ea110b91a3f449a232224227858ee450877220bb918
"""Geometrical Planes. Contains ======== Plane """ from sympy import simplify # type:ignore from sympy.core import Dummy, Rational, S, Symbol from sympy.core.symbol import _symbol from sympy.core.compatibility import is_sequence from sympy.functions.elementary.trigonometric import cos, sin, acos, asin, sqrt from sy...
6408fec85f6373340c235616602b2a7e20bd2ede637e1d97841472544f12f0df
"""Elliptical geometrical entities. Contains * Ellipse * Circle """ from sympy import Expr, Eq from sympy.core import S, pi, sympify from sympy.core.parameters import global_parameters from sympy.core.logic import fuzzy_bool from sympy.core.numbers import Rational, oo from sympy.core.compatibility import ordered fro...
b154faf0269df07aaac21c4f1b2325406ddb47b36c4fcb265a16a3d427ca5eec
"""The definition of the base geometrical entity with attributes common to all derived geometrical entities. Contains ======== GeometryEntity GeometricSet Notes ===== A GeometryEntity is any object that has special geometric properties. A GeometrySet is a superclass of any GeometryEntity that can also be viewed as ...
f3fbe328f4302e4a3f71d7817ca2110b046dd581cc1451f5e4789dbfd3c4ddc0
"""Utility functions for geometrical entities. Contains ======== intersection convex_hull closest_points farthest_points are_coplanar are_similar """ from sympy import Function, Symbol, solve, sqrt from sympy.core.compatibility import ( is_sequence, ordered) from sympy.core.containers import OrderedSet from .poi...
d57c6edafb96c633a5e65784628944cb8a4bc40459c368694988fb58c42cb57e
"""Line-like geometrical entities. Contains ======== LinearEntity Line Ray Segment LinearEntity2D Line2D Ray2D Segment2D LinearEntity3D Line3D Ray3D Segment3D """ from sympy import Expr from sympy.core import S, sympify from sympy.core.compatibility import ordered from sympy.core.containers import Tuple from sympy.c...
62ee38c4dfb209d276b19b6212b6a73da61adbe7ec0eeaf8ae43c6b133f15290
from sympy.core import Expr, S, Symbol, oo, pi, sympify from sympy.core.compatibility import as_int, ordered from sympy.core.symbol import _symbol, Dummy, symbols from sympy.functions.elementary.complexes import sign from sympy.functions.elementary.piecewise import Piecewise from sympy.functions.elementary.trigonometri...
9b7e40ee33b9e3130d800e30e44767d62fd21db5d6065a504d12cc47c1a06d91
"""Numerical Methods for Holonomic Functions""" from sympy.core.sympify import sympify from sympy.holonomic.holonomic import DMFsubs from mpmath import mp def _evalf(func, points, derivatives=False, method='RK4'): """ Numerical methods for numerical integration along a given set of points in the complex...
58927702f68fd89bf52f6e986e3434e1b727eba8b3203e3ea1b334590eabf98d
"""Recurrence Operators""" from sympy import symbols, Symbol, S from sympy.printing import sstr from sympy.core.sympify import sympify def RecurrenceOperators(base, generator): """ Returns an Algebra of Recurrence Operators and the operator for shifting i.e. the `Sn` operator. The first argument need...
d102a0db3987dd360e0a647dca657dd1714e0f7e0cf224c97baccf1074d82765
""" Linear Solver for Holonomic Functions""" from sympy.core import S from sympy.matrices.common import ShapeError from sympy.matrices.dense import MutableDenseMatrix class NewMatrix(MutableDenseMatrix): """ Supports elements which can't be Sympified. See docstrings in sympy/matrices/matrices.py """...
a83c94a066eb4633ed55ac7849e1047ffa3afb6eb898048464efeb6444d71f9a
""" Common Exceptions for `holonomic` module. """ class BaseHolonomicError(Exception): def new(self, *args): raise NotImplementedError("abstract base class") class NotPowerSeriesError(BaseHolonomicError): def __init__(self, holonomic, x0): self.holonomic = holonomic self.x0 = x0 ...
24132029a26d2e51a572aed06117aae50450d62693d02060279d3866bacc2ee7
""" This module implements Holonomic Functions and various operations on them. """ from sympy import (Symbol, S, Dummy, Order, rf, I, solve, limit, Float, nsimplify, gamma) from sympy.core.compatibility import ordered from sympy.core.numbers import NaN, Infinity, NegativeInfinity from sympy.core.sympify import sym...
6057d7bbcb8e937b70bbc5d7ad15ec58dd0b427edfb5ff97c029549b73b9e3c5
from sympy.printing import pycode, ccode, fcode from sympy.external import import_module from sympy.utilities.decorator import doctest_depends_on lfortran = import_module('lfortran') cin = import_module('clang.cindex', import_kwargs = {'fromlist': ['cindex']}) if lfortran: from sympy.parsing.fortran.fortran_parse...
4b7bce6e49a3ca16945c785bd69829eacb73a60d052f0f7248d0bc4e5e419458
from __future__ import print_function, division from typing import Any, Dict, Tuple from itertools import product import re from sympy import sympify def mathematica(s, additional_translations=None): ''' Users can add their own translation dictionary. variable-length argument needs '*' character. E...
bfb904cd611e81988e165e35b9dd957b1cf901189f2cc1da263378b57124a25a
""" This module defines tensors with abstract index notation. The abstract index notation has been first formalized by Penrose. Tensor indices are formal objects, with a tensor type; there is no notion of index range, it is only possible to assign the dimension, used to trace the Kronecker delta; the dimension can be...
ad1ead2a7e7c31f84c30a67866b85576eca55ddf5fe4f8d3d93a7333d2cc07aa
from .utils import _toposort, groupby class AmbiguityWarning(Warning): pass def supercedes(a, b): """ A is consistent and strictly more specific than B """ return len(a) == len(b) and all(map(issubclass, a, b)) def consistent(a, b): """ It is possible for an argument list to satisfy both A and B ""...
32168a6fb878af074dd06f57dd241dc963f0b956d9d05d8b7d899a0a9d29d393
def expand_tuples(L): """ >>> from sympy.multipledispatch.utils import expand_tuples >>> expand_tuples([1, (2, 3)]) [(1, 2), (1, 3)] >>> expand_tuples([1, 2]) [(1, 2)] """ if not L: return [()] elif not isinstance(L[0], tuple): rest = expand_tuples(L[1:]) ret...
400edda18c6e502909e7771ba1ee203ad3a3a244c8a470ad22ad68331690077e
from typing import Set from warnings import warn import inspect from .conflict import ordering, ambiguities, super_signature, AmbiguityWarning from .utils import expand_tuples import itertools as itl class MDNotImplementedError(NotImplementedError): """ A NotImplementedError for multiple dispatch """ def ambig...
346db805b710b90d50675d053424e43d471314960b29174d2195e88947131312
""" Boolean algebra module for SymPy """ from collections import defaultdict from itertools import chain, combinations, product from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.cache import cacheit from sympy.core.compatibility import ordered, as_int from sympy.core.function import App...
b952119bfa99685818185150b3915a934f5e66bfd5261ea6e2457dc12d1cb2fd
"""Inference in propositional logic""" from sympy.logic.boolalg import And, Not, conjuncts, to_cnf from sympy.core.compatibility import ordered from sympy.core.sympify import sympify from sympy.external.importtools import import_module def literal_symbol(literal): """ The symbol in this literal (without the ...
68e41a5c0b40c29c0a8be63a2e2a8e6578904489f4c80b5058b67ab62ddfe212
'''Functions returning normal forms of matrices''' from sympy.matrices.dense import diag, zeros def smith_normal_form(m, domain = None): ''' Return the Smith Normal Form of a matrix `m` over the ring `domain`. This will only work if the ring is a principal ideal domain. Examples ======== >>...
d284c4697903424b9463ca5b0e4ca3156270d0132c1171f61cb1fee25ee6b131
import os from sympy.core.function import expand_mul from sympy.simplify.simplify import dotprodsimp as _dotprodsimp # The following is an internal variable for controlling the recently introduced # dotprodsimp intermediate simplification step in matrix operations in one # place. It is intended as an emergency switc...
8d0ab2110bf83ae2bcaf5745da9faadb1e88a83fff591773766af8b6bb2a35fb
import copy from sympy.core.function import expand_mul from sympy.functions.elementary.miscellaneous import Min, sqrt from .common import NonSquareMatrixError, NonPositiveDefiniteMatrixError from .utilities import _get_intermediate_simp, _iszero from .determinant import _find_reasonable_pivot_naive def _rank_decomp...
652151f289cb10e803ef72ffda2b6e1b466853df4348b84aaa008f71725bd2d9
from types import FunctionType from sympy.core.numbers import Float, Integer from sympy.core.singleton import S from sympy.core.symbol import _uniquely_named_symbol from sympy.polys import PurePoly, cancel from sympy.simplify.simplify import (simplify as _simplify, dotprodsimp as _dotprodsimp) from .common import...
dda9dd8545ebba752e588c1afedb858ed4c1223c752420f326837fdfce1d14f7
from sympy.core.numbers import mod_inverse from .common import MatrixError, NonSquareMatrixError, NonInvertibleMatrixError from .utilities import _iszero def _pinv_full_rank(M): """Subroutine for full row or column rank matrices. For full row rank matrices, inverse of ``A * A.H`` Exists. For full column...
0f03a801ea8c5b9c361d5411ae8306257002e1818c3b0cde7493f45a5895ebd4
from types import FunctionType from sympy.simplify.simplify import ( simplify as _simplify, dotprodsimp as _dotprodsimp) from .utilities import _get_intermediate_simp, _iszero from .determinant import _find_reasonable_pivot def _row_reduce_list(mat, rows, cols, one, iszerofunc, simpfunc, normali...
5657df3d0631f5295aeedff7afd7f62c563f9316c0cebb3682605fc1506f08c9
from mpmath.matrices.matrices import _matrix from sympy.core import Basic, Dict, Integer, S, Tuple from sympy.core.cache import cacheit from sympy.core.sympify import converter as sympify_converter, _sympify from sympy.matrices.dense import DenseMatrix from sympy.matrices.expressions import MatrixExpr from sympy.matri...