hash
stringlengths
64
64
content
stringlengths
0
1.51M
2f0ce74a6651250b7fb037aafe5717b145e54b2adc13c27e73082f8bdb1a5038
from functools import reduce import operator from sympy.core import Basic, sympify from sympy.core.add import add, Add, _could_extract_minus_sign from sympy.core.sorting import default_sort_key from sympy.functions import adjoint from sympy.matrices.matrices import MatrixBase from sympy.matrices.expressions.transpose ...
0e42bf46e20503d1fd1e859c7a0b4f5911df40d835ee1e427ea503dba13cbbc1
from sympy.matrices.expressions import MatrixSymbol, MatAdd, MatPow, MatMul from sympy.matrices.expressions.special import GenericZeroMatrix, ZeroMatrix from sympy.matrices.common import ShapeError from sympy.matrices import eye, ImmutableMatrix from sympy.core import Add, Basic, S from sympy.core.add import add from s...
32e308ccffa8ba2b91b935393e606d53e5e4ff406dbb89b29be0b6d0cf25379f
from sympy.core import I, symbols, Basic, Mul, S from sympy.core.mul import mul from sympy.functions import adjoint, transpose from sympy.matrices.common import ShapeError from sympy.matrices import (Identity, Inverse, Matrix, MatrixSymbol, ZeroMatrix, eye, ImmutableMatrix) from sympy.matrices.expressions impor...
32183bd6f9e38dbe1f9b48d98230e8596f2b0093017a1f1a0c233be608c4a4a4
from sympy.core.add import Add from sympy.core.expr import unchanged from sympy.core.mul import Mul from sympy.core.symbol import symbols from sympy.core.relational import Eq from sympy.concrete.summations import Sum from sympy.functions.elementary.complexes import im, re from sympy.functions.elementary.piecewise impor...
941baa582c127af53b24beba7a81d6af12f9808bda5a69268a70e8a859a9c8a0
from sympy.concrete.summations import Sum from sympy.core.exprtools import gcd_terms from sympy.core.function import (diff, expand) from sympy.core.relational import Eq from sympy.core.symbol import (Dummy, Symbol, Str) from sympy.functions.special.tensor_functions import KroneckerDelta from sympy.matrices.dense import...
9b14c96a807865ee74964fb64e0568a66aeb6ee41b12a52c6707372b51fcc3e4
from sympy.core.symbol import symbols, Dummy from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction from sympy.core.function import Lambda from sympy.functions.elementary.exponential import exp from sympy.functions.elementary.trigonometric import sin from sympy.matrices.dense import Matrix from sympy...
df7522fef5d904947580c8ab6fc739c470e7c768e95635a856962656e650a098
from sympy.core import symbols, S from sympy.matrices.expressions import MatrixSymbol, Inverse, MatPow, ZeroMatrix, OneMatrix from sympy.matrices.common import NonInvertibleMatrixError, NonSquareMatrixError from sympy.matrices import eye, Identity from sympy.testing.pytest import raises from sympy.assumptions.ask impor...
5837a53fb950f4aaac6a538e9561da66adfc9d38a391150c01731c02f538d923
from sympy.matrices.dense import Matrix, eye from sympy.matrices.common import ShapeError from sympy.matrices.expressions.matadd import MatAdd from sympy.matrices.expressions.special import Identity, OneMatrix, ZeroMatrix from sympy.core import symbols from sympy.testing.pytest import raises, warns_deprecated_sympy fr...
66f03e06b02446d32b01494f02d9df578928cd059504653ca2850bcce94ba04c
""" 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...
6c9ca5fd96bb782eda14e8219ee8f78b735a634dfa902535b0cab521307a2ea0
from sympy.ntheory import sieve, isprime from sympy.core.numbers import mod_inverse from sympy.core.power import integer_log from sympy.utilities.misc import as_int import random rgen = random.Random() #----------------------------------------------------------------------------# # ...
4182a776f49f82d63e125ae182c84d2d463ffbdee10ec94ea0ae320ffcb789f1
""" Integral Transforms """ from functools import reduce, wraps from itertools import repeat from sympy.core import S, pi, I from sympy.core.add import Add from sympy.core.function import (AppliedUndef, count_ops, Derivative, expand, expand_complex, expand_mul, expand_trig, ...
e7ac5e7c2d250cb814e4bec428cac2b85cc0b0e8eef1e9d8483c575867f41cd2
"""Sparse polynomial rings. """ from __future__ import annotations from typing import Any from operator import add, mul, lt, le, gt, ge from functools import reduce from types import GeneratorType from sympy.core.expr import Expr from sympy.core.numbers import igcd, oo from sympy.core.symbol import Symbol, symbols a...
3846697587874000c1258a8cc3c240c8de2cc3e8ec27a973547ea6f820a82bc8
"""High-level polynomials manipulation functions. """ from sympy.core import S, Basic, symbols, Dummy from sympy.polys.polyerrors import ( PolificationFailed, ComputationFailed, MultivariatePolynomialError, OptionError) from sympy.polys.polyoptions import allowed_flags, build_options from sympy.polys.polytool...
0546e028f5174f0beb8436d08e31ba7378c5070990d167d188c4134c59cf2fdd
"""A module that handles matrices. Includes functions for fast creating matrices like zero, one/eye, random matrix, etc. """ from .common import ShapeError, NonSquareMatrixError, MatrixKind from .dense import ( GramSchmidt, casoratian, diag, eye, hessian, jordan_cell, list2numpy, matrix2numpy, matrix_multiply_...
8711a10a751906e25a015fe3893a69c31cc26a8ff723be689ff3f320076b1347
import random from sympy.core.basic import Basic from sympy.core.singleton import S from sympy.core.symbol import Symbol from sympy.core.sympify import sympify from sympy.functions.elementary.trigonometric import cos, sin from sympy.utilities.decorator import doctest_depends_on from sympy.utilities.exceptions import s...
b7a48a2feb17bf1a481cf4e47eabb377d05b4f876fabe4cb2b652905e359cb27
from sympy.calculus.accumulationbounds import AccumBounds from sympy.core.add import Add from sympy.core.function import (Lambda, diff) from sympy.core.mod import Mod from sympy.core.mul import Mul from sympy.core.numbers import (E, Float, I, Rational, nan, oo, pi, zoo) from sympy.core.power import Pow from sympy.core....
3de4617a7bcd88558d3db3bf28b92c7250a0993126445fd70b338746983d17d4
""" 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.assumptions.ask import Q, ask from sympy.assumptions.refine import re...
c2a2f9beabf4799c81aa15f96e6a9d0dfc9754758b58d802c31d81a42d897ad2
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...
9ee65ed7b40462382825aa2fc442d04bc715f764b7d5da491bd220b84f471454
"""Test sparse polynomials. """ from functools import reduce from operator import add, mul from sympy.polys.rings import ring, xring, sring, PolyRing, PolyElement from sympy.polys.fields import field, FracField from sympy.polys.domains import ZZ, QQ, RR, FF, EX from sympy.polys.orderings import lex, grlex from sympy....
ee3571a4a6b141f1764ca80c886184b41ba2da9aacc2e053ce01bef7e19010a1
from sympy.ntheory import sieve, isprime from sympy.core.numbers import mod_inverse from sympy.core.power import integer_log from sympy.utilities.misc import as_int import random rgen = random.Random() #----------------------------------------------------------------------------# # ...
5dcf4b68777a9cea71194d6980531d80a15563e7eaf2bb51f0afa4ae87a2257d
from __future__ import annotations 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 sympy.polys import Poly from sympy.polys.domains import ZZ from sympy.polys.galoistools import gf_crt1, gf_crt2...
bc04c51434947cdd2cf98bccd1dda067e6f9de6c0f112f3a4513271614fd0e9b
from typing import Tuple as tTuple from sympy.calculus.singularities import is_decreasing from sympy.calculus.accumulationbounds import AccumulationBounds from .expr_with_intlimits import ExprWithIntLimits from .expr_with_limits import AddWithLimits from .gosper import gosper_sum from sympy.core.expr import Expr from ...
b44fa11eea16eb64091c30375a14655da4e4a24080383b35bd78238ab84e6224
from sympy.core.singleton import S from sympy.core.symbol import Symbol from sympy.polys.polytools import lcm from sympy.utilities import public @public def approximants(l, X=Symbol('x'), simplify=False): """ Return a generator for consecutive Pade approximants for a series. It can also be used for computi...
4e1aeb613108c109ddd5c39fc3efe9eb27516f57b6fbb2b9094edd2695d3c7e6
from collections import defaultdict from functools import reduce from math import prod from sympy.core.function import expand_log, count_ops, _coeff_isneg from sympy.core import sympify, Basic, Dummy, S, Add, Mul, Pow, expand_mul, factor_terms from sympy.core.sorting import ordered, default_sort_key from sympy.core.nu...
09ab01de638c9e229b362043254f928f2205c4d08a21692014b12c6ce6254520
from collections import defaultdict from functools import reduce from sympy.core import (sympify, Basic, S, Expr, factor_terms, Mul, Add, bottom_up) from sympy.core.cache import cacheit from sympy.core.function import (count_ops, _mexpand, FunctionClass, expand, ...
b3c2b98e6c6f3e8630f03548a56d3e87e6eb1e55a2ddadd78fb0d0a0a2548e5f
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...
bb5ae80d05bab3c5a4f202ca8d0a55d08d9ec13a4f75fcacf2cfede6b5f29ad3
from sympy.core.numbers import Rational from sympy.core.singleton import S from sympy.core.relational import is_eq from sympy.functions.elementary.complexes import (conjugate, im, re, sign) from sympy.functions.elementary.exponential import (exp, log as ln) from sympy.functions.elementary.miscellaneous import sqrt from...
75c083dcac759c0f8cd7c4f1dd9d2f99caebdd70601a4a03f2e9d0774cef0a62
""" Types used to represent a full function/module as an Abstract Syntax Tree. Most types are small, and are merely used as tokens in the AST. A tree diagram has been included below to illustrate the relationships between the AST types. AST Type Tree ------------- :: *Basic* | | CodegenAST ...
4862cf20c80613da3d4616938538157269c508a6f1359bee92aa77bafaafd15c
""" This module contains SymPy functions mathcin corresponding to special math functions in the C standard library (since C99, also available in C++11). The functions defined in this module allows the user to express functions such as ``expm1`` as a SymPy function for symbolic manipulation. """ from sympy.core.functi...
310660dc989512f699bb33253947978cf2ee0109616f9f9034353c330e663672
"""Module for querying SymPy objects about assumptions.""" from sympy.assumptions.assume import (global_assumptions, Predicate, AppliedPredicate) from sympy.assumptions.cnf import CNF, EncodedCNF, Literal from sympy.core import sympify from sympy.core.kind import BooleanKind from sympy.core.relational import E...
8119ff8a73b57271c489887c4f75d1ccf949daac7ff75436cf201dc00530bc27
""" 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...
490c3e5bc77954705f17cd4461515b71249552bb081c6f5af58cdb91468a22a7
"""Solvers of systems of polynomial equations. """ import itertools from sympy.core import S from sympy.core.sorting import default_sort_key from sympy.polys import Poly, groebner, roots from sympy.polys.polytools import parallel_poly_from_expr from sympy.polys.polyerrors import (ComputationFailed, PolificationFai...
a8192736f30fc84893829a91b4a20df0fc591e53fc41c9c427515202a1c8925e
""" 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 __future__ import annotations from sympy.core ...
f62e4fd56c63f1d4ffe8c09bd00d7320207566316320e5d82a9b4fed49afcd0b
from sympy.core import Add, Mul, Pow, S from sympy.core.basic import Basic from sympy.core.expr import Expr from sympy.core.numbers import _sympifyit, oo, zoo from sympy.core.relational import is_le, is_lt, is_ge, is_gt from sympy.core.sympify import _sympify from sympy.functions.elementary.miscellaneous import Min, Ma...
8fdd2e2e204c24345b5dd6b356191b1693aaa7f6bc07bb2b7728b621c799f500
from .accumulationbounds import AccumBounds, AccumulationBounds # noqa: F401 from .singularities import singularities from sympy.core import Pow, S from sympy.core.function import diff, expand_mul from sympy.core.kind import NumberKind from sympy.core.mod import Mod from sympy.core.numbers import equal_valued from symp...
c48bf9975690ecaf3ff3dd32d456529f3ba12e4aa7c3130e9e5dfdb0ea233b78
""" This module provides convenient functions to transform SymPy expressions to lambda functions which can be used to calculate numerical values very fast. """ from __future__ import annotations from typing import Any import builtins import inspect import keyword import textwrap import linecache # Required despite s...
a58a6dcb660382f1792c1ae68805728aaa62aa17c57984df41f4bbb1340c364b
""" Algorithms and classes to support enumerative combinatorics. Currently just multiset partitions, but more could be added. Terminology (following Knuth, algorithm 7.1.2.5M TAOCP) *multiset* aaabbcccc has a *partition* aaabc | bccc The submultisets, aaabc and bccc of the partition are called *parts*, or sometimes ...
4a60186ba54174787c4b3f9fa47290d5901c6f98b0ff74b3c088e6ed5b597b85
from collections import defaultdict, OrderedDict from itertools import ( chain, combinations, combinations_with_replacement, cycle, islice, permutations, product ) # For backwards compatibility from itertools import product as cartes # noqa: F401 from operator import gt # this is the logical location of thes...
c0db3f92d7d8c484a2cdbb4974300435e9f3154f0c631d48f24b8d97af96d9b1
"""Miscellaneous stuff that does not really fit anywhere else.""" from __future__ import annotations import operator import sys import os import re as _re import struct from textwrap import fill, dedent class Undecidable(ValueError): # an error to be raised when a decision cannot be made definitively # wher...
0470e702998c15bdcf5b7afdf02a32e1940b20d2ce8a735e1c4666818c49e6c7
from sympy.core import S from sympy.core.function import Lambda from sympy.core.power import Pow from .pycode import PythonCodePrinter, _known_functions_math, _print_known_const, _print_known_func, _unpack_integral_limits, ArrayPrinter from .codeprinter import CodePrinter _not_in_numpy = 'erf erfc factorial gamma log...
383f71601a1393ec91861b5b09ac7271e83596c9c2694725a7f3565b8b9a3586
""" Rust code printer The `RustCodePrinter` converts SymPy expressions into Rust expressions. A complete code generator, which uses `rust_code` extensively, can be found in `sympy.utilities.codegen`. The `codegen` module can be used to generate complete source code files. """ # Possible Improvement # # * make sure ...
751e8474602cc9458a44a8405828968799a3c9ea0c1cfb46c9e0f6d96d55feec
"""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...
bcc0052da0d614767602ea09e7bc41f9aaefbf26aa7ec0c380f255cf94bff499
""" C code printer The C89CodePrinter & C99CodePrinter converts single SymPy expressions into single C expressions, using the functions defined in math.h where possible. A complete code generator, which uses ccode extensively, can be found in sympy.utilities.codegen. The codegen module can be used to generate complet...
c8590e7776befc850b21646454539af05b1fc75e908b06bbc67fde614d30840d
""" Fortran code printer The FCodePrinter converts single SymPy expressions into single Fortran expressions, using the functions defined in the Fortran 77 standard where possible. Some useful pointers to Fortran can be found on wikipedia: https://en.wikipedia.org/wiki/Fortran Most of the code below is based on the "...
9a059861a72a90b8816e557ad02447d46e850bd1646742ce7c062cd4d8313870
""" R code printer The RCodePrinter converts single SymPy expressions into single R expressions, using the functions defined in math.h where possible. """ from __future__ import annotations from typing import Any from sympy.core.numbers import equal_valued from sympy.printing.codeprinter import CodePrinter from s...
df50669c253e082aa5940a4e049a7910f40244eee18d4ee1bd84ea6317ab3d88
""" 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...
c841a112c13f5a41b833a3e945d511c3e15bb06f9e54b2fc776f9ddc25299079
""" Maple code printer The MapleCodePrinter converts single SymPy expressions into single Maple expressions, using the functions defined in the Maple objects where possible. FIXME: This module is still under actively developed. Some functions may be not completed. """ from sympy.core import S from sympy.core.number...
124194a8c1f7a8101b2d56d24ae622e1943cf46e315089834f69d301fde79fd1
""" Javascript code printer The JavascriptCodePrinter converts single SymPy expressions into single Javascript expressions, using the functions defined in the Javascript Math object where possible. """ from __future__ import annotations from typing import Any from sympy.core import S from sympy.core.numbers import ...
889a8e3eb1e1a898c073a5274fff11ec0e4d15c9fa22613798e4cb4bb5f46d46
""" Julia code printer The `JuliaCodePrinter` converts SymPy expressions into Julia expressions. A complete code generator, which uses `julia_code` extensively, can be found in `sympy.utilities.codegen`. The `codegen` module can be used to generate complete source code files. """ from __future__ import annotations...
c8e6f03da10c7693edc72bf9572549149b630dd9b41abf313d0821e4962eb834
from __future__ import annotations from sympy.core import Basic, S from sympy.core.function import Lambda from sympy.core.numbers import equal_valued from sympy.printing.codeprinter import CodePrinter from sympy.printing.precedence import precedence from functools import reduce known_functions = { 'Abs': 'abs', ...
547d1a6c5d49428bc9f3115dafbf4e6f6e8439d6e089600a8d40cee6fd989639
""" Integral Transforms """ from functools import reduce, wraps from itertools import repeat from sympy.core import S, pi from sympy.core.add import Add from sympy.core.function import ( AppliedUndef, count_ops, expand, expand_mul, Function) from sympy.core.mul import Mul from sympy.core.numbers import igcd, ilcm f...
44b7af21df6f65232c3eab873f555d972ea830a20462893e7cf25bd7a62ce69f
"""Laplace Transforms""" from sympy.core import S, pi, I from sympy.core.add import Add from sympy.core.cache import cacheit from sympy.core.function import ( AppliedUndef, Derivative, expand, expand_complex, expand_mul, expand_trig, Lambda, WildFunction, diff) from sympy.core.mul import Mul, prod from sympy.co...
783d1a3e6fa4f3e244459aaf05ce37687bd95898dd6947f2d0871a8ba1fbd635
from typing import Tuple as tTuple from sympy.concrete.expr_with_limits import AddWithLimits from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.containers import Tuple from sympy.core.expr import Expr from sympy.core.exprtools import factor_terms from sympy.core.function import diff from...
77d4d6d8a69e9dcde6c033ea40adc022ec64c32f5a26309ab39916f66fa09239
""" 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...
ab57976d28326f9583455adf43385cead67376b0ddf28dbac53146b965a3840b
"""Base class for all the objects in SymPy""" from __future__ import annotations from collections import defaultdict from collections.abc import Mapping from itertools import chain, zip_longest from .assumptions import ManagedProperties from .cache import cacheit from .sympify import _sympify, sympify, SympifyError, ...
59856624f34f16c6b179e7360f633f4dbf6f52b206dcaf02880a8771ad5854f1
from __future__ import annotations from typing import Callable from math import log as _log, sqrt as _sqrt from itertools import product from .sympify import _sympify from .cache import cacheit from .singleton import S from .expr import Expr from .evalf import PrecisionExhausted from .function import (expand_complex, ...
982531cb24190d271e53b7873f15770b49815162386b6433fcb859c49e455d8f
"""Tools for manipulating of large commutative expressions. """ from .add import Add from .mul import Mul, _keep_coeff from .power import Pow from .basic import Basic from .expr import Expr from .function import expand_power_exp from .sympify import sympify from .numbers import Rational, Integer, Number, I, equal_valu...
ca765f9903d75aae537ba58ecfa0b3691f1cae525f71f2933f6e20cd57fe405d
from collections import defaultdict from .sympify import sympify, SympifyError from sympy.utilities.iterables import iterable, uniq __all__ = ['default_sort_key', 'ordered'] def default_sort_key(item, order=None): """Return a key that can be used for sorting. The key has the structure: (class_key, (l...
171e23f18f6e283cc79072f311f1354eb3505aa4f2910885066a987d27bb7805
""" 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...
b8561692c5cc0349df9c842e584be1606983ba1d77e73a3528714d6c8c305baa
""" This module contains the machinery handling assumptions. Do also consider the guide :ref:`assumptions-guide`. 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: `...
1c8be0f7452f531d190b9d964c03b019c97fd7ee6f62104bc2ac401a13dafccd
""" 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...
4fc3096f0dc52394771fabe810c8358d927dad438ba526ff4e8950c3029aaf04
from typing import Tuple as tTuple from collections import defaultdict from functools import cmp_to_key, reduce from operator import attrgetter from .basic import Basic from .parameters import global_parameters from .logic import _fuzzy_group, fuzzy_or, fuzzy_not from .singleton import S from .operations import AssocOp...
b2e8f2b79b7da1fc061f9dc85d84418710c4078980c6c6eb127b517555792e58
from __future__ import annotations from typing import TYPE_CHECKING from collections.abc import Iterable from functools import reduce import re from .sympify import sympify, _sympify from .basic import Basic, Atom from .singleton import S from .evalf import EvalfMixin, pure_complex, DEFAULT_MAXPREC from .decorators i...
4f1274625ba754b8da61fbd4a58918149be77fc96b18cc7af05e721d013e8c26
from __future__ import annotations import numbers import decimal import fractions import math import re as regex import sys from functools import lru_cache from .containers import Tuple from .sympify import (SympifyError, _sympy_converter, sympify, _convert_numpy_types, _sympify, _is_numpy_instance) fro...
bdab0202c4f8694f572717eb1068cbfb3795225d85b08d64b7356d3da26aff47
from __future__ import annotations from operator import attrgetter from collections import defaultdict from sympy.utilities.exceptions import sympy_deprecation_warning from .sympify import _sympify as _sympify_, sympify from .basic import Basic from .cache import cacheit from .sorting import ordered from .logic impor...
b2eaef9377b91323627d51caa6a2d9e4d5286c5752d3ec0460de17a14933308f
from .add import Add from .exprtools import gcd_terms from .function import Function from .kind import NumberKind from .logic import fuzzy_and, fuzzy_not from .mul import Mul from .numbers import equal_valued from .singleton import S class Mod(Function): """Represents a modulo operation on symbolic expressions. ...
a5bbacadfbf546e09a0c09085ca62827eb3a440b9d08381addb4c22bbd7d5e51
""" Adaptive numerical evaluation of SymPy expressions, using mpmath for mathematical functions. """ from __future__ import annotations from typing import Tuple as tTuple, Optional, Union as tUnion, Callable, List, Dict as tDict, Type, TYPE_CHECKING, \ Any, overload import math import mpmath.libmp as libmp from m...
0321bb9206a7c95d23571f9a34111416882a44b1d0aaa167f315376527c9a1a3
""" Caching facility for SymPy """ from importlib import import_module from typing import Callable class _cache(list): """ List of cached functions """ def print_cache(self): """print cache info""" for item in self: name = item.__name__ myfunc = item while ...
89ceae48d22dcf92602fc0f1f13f3b81c9e9886c0ec6f7fa15a4158084565a8a
"""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 collections.abc import MutableSet from typing impo...
9774755c2d5a385be6b1fa18b15f7a0eb8d0e220f7c8687c7638d4f240aa1902
"""User-friendly public interface to polynomial functions. """ from functools import wraps, reduce from operator import mul from typing import Optional from sympy.core import ( S, Expr, Add, Tuple ) from sympy.core.basic import Basic from sympy.core.decorators import _sympifyit from sympy.core.exprtools import F...
0ab9fe91e99d82241dcab0952834a7ce5eed102540e0b613c32d37e20b4e9c16
"""Algorithms for computing symbolic roots of polynomials. """ import math from functools import reduce from sympy.core import S, I, pi from sympy.core.exprtools import factor_terms from sympy.core.function import _mexpand from sympy.core.logic import fuzzy_not from sympy.core.mul import expand_2arg, Mul from sympy....
68999af8ab6b2a0bac50bd63cf92000f3eeaeaf73bd2bb1f6d3f4db71243795e
import re import fnmatch message_unicode_B = \ "File contains a unicode character : %s, line %s. " \ "But not in the whitelist. " \ "Add the file to the whitelist in " + __file__ message_unicode_D = \ "File does not contain a unicode character : %s." \ "but is in the whitelist. " \ "Remove the...
dedfcdbbddbfaf4089cebbc894261221b69b6270483becf6af79e350ab2c349d
from __future__ import annotations from typing import TYPE_CHECKING from sympy.simplify import simplify as simp, trigsimp as tsimp # type: ignore from sympy.core.decorators import call_highest_priority, _sympifyit from sympy.core.assumptions import StdFactKB from sympy.core.function import diff as df from sympy.integ...
f03b46921414ca5795222e567e9b59384936ce7d24c15019bf969e348e3df2d8
"""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 import Point >>> Point(1, 1).is_collinear((2, 2), (3, 4)) False >>> Point(1, 1).is_collinear(Point(2, 2), Point(3, 4)) ...
03e0a058b8c50bd93f3a3caa2456aaee40c076c4aa998113e1a665fde1f6535d
"""Geometrical Planes. Contains ======== Plane """ from sympy.core import Dummy, Rational, S, Symbol from sympy.core.symbol import _symbol from sympy.functions.elementary.trigonometric import cos, sin, acos, asin, sqrt from .entity import GeometryEntity from .line import (Line, Ray, Segment, Line3D, LinearEntity, Li...
2ce508b1c9eadcf683f4b6b9434bcf184985ff6a55fd12d635795469c644171d
"""Elliptical geometrical entities. Contains * Ellipse * Circle """ from sympy.core.expr import Expr from sympy.core.relational import Eq from sympy.core import S, pi, sympify from sympy.core.evalf import N from sympy.core.parameters import global_parameters from sympy.core.logic import fuzzy_bool from sympy.core.nu...
7ef1e1b526fa46f13abfef3233208dbe6d1e90b3e83bb10ef49f1312c1b24065
"""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 ...
a092f886ef8cc5fd6d53aee0ba55e58fff52b7c8e8e866a773b79e1b01bba581
"""Utility functions for geometrical entities. Contains ======== intersection convex_hull closest_points farthest_points are_coplanar are_similar """ from collections import deque from math import sqrt as _sqrt from .entity import GeometryEntity from .exceptions import GeometryError from .point import Point, Point...
25273475c8ca5769b547a6fbb4868f8df7e1746cf765db6314abec1fbd8bbaaa
"""Line-like geometrical entities. Contains ======== LinearEntity Line Ray Segment LinearEntity2D Line2D Ray2D Segment2D LinearEntity3D Line3D Ray3D Segment3D """ from sympy.core.containers import Tuple from sympy.core.evalf import N from sympy.core.expr import Expr from sympy.core.numbers import Rational, oo, Float...
47a201b04e722a7d2a453db4763ee81bfd6aacabf4005b12de7d9aafd3ff3552
from sympy.core import Expr, S, oo, pi, sympify from sympy.core.evalf import N from sympy.core.sorting import default_sort_key, ordered from sympy.core.symbol import _symbol, Dummy, Symbol from sympy.functions.elementary.complexes import sign from sympy.functions.elementary.piecewise import Piecewise from sympy.functio...
0e4a05aa80a71eccdb3074a8f09de55c024460e65f5a4ae955d93f1a47d74303
""" This module implements Holonomic Functions and various operations on them. """ from sympy.core import Add, Mul, Pow from sympy.core.numbers import (NaN, Infinity, NegativeInfinity, Float, I, pi, equal_valued) from sympy.core.singleton import S from sympy.core.sorting import ordered from sympy.core.symbol i...
c2ec4309f24aa4c6dd9785a3ccf9d985eebf3202f12d4abe8d8f58e3dde14170
"""Transform a string with Python-like source code into SymPy expression. """ from tokenize import (generate_tokens, untokenize, TokenError, NUMBER, STRING, NAME, OP, ENDMARKER, ERRORTOKEN, NEWLINE) from keyword import iskeyword import ast import unicodedata from io import StringIO import builtins import types f...
986b1f943069650eb923dac620e2481757ed80920f810cd55ed134de1a8b6770
""" 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...
8c9dcb2d928149e52076d5bc62fe1b8bf95968d810c83c8ec52b9b88f356bf43
""" Boolean algebra module for SymPy """ from collections import defaultdict from itertools import chain, combinations, product, permutations from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.cache import cacheit from sympy.core.containers import Tuple from sympy.core.decorators import ...
f8e0ec96c4e9876e6d24979f787851dd2438eb60970fa76ac045598b854fec20
import copy from sympy.core import S from sympy.core.function import expand_mul from sympy.functions.elementary.miscellaneous import Min, sqrt from sympy.functions.elementary.complexes import sign from .common import NonSquareMatrixError, NonPositiveDefiniteMatrixError from .utilities import _get_intermediate_simp, _...
dc5e63c7af4260a8a02b49885b0368939579bdb8de37cc6c82a067c51a3af008
""" Basic methods common to all matrices to be used when creating more advanced matrices (e.g., matrices over rings, etc.). """ from collections import defaultdict from collections.abc import Iterable from inspect import isfunction from functools import reduce from sympy.assumptions.refine import refine from sympy.co...
71302ad0adc69cb0623640a064d56bf6b2edf07debae7ca11da78b73f6130689
import random from sympy.core.basic import Basic from sympy.core.singleton import S from sympy.core.symbol import Symbol from sympy.core.sympify import sympify from sympy.functions.elementary.trigonometric import cos, sin from sympy.utilities.decorator import doctest_depends_on from sympy.utilities.exceptions import s...
bbc25ccdd411351f0708b75949098e363baab118e34554ed5b1b36239313e5f6
import mpmath as mp from collections.abc import Callable from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.function import diff from sympy.core.expr import Expr from sympy.core.kind import _NumberKind, UndefinedKind from sympy.core.mul import Mul from sympy.core.power import Pow from s...
069ed4c1f7c830eee873c527155d75c9819c5d48d26b4361b2e3a041a35132df
from sympy.concrete.summations import Sum from sympy.core.basic import Basic from sympy.core.containers import Tuple from sympy.core.function import Lambda from sympy.core.numbers import (Rational, nan, oo, pi) from sympy.core.relational import Eq from sympy.core.singleton import S from sympy.core.symbol import (Symbol...
5b6f2b09161ccefe496b1ee4f9b8fb3af793fb2f803f8abe911474f8b35a597d
from sympy.concrete.products import Product from sympy.concrete.summations import Sum from sympy.core.numbers import (Rational, oo, pi) from sympy.core.relational import Eq from sympy.core.singleton import S from sympy.core.symbol import symbols from sympy.functions.combinatorial.factorials import (RisingFactorial, fac...
42bd4c0b863cdecb0498c333ae5d740dd7d7069a0e6b35ad376d94cf18063573
from sympy.concrete.summations import Sum from sympy.core.containers import Tuple from sympy.core.function import Lambda from sympy.core.numbers import (Float, Rational, oo, pi) from sympy.core.relational import (Eq, Ge, Gt, Le, Lt, Ne) from sympy.core.singleton import S from sympy.core.symbol import (Symbol, symbols) ...
6a6ad913b1ec5dc4adf7a32092eee93d33051c3960365f58fb3bf076934003ab
from sympy.concrete.products import Product from sympy.core.numbers import pi from sympy.core.singleton import S from sympy.core.symbol import (Dummy, symbols) from sympy.functions.elementary.exponential import exp from sympy.functions.elementary.miscellaneous import sqrt from sympy.functions.special.gamma_functions im...
8cd1281a20f99c4d0974e6acf98b957029cd45337dbdd5a5b6aa1f6a3ac252a5
from __future__ import annotations from sympy.ntheory import qs from sympy.ntheory.qs import SievePolynomial, _generate_factor_base, \ _initialize_first_polynomial, _initialize_ith_poly, \ _gen_sieve_array, _check_smoothness, _trial_division_stage, _gauss_mod_2, \ _build_matrix, _find_factor from sympy.tes...
d2d8b78380fc841a6fa6c4ab736098211c55c2a2ce44a3b92bcf287df0f029f3
from math import prod from sympy.concrete.expr_with_intlimits import ReorderError from sympy.concrete.products import (Product, product) from sympy.concrete.summations import (Sum, summation, telescopic, eval_sum_residue, _dummy_with_inherited_properties_concrete) from sympy.core.function import (Derivative, Func...
aec482a435a965018ca3445fae4092e573a5fbec1516623265c6985286855dd7
from sympy.core.evalf import N from sympy.core.function import (Derivative, Function, PoleError, Subs) from sympy.core.numbers import (E, Float, Rational, oo, pi, I) from sympy.core.singleton import S from sympy.core.symbol import (Symbol, symbols) from sympy.functions.elementary.exponential import (LambertW, exp, log)...
c8cc3fe57d862d7c9b5471cc9d0d07d0dc7cb1758f60af441fc6e849904e630a
from itertools import product from sympy.concrete.summations import Sum from sympy.core.function import (Function, diff) from sympy.core import EulerGamma from sympy.core.numbers import (E, I, Rational, oo, pi, zoo) from sympy.core.singleton import S from sympy.core.symbol import (Symbol, symbols) from sympy.functions...
bc6e4f0d30cd3ae172a53ec7f4348c8c8a2594faa429d3615afe45063eaf1671
from itertools import product from sympy.core.function import (Subs, count_ops, diff, expand) from sympy.core.numbers import (E, I, Rational, pi) from sympy.core.singleton import S from sympy.core.symbol import (Symbol, symbols) from sympy.functions.elementary.exponential import (exp, log) from sympy.functions.elementa...
93adeb8130dd8cdbe34b0e017f82e493628807ec5eb0e4fd3f1569bd57a78b29
from sympy.concrete.summations import Sum from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.expr import unchanged from sympy.core.function import (count_ops, diff, expand, expand_multinomial, Function, Derivative) from sympy.core.mul import Mul, _keep_coeff from sympy.core import GoldenR...
f38e4a9adcfea99383368768182734a4756050c744b82d006dea91dc84147e48
from sympy.core.function import diff from sympy.core.function import expand from sympy.core.numbers import (E, I, Rational, pi) from sympy.core.singleton import S from sympy.core.symbol import (Symbol, symbols) from sympy.functions.elementary.complexes import (Abs, conjugate, im, re, sign) from sympy.functions.elementa...
6805a4fb201554d02614c9325256016d503c98f95316a50b3ad9973048b72cef
import math from sympy.core.containers import Tuple from sympy.core.numbers import nan, oo, Float, Integer from sympy.core.relational import Lt from sympy.core.symbol import symbols, Symbol from sympy.functions.elementary.trigonometric import sin from sympy.matrices.dense import Matrix from sympy.matrices.expressions.m...