hash
stringlengths
64
64
content
stringlengths
0
1.51M
3a524bbfd261fb02a5b94579bfbc2a3baa8ec49477d153a05e7d34b30a59f11d
import keyword as kw import sympy from .repr import ReprPrinter from .str import StrPrinter # A list of classes that should be printed using StrPrinter STRPRINT = ("Add", "Infinity", "Integer", "Mul", "NegativeInfinity", "Pow", "Zero") class PythonPrinter(ReprPrinter, StrPrinter): """A printer which ...
9b4e03d0015326bd7e42a18818c531d298569d4408e8d67b1b2d2db8758e02fc
from sympy.external.importtools import version_tuple from collections.abc import Iterable from sympy import Mul, S from sympy.codegen.cfunctions import Sqrt from sympy.external import import_module from sympy.printing.precedence import PRECEDENCE from sympy.printing.pycode import AbstractPythonCodePrinter import sympy...
054d1f79cd0dc03f5d336eba0ee06fd3b28172892c94c23105c3cd250e25d439
import os from os.path import join import shutil import tempfile try: from subprocess import STDOUT, CalledProcessError, check_output except ImportError: pass from sympy.utilities.decorator import doctest_depends_on from .latex import latex __doctest_requires__ = {('preview',): ['pyglet']} def _check_outpu...
b825405e3a007ce8e068e40ce1035339bfcc332f44ef1aea32ff3ff9f4a6f1e3
""" 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 typing import Any, Dict from...
c58000dc96dec8b0737b35ee535867697e27321a4a1515692e877ee5d1e77fd7
from typing import Any, Dict from sympy.core.compatibility import is_sequence from sympy.external import import_module from sympy.printing.printer import Printer import sympy from functools import partial from sympy.utilities.decorator import doctest_depends_on from sympy.utilities.exceptions import SymPyDeprecationW...
fb43f36575a5cd0cdc042c6cd17ccd03d21d4aaa8d44687c2094b017fafbd616
"""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...
64440b9b0cc82ea26250bb50a30e3e552d713680d1bb9b7366815df1fc6d8554
""" Integral Transforms """ from functools import reduce from sympy import (symbols, Wild, RootSum, Lambda, together, exp, gamma) from sympy.core import S from sympy.core.compatibility import iterable, ordered from sympy.core.function import Function from sympy.core.relational import _canonical, Ge, Gt from sympy....
988c9b8ed9f4c6c1d80f785fde46045b840844201f5835973711efd32d0ce1f1
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...
d4a4c6a0bcf7b4d909a11ac58706273ab311a5788a2d61d3d5daed49a58076d4
""" 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...
7d0341c64de7f98631931ffe13a1c8d69099af4c98f2416a2ebd2882c546bfd0
""" 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...
ec9d38993cb335edef7b634b8f1dd009e240524c27e6902f3bb4637c70edec39
""" 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...
9e7c1d4f84ded3bb1ac57797d80a909a1936ef7084db9c98ffb86fba81610d8a
"""Base class for all the objects in SymPy""" from collections import defaultdict from collections.abc import Mapping from itertools import chain, zip_longest from .assumptions import BasicMeta, ManagedProperties from .cache import cacheit from .sympify import _sympify, sympify, SympifyError from .compatibility import...
cbca2d6a7dd66b95c5c4953cf394d2c4f679f4d3d88c7b010c73464ce30db675
from typing import Callable 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, _mexpand) from .logic import f...
6d70279ca730540a6aa5e7f79758c1bc4014e1e0f8b44cc5e6d1437a80652390
"""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 ...
105c98329896068c004d3d2a0cc55bcccf24d5a6e45f1c2a07c793c1e33887e9
""" 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...
a94296775db819ff3e940aaacc69428c28de7cb68bedefb36a3c909e5894e197
""" Module to efficiently partition SymPy objects. This system is introduced because class of SymPy object does not always represent the mathematical classification of the entity. For example, ``Integral(1, x)`` and ``Integral(Matrix([1,2]), x)`` are both instance of ``Integral`` class. However the former is number an...
ac582cfd87cff0046a05746cb3de06292f4afd531eb682d87c813efcbb72455b
import os USE_SYMENGINE = os.getenv('USE_SYMENGINE', '0') USE_SYMENGINE = USE_SYMENGINE.lower() in ('1', 't', 'true') # type: ignore if USE_SYMENGINE: from symengine import (Symbol, Integer, sympify, S, SympifyError, exp, log, gamma, sqrt, I, E, pi, Matrix, sin, cos, tan, cot, csc, sec, asin, acos...
a2a3ce8749ec9170598076055a586aa2d45ff9f5936d4db4dd9e123446cdf723
from collections import defaultdict from functools import cmp_to_key, reduce from operator import attrgetter from .basic import Basic from .compatibility import is_sequence from .parameters import global_parameters from .logic import _fuzzy_group, fuzzy_or, fuzzy_not from .singleton import S from .operations import Ass...
2311e2b3a1f22cd6e081d26cfbac10096c1b8b70c4576f999e461db7d4f4a5b6
from typing import Tuple as tTuple from collections.abc import Iterable from functools import reduce 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_arg...
88789b559c2561004b1fa1156a638667f5e25fbc9b483580622018b452754a69
import numbers import decimal import fractions import math import re as regex import sys 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...
f4c9feab407d837c3cecd92b7942d72b0155218f11a039bb0c66ef1b5cd26ec0
from operator import attrgetter from typing import Tuple, Type from collections import defaultdict from sympy.utilities.exceptions import SymPyDeprecationWarning from sympy.core.sympify import _sympify as _sympify_, sympify from sympy.core.basic import Basic from sympy.core.cache import cacheit from sympy.core.compat...
2d4757611eaef528b229a6720df21d90a04c024910dcf96b3fe5233bf4a5e08a
from sympy.core.assumptions import StdFactKB, _assume_defined from sympy.core.compatibility import is_sequence, ordered from .basic import Basic, Atom from .sympify import sympify from .singleton import S from .expr import Expr, AtomicExpr from .cache import cacheit from .function import FunctionClass from .kind import...
f3493212d1e2a8157a3d71a9349bfe8955b90fbeedfc684218de40b10dac044f
from collections import defaultdict from functools import cmp_to_key, reduce import operator from .sympify import sympify from .basic import Basic from .singleton import S from .operations import AssocOp, AssocOpDispatcher from .cache import cacheit from .logic import fuzzy_not, _fuzzy_group from .expr import Expr fro...
17495ee1cccaf62e640808a5d27c7bb8f0bd03758b71b9c28c499eab20856f63
"""Tools for setting up printing in interactive sessions. """ import sys from sympy.external.importtools import version_tuple from io import BytesIO from sympy import latex as default_latex from sympy import preview from sympy.utilities.misc import debug from sympy.printing.defaults import Printable def _init_pytho...
a5fb84079e04ee7b554853f2a003ff32aa1879ddb0e2b0fbe00852eef970dc48
"""Tools for setting up interactive sessions. """ from sympy.external.importtools import version_tuple 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 = symb...
45893d30d6b076a4a8c9952600541e1e35a200f04f3b5142c58a30406d06640f
"""Algorithms for computing symbolic roots of polynomials. """ import math from functools import reduce from sympy.core import S, I, pi from sympy.core.compatibility import ordered from sympy.core.exprtools import factor_terms from sympy.core.function import _mexpand from sympy.core.logic import fuzzy_not from sympy...
8b8bb29b91a9d3afe707fcaf120ebf2e1330765a72e62e73f8e14078fa4c3bd7
"""Sparse polynomial rings. """ from typing import Any, Dict from operator import add, mul, lt, le, gt, ge from functools import reduce from types import GeneratorType from sympy.core.compatibility import is_sequence from sympy.core.expr import Expr from sympy.core.numbers import igcd, oo from sympy.core.symbol imp...
91a5f491e00f7f07c3588b2286166bcb75449491d2f176e75eca1cdd8dc01ebb
"""Groebner bases algorithms. """ from sympy.core.symbol import Dummy from sympy.polys.monomials import monomial_mul, monomial_lcm, monomial_divides, term_div from sympy.polys.orderings import lex from sympy.polys.polyerrors import DomainError from sympy.polys.polyconfig import query def groebner(seq, ring, method=N...
7ffbf994d7d64dde21d2b41f3b57072656b7dc1d9aef270a25935db86a20c09e
""" This module contains functions for two multivariate resultants. These are: - Dixon's resultant. - Macaulay's resultant. Multivariate resultants are used to identify whether a multivariate system has common roots. That is when the resultant is equal to zero. """ from sympy import IndexedBase, Matrix, Mul, Poly fr...
0d87450c6c1fda0cb2cc388b1a66d25520083feeb85c5366f3e360a6346d9992
"""Polynomial factorization routines in characteristic zero. """ 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.polys.densebasic import ( dup_LC, dmp_LC, dmp_gr...
bba87a9dd058f5b5b0218f4fd78a821244c580dc56d2fe80e3619f257ec1128f
""" 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...
26582d8cff8ed41ee9c85ea7b3db032d56bb0cb0a6d57f9e853589f43b28b1c5
from sympy import S, Rational, gcd, sqrt, sign, symbols, Complement from sympy.core import Basic, Tuple, diff, expand, Eq, Integer from sympy.core.compatibility import ordered from sympy.core.symbol import _symbol from sympy.solvers import solveset, nonlinsolve, diophantine from sympy.polys import total_degree from sym...
738f4569b856885e167d552238246d9078ae566a5efe12b946fae6b1a62e5f85
"""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...
647f0bdae53a4d56dae39e8edba64b21e1229520d8369409dec62920a91d9e8c
"""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 ...
014ce3bf32e6b4b3b05b6a47eec271eae5946ff22e4498ee5b62bd02d9bf4af0
"""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...
a6b692e90687653e64236c3f9cdc932dc0ddb4007776fe3261e1af163e063015
"""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...
e611f96a2e09c98ed78f2bdc7403407f3063413e7db1c9a9378fc17cbe78f6ae
""" 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...
e3f71eaeec835a78ff93a9b477743a79473656eea2bfc83955f446664da7f1fd
"""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 from sympy.assumptions.ask im...
8afcaf2b51bd2d5247814119fda9857cfdba8cb700ff809f63c813ab5978ee95
"""Known matrices related to physics""" from sympy import Matrix, I, pi, sqrt from sympy.functions import exp from sympy.core.decorators import deprecated def msigma(i): r"""Returns a Pauli matrix `\sigma_i` with ``i=1,2,3``. References ========== .. [1] https://en.wikipedia.org/wiki/Pauli_matrices...
c8baeb90733cf98e92764cd7b2ff7f83dbb3d448398f69346d6b256d342de75c
""" Second quantization operators and states for bosons. This follow the formulation of Fetter and Welecka, "Quantum Theory of Many-Particle Systems." """ from collections import defaultdict from sympy import (Add, Basic, cacheit, Dummy, Expr, Function, I, KroneckerDelta, Mul, Pow, S, sqrt, Symbol,...
3184316805ebab19ad747bff6469300ecaeec010f1cadd7685a318cebabbe7c1
""" 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...
b48ff403ba532ca3b19d79cf2b6874b1c03bee4fbba4a3a04222186413a61625
"""Module with functions operating on IndexedBase, Indexed and Idx objects - Check shape conformance - Determine indices in resulting expression etc. Methods in this module could be implemented by calling methods on Expr objects instead. When things stabilize this could be a useful refactori...
07d39ff301f2f7cbb1572c10f8966162b6ecaf9d4d6ea74a2d6e32f17030a789
r"""Module that defines indexed objects The classes ``IndexedBase``, ``Indexed``, and ``Idx`` represent a matrix element ``M[i, j]`` as in the following diagram:: 1) The Indexed class represents the entire indexed object. | ___|___ ' ' M[i, j]...
796e887808cb0726f48ef1c391336a7380a3628ccaedcf3a88487ffb53ece85e
from collections import OrderedDict 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): r...
51d78311e11686585af98b4df87b37377b9d33bf44dc7737189882323e104c2b
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 """ ### Funct...
5439befdcbf2e958c0202f530deca9047d672dd7a457b8fc28228b208a2ad149
""" 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.decorators import s...
bc13b5330ea876beddd596f4c7b4685362e651ebe14dc06ff16742346e49ccf8
"""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 ...
281f345fb1369e9fd46e56ade6c0810d19c86e39b75e83f52dac87511799d4b9
import random from sympy.core.basic import Basic from sympy.core.compatibility import is_sequence from sympy.core.symbol import Symbol from sympy.core.sympify import sympify from sympy.functions.elementary.trigonometric import cos, sin from sympy.simplify.simplify import simplify as _simplify from sympy.utilities.deco...
60cce0d44c5fe9f0d0ec64fbefc492c3d52bb5df4cae563b5eb85d926d6dfa69
import mpmath as mp from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.compatibility import ( Callable, NotIterable, as_int, is_sequence) from sympy.core.decorators import deprecated from sympy.core.expr import Expr from sympy.core.kind import _NumberKind, UndefinedKind from sympy.co...
8b3d6f03919d3108c705c324e162ffe3331e91c76970eab6ad223b3724090bf3
from types import FunctionType from collections import Counter from mpmath import mp, workprec from mpmath.libmp.libmpf import prec_to_dps from sympy.core.compatibility import default_sort_key from sympy.core.evalf import DEFAULT_MAXPREC, PrecisionExhausted from sympy.core.logic import fuzzy_and, fuzzy_or from sympy....
cca1d9efad9c9cb4b397df6ba282bff98c53c914f61f1524b38544fe47650cc7
from sympy.core.decorators import _sympifyit from sympy.core.parameters import global_parameters from sympy.core.logic import fuzzy_bool from sympy.core.singleton import S from sympy.core.sympify import _sympify from .sets import Set class PowerSet(Set): r"""A symbolic object representing a power set. Param...
0740eb5ac084c4e91d700adbd3795f028e0c1a678633ee74cc7a81c6a66b814b
from functools import reduce from itertools import product from sympy.core.basic import Basic from sympy.core.containers import Tuple from sympy.core.expr import Expr from sympy.core.function import Lambda from sympy.core.logic import fuzzy_not, fuzzy_or, fuzzy_and from sympy.core.numbers import oo from sympy.core.rel...
17fd25c62dda346bdf7c2738ad341f212b52f00fe0125ce16e278d3f28545de8
from typing import Optional from collections import defaultdict import inspect from sympy.core.basic import Basic from sympy.core.compatibility import iterable, ordered, reduce from sympy.core.containers import Tuple from sympy.core.decorators import (deprecated, sympify_method_args, sympify_return) from sympy.co...
36ec0dcbd32d8024334a1c8b9803b540a9af54b1b7d6a6b88e92af7a77fb7263
from sympy import S from sympy.core.basic import Basic from sympy.core.containers import Tuple from sympy.core.function import Lambda from sympy.core.logic import fuzzy_bool from sympy.core.relational import Eq from sympy.core.symbol import Dummy from sympy.core.sympify import _sympify from sympy.logic.boolalg import A...
86cd3cde6407543cb61d13ac2139f071ab424eb562c61db6cea470428796a687
"""Plotting module for Sympy. A plot is represented by the ``Plot`` class that contains a reference to the backend and a list of the data series to be plotted. The data series are instances of classes meant to simplify getting points and meshes from sympy expressions. ``plot_backends`` is a dictionary with all the bac...
789f4515c25ae410f3a62de62ff9b3cbf5b40185924a6a9d25b27fc787ce3db0
""" rewrite of lambdify - This stuff is not stable at all. It is for internal use in the new plotting module. It may (will! see the Q'n'A in the source) be rewritten. It's completely self contained. Especially it does not use lambdarepr. It does not aim to replace the current lambdify. Most importantly it will never...
8cbcac36ffed32882ea6a6724e100aa2f446792b0392db5c442adf4bb68b77a0
from sympy import (S, Symbol, Interval, binomial, nan, exp, Or, symbols, Eq, cos, And, Tuple, integrate, oo, sin, Sum, Basic, Indexed, DiracDelta, Lambda, log, pi, FallingFactorial, Rational, Matrix) from sympy.stats import (Die, Normal, Exponential, FiniteRV, P, E, H, variance, density, given, ...
7238a0fa2665b7e36916ae4cee7bf7e74b551ad9b851adcee2a4a74daa3a9e0b
from sympy import ( Abs, And, binomial, Catalan, combsimp, cos, Derivative, E, Eq, exp, EulerGamma, factorial, Function, harmonic, I, Integral, KroneckerDelta, log, nan, oo, pi, Piecewise, Product, product, Rational, S, simplify, Identity, sin, sqrt, Sum, summation, Symbol, symbols, sympify, zeta, gamma...
45527a8de6b578458348b7f679db604ec015a4f9ffab260bddec8a324b0e2e36
# This testfile tests SymPy <-> NumPy compatibility # Don't test any SymPy features here. Just pure interaction with NumPy. # Always write regular SymPy tests for anything, that can be tested in pure # Python (without numpy). Here we test everything, that a user may need when # using SymPy with NumPy from sympy.extern...
0b7ea027193a369ec14d5787ff4e686db8602cddba8597896ec6914fb5222968
from sympy import sin, cos, exp, E, series, oo, S, Derivative, O, Integral, \ Function, PoleError, log, sqrt, N, Symbol, Subs, pi, symbols, atan, LambertW, Rational from sympy.abc import x, y, n, k from sympy.testing.pytest import raises from sympy.series.gruntz import calculate_series def test_sin(): e1 = si...
9573358d4f4fdc3af229a1c2838dc5a82f0937f959982652163aaaa8def1011a
from itertools import product from sympy import ( limit, exp, oo, log, sqrt, Limit, sin, floor, cos, ceiling, sinh, atan, Abs, gamma, Symbol, S, pi, Integral, Rational, I, E, besselj, tan, cot, integrate, Sum, sign, Function, subfactorial, symbols, binomial, simplify, frac, Float, sec, zoo, fresnelc, f...
00acaf00124dc7a9615b266a112ea02e28ebeb63061ec8c08f4d05b958088a1a
from sympy import ( sqrt, root, Symbol, sqrtdenest, Integral, cos, Rational, I, Integer, Mul) from sympy.simplify.sqrtdenest import ( _subsets as subsets, _sqrt_numeric_denest) r2, r3, r5, r6, r7, r10, r15, r29 = [sqrt(x) for x in (2, 3, 5, 6, 7, 10, 15, 29)] def tes...
94ce190ff0bfc907a226d470d538b40d8e75bc6ec6ce125e39d0c25c02f68b5c
from random import randrange from sympy.simplify.hyperexpand import (ShiftA, ShiftB, UnShiftA, UnShiftB, MeijerShiftA, MeijerShiftB, MeijerShiftC, MeijerShiftD, MeijerUnShiftA, MeijerUnShiftB, MeijerUnShiftC, MeijerUnShiftD, Re...
71a81295db550283a82f5ebb3fc659c75edc4be94ece0d7c895ddb7421d71fe8
from sympy import ( Abs, acos, Add, asin, atan, Basic, binomial, besselsimp, cos, cosh, count_ops, csch, diff, E, Eq, erf, exp, exp_polar, expand, expand_multinomial, factor, factorial, Float, Function, gamma, GoldenRatio, hyper, hypersimp, I, Integral, integrate, KroneckerDelta, log, logcombine, Lt...
cd72f410e4b174e730c5d03e99c916e22659fec5ae0ec7fd544308aa40809edc
from sympy import symbols, re, im, sign, I, Abs, Symbol, \ cos, sin, sqrt, conjugate, log, acos, asin, E, pi, \ Matrix, diff, integrate, trigsimp, S, Rational from sympy.algebras.quaternion import Quaternion from sympy.testing.pytest import raises w, x, y, z = symbols('w:z') phi = symbols('phi') def test_qu...
79193c27f86dfdfd83168f7638ddbe484137fcbd3805d794c668dbbd173b1b83
""" This module implements some special functions that commonly appear in combinatorial contexts (e.g. in power series); in particular, sequences of rational numbers such as Bernoulli and Fibonacci numbers. Factorials, binomial coefficients and related functions are located in the separate 'factorials' module. """ fr...
6b43f2ec8a8fd443a7ab9aa8e8d30972eb971dee71fa4ae63a015328e521a19b
from typing import List from functools import reduce from sympy.core import S, sympify, Dummy, Mod from sympy.core.cache import cacheit from sympy.core.compatibility import HAS_GMPY from sympy.core.function import Function, ArgumentIndexError, PoleError from sympy.core.logic import fuzzy_and from sympy.core.numbers im...
8b51f4f35053d4174ab772d36c920e438db264174211f0432a3da0ca57a67675
from sympy.core import sympify from sympy.core.add import Add from sympy.core.cache import cacheit from sympy.core.function import ( Function, ArgumentIndexError, _coeff_isneg, expand_mul, FunctionClass, PoleError) from sympy.core.logic import fuzzy_and, fuzzy_not, fuzzy_or from sympy.core.mul import Mul from s...
7bb9360c272cb59b2d32e8309c94e7b294f0cb584ad2b3350263b66db96839c5
from sympy.core.logic import FuzzyBool from sympy.core import S, sympify, cacheit, pi, I, Rational from sympy.core.add import Add from sympy.core.function import Function, ArgumentIndexError, _coeff_isneg from sympy.functions.combinatorial.factorials import factorial, RisingFactorial from sympy.functions.elementary.ex...
e667660dfb17eb6560e20b3706611a446d49436233f71a1b8844b9109497ae94
from sympy.core import S, Add, Mul, sympify, Symbol, Dummy, Basic from sympy.core.expr import Expr from sympy.core.exprtools import factor_terms from sympy.core.function import (Function, Derivative, ArgumentIndexError, AppliedUndef) from sympy.core.logic import fuzzy_not, fuzzy_or from sympy.core.numbers import pi...
0e8d3cc039d50114e5897af8032097ee8ed8430dbcc45ce6cbb4c0c91d659ab1
"""Hypergeometric and Meijer G-functions""" from functools import reduce from sympy.core import S, I, pi, oo, zoo, ilcm, Mod from sympy.core.function import Function, Derivative, ArgumentIndexError from sympy.core.containers import Tuple from sympy.core.mul import Mul from sympy.core.symbol import Dummy from sympy.f...
08c15f9c138bec036ac441490afc8c290b8092a3d9ceca2ded04e2e2b2c97c46
from sympy.core import Add, S, sympify, oo, pi, Dummy, expand_func from sympy.core.compatibility import as_int from sympy.core.function import Function, ArgumentIndexError from sympy.core.logic import fuzzy_and, fuzzy_not from sympy.core.numbers import Rational from sympy.core.power import Pow from sympy.functions.spec...
aa803e769c8970409fe846d33c4e3047120dc7c96b771bcf1a6245c76c150ce0
from sympy.core import S, sympify, diff from sympy.core.decorators import deprecated from sympy.core.function import Function, ArgumentIndexError from sympy.core.logic import fuzzy_not from sympy.core.relational import Eq, Ne from sympy.functions.elementary.complexes import im, sign from sympy.functions.elementary.piec...
1627a7dc6086a3ee8a9d2e4fa1a85dc6cf08b4263eb218baab1c7f0c0bcf3e3c
from sympy import pi, I from sympy.core import Dummy, sympify from sympy.core.function import Function, ArgumentIndexError from sympy.core.singleton import S from sympy.functions import assoc_legendre from sympy.functions.combinatorial.factorials import factorial from sympy.functions.elementary.complexes import Abs fro...
9f1297cf00cb62f74a53a1046a67e0bf1b49032cd73f3127cebefd699ba9848f
from functools import wraps from sympy import Add, S, pi, I, Rational, Wild, cacheit, sympify from sympy.core.function import Function, ArgumentIndexError, _mexpand from sympy.core.logic import fuzzy_or, fuzzy_not from sympy.core.power import Pow from sympy.functions.combinatorial.factorials import factorial from symp...
9461fa43e1538a6bc66f31be158077c556c6d29889472e2e4b8ccca4348ec2d6
from sympy.core import S, Integer from sympy.core.compatibility import SYMPY_INTS from sympy.core.function import Function from sympy.core.logic import fuzzy_not from sympy.core.mul import prod from sympy.utilities.iterables import (has_dups, default_sort_key) ##########################################################...
82d75509e785bcae68b879c2528c20daa4e87a2b96b20c7506ca6434f82fd85c
""" Elliptic Integrals. """ from sympy.core import S, pi, I, Rational from sympy.core.function import Function, ArgumentIndexError from sympy.functions.elementary.complexes import sign from sympy.functions.elementary.hyperbolic import atanh from sympy.functions.elementary.miscellaneous import sqrt from sympy.functions...
48fdeb6205cb8aed342a3809bc5ec02173799c34542017d4342f714dcaa0edc4
""" This module contains various functions that are special cases of incomplete gamma functions. It should probably be renamed. """ from sympy.core import Add, S, sympify, cacheit, pi, I, Rational from sympy.core.function import Function, ArgumentIndexError from sympy.core.symbol import Symbol from sympy.functions...
8fc7dc45a9c918214e296b953425be29e4284e405ea694e8b45cd95424e7c7c5
from sympy import AccumBounds, Symbol, floor, nan, oo, zoo, E, symbols, \ ceiling, pi, Rational, Float, I, sin, exp, log, factorial, frac, Eq, \ Le, Ge, Gt, Lt, Ne, sqrt, S from sympy.core.expr import unchanged from sympy.testing.pytest import XFAIL x = Symbol('x') i = Symbol('i', imaginary=True) y = ...
94a59eda540a33cdfbf65a63ba8c8748fec97de17728d0e5663ca6ef180be2b9
from itertools import product from sympy import (jn, yn, symbols, Symbol, sin, cos, pi, S, jn_zeros, besselj, bessely, besseli, besselk, hankel1, hankel2, hn1, hn2, expand_func, sqrt, sinh, cosh, diff, series, gamma, hyper, I, O, oo, conjugate, uppergamma, exp, ...
07f000d2ed2ca10f4789c2c53acc151de0a8a0d69c0ce11539cba8a381b712e3
from sympy.core.add import Add from sympy.core.assumptions import check_assumptions from sympy.core.containers import Tuple from sympy.core.compatibility import as_int, is_sequence, ordered from sympy.core.exprtools import factor_terms from sympy.core.function import _mexpand from sympy.core.mul import Mul from sympy.c...
a4a363aa0fe7fdb0ec9d90e832bd43af52fb8c83dfe97af7453af28fd36acfda
r""" This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper functions that it uses. :py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations. See the docstring on the various functions for their uses. Note that partial differential equations support is in ``pde.py``. Note t...
fa9c3e3f4ab7bdc2dd3e0c78beec152f096ab05d5018efcacb54dbacff4b278f
# # This is the module for ODE solver classes for single ODEs. # import typing if typing.TYPE_CHECKING: from typing import ClassVar from typing import Dict, Type, Iterator, List, Optional from .riccati import match_riccati, solve_riccati from sympy.core import Add, S, Pow, Rational from sympy.core.exprtools impor...
ff04c510586f2cbae0b40f0fd8b8d44b86261da49bee0bc4e2f7ff6fb2e34a10
r""" This module contains :py:meth:`~sympy.solvers.ode.riccati.solve_riccati`, a function which gives all rational particular solutions to first order Riccati ODEs. A general first order Riccati ODE is given by - .. math:: y' = b_0(x) + b_1(x)w + b_2(x)w^2 where `b_0, b_1` and `b_2` can be arbitrary rational function...
faf0fc059cdc5ce98ac2844aaffc5d4ae27e0213206bcbf69f43de5a15736d50
r""" This File contains helper functions for nth_linear_constant_coeff_undetermined_coefficients, nth_linear_euler_eq_nonhomogeneous_undetermined_coefficients, nth_linear_constant_coeff_variation_of_parameters, and nth_linear_euler_eq_nonhomogeneous_variation_of_parameters. All the functions in this file are used by m...
88334b8c1250f7f4696cb801534245bbe407b625f80cc2edf6637d646bf9bcb1
r''' This module contains the implementation of the 2nd_hypergeometric hint for dsolve. This is an incomplete implementation of the algorithm described in [1]. The algorithm solves 2nd order linear ODEs of the form .. math:: y'' + A(x) y' + B(x) y = 0\text{,} where `A` and `B` are rational functions. The algorithm sh...
6ce9aefac5f8e22ce1095c394d332bc380fcf3fa513b1b24ee39493a1ba2be08
from sympy.core.containers import Tuple from sympy.core.compatibility import ordered from sympy.core.function import (Function, Lambda, nfloat, diff) from sympy.core.mod import Mod from sympy.core.numbers import (E, I, Rational, oo, pi, Integer) from sympy.core.relational import (Eq, Gt, Ne, Ge) from sympy.core.singlet...
8741c813f4eda852c3969a9955a73a6da7399b930ecc1a7d0b4cf7ac15adfbbd
from sympy import ( Abs, And, Derivative, Dummy, Eq, Float, Function, Gt, I, Integral, LambertW, Lt, Matrix, Or, Poly, Q, Rational, S, Symbol, Ne, Wild, acos, asin, atan, atanh, binomial, cos, cosh, diff, erf, erfinv, erfc, erfcinv, exp, im, log, pi, re, sec, sin, sinh, solve, solve_linear, sqrt, ss...
36ffc66ef7c5df4673c5bd997e7cd4c8d3c3694c5275a109f377b388841b1ae1
"""Tests for solvers of systems of polynomial equations. """ from sympy import (flatten, I, Integer, Poly, QQ, Rational, S, sqrt, solve, symbols) from sympy.abc import x, y, z from sympy.polys import PolynomialError from sympy.solvers.polysys import (solve_poly_system, solve_triangulated, solve_biquadratic, So...
cf56fa20f71a4d575a7cded9c6883d5584736999502b23d8667265ed4bc8b004
from textwrap import dedent from itertools import islice, product from sympy import ( symbols, Integer, Integral, Tuple, Dummy, Basic, default_sort_key, Matrix, factorial, true) from sympy.combinatorics import RGS_enum, RGS_unrank, Permutation from sympy.core.compatibility import iterable from sympy.utilities....
5d4f5f9307ed05e7a254c2b02d3d7e5ec48fe13249b1cd2f527b78ab07dc36a3
import itertools from sympy.core import S from sympy.core.containers import Tuple from sympy.core.function import _coeff_isneg from sympy.core.mul import Mul from sympy.core.numbers import Number, Rational from sympy.core.power import Pow from sympy.core.symbol import Symbol from sympy.core.sympify import SympifyError...
d447497015b9d86f04c2c9630daf543bd7fe170123c95be808dd0cea8426824d
from sympy.codegen import Assignment from sympy.codegen.ast import none from sympy.codegen.cfunctions import expm1, log1p from sympy.codegen.scipy_nodes import cosm1 from sympy.codegen.matrix_nodes import MatrixSolve from sympy.core import Expr, Mod, symbols, Eq, Le, Gt, zoo, oo, Rational, Pow from sympy.core.numbers i...
1cadf32f6de810c2918d5f9fd3139566f1ebf04bf5b91738543aa9e480bbdcda
from sympy import (Add, Abs, Catalan, cos, Derivative, E, EulerGamma, exp, factorial, factorial2, Function, GoldenRatio, TribonacciConstant, I, Integer, Integral, Interval, Lambda, Limit, Matrix, nan, O, oo, pi, Pow, Rational, Float, Rel, S, sin, SparseMatrix, sqrt, summation, Sum, Symbol, symbols, Wild...
c93be3b1c013ee4a4227c394babb8b584ca708539ea1714fd41af8998f08d132
from sympy.core import ( S, pi, oo, symbols, Rational, Integer, Float, Mod, GoldenRatio, EulerGamma, Catalan, Lambda, Dummy, Eq, nan, Mul, Pow, UnevaluatedExpr ) from sympy.functions import ( Abs, acos, acosh, asin, asinh, atan, atanh, atan2, ceiling, cos, cosh, erf, erfc, exp, floor, gamma, log, loggam...
03287f9d0855cc5b20698791d443df67135e2fbd641f08d522523ee4c463578c
from sympy import (Symbol, symbols, oo, limit, Rational, Integral, Derivative, log, exp, sqrt, pi, Function, sin, Eq, Ge, Le, Gt, Lt, Ne, Abs, conjugate, I, Matrix) from sympy.printing.python import python from sympy.testing.pytest import raises, XFAIL, skip from sympy.parsing.latex import parse_latex from s...
1b86cf700e57cf7b0bd07b416c903df14fa3475e860d1c30a9672c06fe04fbf6
""" Important note on tests in this module - the Theano printing functions use a global cache by default, which means that tests using it will modify global state and thus not be independent from each other. Instead of using the "cache" keyword argument each time, this module uses the theano_code_ and theano_function_ ...
ab79f244c6081cf274bb758ffb5b5c46c3f74697ba64c51f6668cfd998569769
from sympy.external import import_module from sympy.testing.pytest import raises import ctypes if import_module('llvmlite'): import sympy.printing.llvmjitcode as g else: disabled = True import sympy from sympy.abc import a, b, n # copied from numpy.isclose documentation def isclose(a, b): rtol = 1e-5 ...
599ec83874efa2aa5dd1be0058da6596c2e520e2f896c1393ec0dbc61f897d11
""" Parser for FullForm[Downvalues[]] of Mathematica rules. This parser is customised to parse the output in MatchPy rules format. Multiple `Constraints` are divided into individual `Constraints` because it helps the MatchPy's `ManyToOneReplacer` to backtrack earlier and improve the speed. Parsed output is formatted ...
3addad737cd7c2ab60814e3ed57291485d13b35d9914b1a4eadf75d5a7d892af
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...
ab4a466039cd41825fb12d1cc32174ecccac985b22e370c6a323701ba69d2ffd
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, ...