hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
f541eb26b2033e101c36daab0dca97226f59f8287af56fe02863817c329dbaba | """Prime ideals in number fields. """
from sympy.polys.polytools import Poly
from sympy.polys.domains.finitefield import FF
from sympy.polys.domains.rationalfield import QQ
from sympy.polys.domains.integerring import ZZ
from sympy.polys.matrices.domainmatrix import DomainMatrix
from sympy.polys.polyerrors import Coerc... |
a4aebd32d11be4172b49653d13d8eda55c46844711fb95c1f3fa9ab69b241559 | r"""Modules in number fields.
The classes defined here allow us to work with finitely generated, free
modules, whose generators are algebraic numbers.
There is an abstract base class called :py:class:`~.Module`, which has two
concrete subclasses, :py:class:`~.PowerBasis` and :py:class:`~.Submodule`.
Every module is ... |
6005024471be6e5935aca9b7027ae48227a53c08a10a21a3b5d6573f23a9e1a2 | '''Functions returning normal forms of matrices'''
from collections import defaultdict
from .domainmatrix import DomainMatrix
from .exceptions import DMDomainError, DMShapeError
from sympy.ntheory.modular import symmetric_residue
from sympy.polys.domains import QQ, ZZ
# TODO (future work):
# There are faster algor... |
1d59e181b5d2708190f5aacea1fe1378cb08abb124f0e281d5885ba870656d5a | from sympy import QQ, ZZ
from sympy.abc import x, theta
from sympy.core.mul import prod
from sympy.ntheory import factorint
from sympy.ntheory.residue_ntheory import n_order
from sympy.polys import Poly, cyclotomic_poly
from sympy.polys.matrices import DomainMatrix
from sympy.polys.numberfields.basis import round_two
f... |
194e35eba8ff84c941db6b96c7122357f38df11b32be968decbcb778af3f9bc6 | from sympy.abc import x, zeta
from sympy.polys import Poly, cyclotomic_poly
from sympy.polys.domains import FF, QQ, ZZ
from sympy.polys.matrices import DomainMatrix, DM
from sympy.polys.numberfields.exceptions import (
ClosureFailure, MissingUnityError, StructureError
)
from sympy.polys.numberfields.modules import ... |
ff80a6dc42711e1dd3130176efcb81ed6419c1e15616cc778f4cdcd806458032 | from sympy.testing.pytest import raises
from sympy.core.symbol import Symbol
from sympy.polys.matrices.normalforms import (
invariant_factors, smith_normal_form,
hermite_normal_form, _hermite_normal_form, _hermite_normal_form_modulo_D)
from sympy.polys.domains import ZZ, QQ
from sympy.polys.matrices import Dom... |
95c4fcc3b9a7e94119f13fb17c0e13a86e0cb7b271634d281e1396ec9b4741f6 | from sympy.core.singleton import S
from sympy.core.symbol import symbols
from sympy.parsing.ast_parser import parse_expr
from sympy.testing.pytest import raises
from sympy.core.sympify import SympifyError
import warnings
def test_parse_expr():
a, b = symbols('a, b')
# tests issue_16393
assert parse_expr('a... |
67393297d360f766286a87317ee118668ca92fe4c139150bbae66e3402357441 | # -*- coding: utf-8 -*-
import sys
import builtins
import types
from sympy.assumptions import Q
from sympy.core import Symbol, Function, Float, Rational, Integer, I, Mul, Pow, Eq
from sympy.functions import exp, factorial, factorial2, sin, Min, Max
from sympy.logic import And
from sympy.series import Limit
from symp... |
e758c86d42a9a38ca4b04117df6537cf4322d80a7b9759ccdf62b2a1b2d071b1 | from sympy.testing.pytest import raises, XFAIL
from sympy.external import import_module
from sympy.concrete.products import Product
from sympy.concrete.summations import Sum
from sympy.core.add import Add
from sympy.core.function import (Derivative, Function)
from sympy.core.mul import Mul
from sympy.core.numbers impo... |
3fd815ba1cfe80492f6386a64130120a3d97d2d2b994b926245af30e66dc677d | from sympy import sin, Function, symbols, Dummy, Lambda, cos
from sympy.parsing.mathematica import parse_mathematica, MathematicaParser
from sympy.core.sympify import sympify
from sympy.abc import n, w, x, y, z
from sympy.testing.pytest import raises
def test_mathematica():
d = {
'- 6x': '-6*x',
'... |
6caaabfa4fc4bc61aef626be0d7610f45eabbe1f7a79f2463e04bfc2a395b7f0 | # Ported from latex2sympy by @augustt198
# https://github.com/augustt198/latex2sympy
# See license in LICENSE.txt
import sympy
from sympy.external import import_module
from sympy.printing.str import StrPrinter
from sympy.physics.quantum.state import Bra, Ket
from .errors import LaTeXParsingError
LaTeXParser = LaTeX... |
7fb2474bd313054eea41b8445da3a7f441833964af5b78a4fb53ef7236b9f38d |
# encoding: utf-8
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# Generated from ../LaTeX.g4, derived from latex2sympy
# latex2sympy is licensed under the MIT license
# https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
#
# Generated with antlr4
# antlr4 is licensed under th... |
3204246433c066e93a8f44602dcfd35a928be890ecdddbe4171cd5861e4a4860 |
# encoding: utf-8
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# Generated from ../LaTeX.g4, derived from latex2sympy
# latex2sympy is licensed under the MIT license
# https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
#
# Generated with antlr4
# antlr4 is licensed under th... |
250bc57e9e77316f1c261c4493236fb0c9a1843ec5567700923b86317bb91689 | from sympy.testing.pytest import warns_deprecated_sympy
from sympy.core.symbol import Symbol
from sympy.polys.polytools import Poly
from sympy.matrices import Matrix
from sympy.matrices.normalforms import (
invariant_factors,
smith_normal_form,
hermite_normal_form,
)
from sympy.polys.domains import ZZ, QQ
... |
c2d7564ec662096b089e0ef618b0849dd3c5802d011a42ca37c39f0eb521e284 | from sympy.assumptions.ask import ask, Q
from sympy.assumptions.refine import handlers_dict
from sympy.core import Basic, sympify, S
from sympy.core.mul import mul, Mul
from sympy.core.numbers import Number, Integer
from sympy.core.symbol import Dummy
from sympy.functions import adjoint
from sympy.strategies import (rm... |
1bf9da82f09a494cf0df9209113ad4d2cf6644493e776511c72938f34b753e81 | 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.common import ShapeError
from sympy.matrices.matrices import MatrixBa... |
cdc5c4f8a67becac19bcc83b9252da8e930e0765b64eb9f0f5cd2e6ef52df615 | 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... |
d02d0043201cc51055f616a0c0ece9188a76dd8401db2c51d85795abbb4c818f | #!/usr/bin/env python
"""Distutils based setup script for SymPy.
This uses Distutils (https://python.org/sigs/distutils-sig/) the standard
python mechanism for installing packages. Optionally, you can use
Setuptools (https://setuptools.readthedocs.io/en/latest/)
to automatically handle dependencies. For the easiest in... |
8be627a3d2102343d2d9953c4792b545a4988d0e7751c6c67841231e6853b4b4 | #!/usr/bin/env python
"""
Run tests for specific packages that use optional dependencies.
The optional dependencies need to be installed before running this.
"""
# Add the local sympy to sys.path (needed for CI)
from get_sympy import path_hack
path_hack()
class TestsFailedError(Exception):
pass
test_list = [... |
c4dd4c9a025ff219095642a11587860e773a5161a63f67c8d22d04eacb34704c | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tool to generate AUTHORS. We started tracking authors before moving to git,
so we have to do some manual rearrangement of the git history authors in order
to get the order in AUTHORS. bin/mailmap_check.py should be run before
committing the results.
See here for inst... |
bb96ce39018588416201d0a2574692da60f98a2eddf279a99d975057e4ea1125 | #!/usr/bin/env python
DESCRIPTION = """
Runs all the examples for testing purposes and reports successes and failures
to stderr. An example is marked successful if the running thread does not
throw an exception, for threaded examples, such as plotting, one needs to
check the stderr messages as well.
"""
EPILOG = """... |
b1523e1190d69073c0e1ba2b7ecf9af8176cfd5650e4d12536629b6961740a33 | #!/usr/bin/env python
"""
This script creates logos of different formats from the source "sympy.svg"
Requirements:
rsvg-convert - for converting to *.png format
(librsvg2-bin deb package)
imagemagick - for converting to *.ico favicon format
"""
from argparse import ArgumentParser
i... |
3145d702be8d1c29506bd3a64f8f2c36892da2dd4c8d7714f8cf166d12826569 | #!/usr/bin/env python3
import json
import subprocess
import sys
from os.path import join, splitext, basename
from contextlib import contextmanager
from tempfile import TemporaryDirectory
from zipfile import ZipFile
from shutil import copytree
def main(sympy_doc_git, doc_html_zip, version, dev_version, push=None):
... |
dd678be91edc94efc2cee8fa0979ec204903cff612bfaccf72926bb373d14008 | #!/usr/bin/env python3
from os.path import join, basename, normpath
from subprocess import check_call
def main(version, prevversion, outdir):
check_version(version, outdir)
run_stage(['bin/mailmap_check.py', '--update-authors'])
run_stage(['mkdir', '-p', outdir])
build_release_files('bdist_wheel', 'sy... |
cb6e5d3a4fa7feb5835c5cb611e2d3db31c468e3ec11ef66f8d000c72119d774 | #!/usr/bin/env python3
from subprocess import check_output
import sys
import os.path
def main(tarname, gitroot):
"""Run this as ./compare_tar_against_git.py TARFILE GITROOT
Args
====
TARFILE: Path to the built sdist (sympy-xx.tar.gz)
GITROOT: Path ro root of git (dir containing .git)
"""
... |
3351160974ecaeab96af2843d195868d696d6fd6588e6cebce84fb2a89b3e44e | __version__ = "1.12.dev"
|
6536826d843f093d06dcd03bd678ee31020eb1b55fa8a2960991ed18eb5149e6 | #
# SymPy documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 22 19:34:32 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are... |
ee0d543e6bcd66184f291491ea12ea7f4d6071fae60e576b76beaa06cf3ecfda | from __future__ import annotations
"""
Converts SVG images to PDF using chrome in case the builder does not
support SVG images natively (e.g. LaTeX).
"""
from sphinx.transforms.post_transforms.images import ImageConverter
from sphinx.util import logging
import os
import platform
from typing import Any # NOQA... |
1c6b826de46191c5ede71eec7c38d07094edbf6209e60a76c838a9ea4aaebf6b | """
Extract reference documentation from the NumPy source tree.
"""
import inspect
import textwrap
import re
import pydoc
from collections.abc import Mapping
import sys
class Reader:
"""
A line-based string reader.
"""
def __init__(self, data):
"""
Parameters
----------
... |
e3314d996e8686ed6fbe0cbe5bb0fd8690f75bca2eebc581c6517f96ff4b890f | import random
import itertools
from typing import (Sequence as tSequence, Union as tUnion, List as tList,
Tuple as tTuple, Set as tSet)
from sympy.concrete.summations import Sum
from sympy.core.add import Add
from sympy.core.basic import Basic
from sympy.core.cache import cacheit
from sympy.core.containers impo... |
1f920e1efd53cd0326f62645428d35b0758dd13703e6c584d5c6b6a6243cf686 | from math import prod
from sympy.core.basic import Basic
from sympy.core.numbers import pi
from sympy.core.singleton import S
from sympy.functions.elementary.exponential import exp
from sympy.functions.special.gamma_functions import multigamma
from sympy.core.sympify import sympify, _sympify
from sympy.matrices import... |
fb4c343b46e42cbf98a428e01fd2f6e8ead045e808149f3d4c88fa09ae22b898 | """
Main Random Variables Module
Defines abstract random variable type.
Contains interfaces for probability space object (PSpace) as well as standard
operators, P, E, sample, density, where, quantile
See Also
========
sympy.stats.crv
sympy.stats.frv
sympy.stats.rv_interface
"""
from functools import singledispatch... |
0dc8b194ed8c978827c0c9999365537a088756af3c0e42dd425393439ed242d7 | """
Joint Random Variables Module
See Also
========
sympy.stats.rv
sympy.stats.frv
sympy.stats.crv
sympy.stats.drv
"""
from math import prod
from sympy.core.basic import Basic
from sympy.core.function import Lambda
from sympy.core.singleton import S
from sympy.core.symbol import (Dummy, Symbol)
from sympy.core.sympif... |
7159f781927b29cabba3e958243633a77222c54ede0dfc367a7b3697dfdb1b5a | 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()
#----------------------------------------------------------------------------#
# ... |
661673c9d5beb63f23f195e6316e7f9cd89a9d25f3edbb53fc26af5bf6eec705 | 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... |
7c0dffa2f25c3eaaf04f66cf8e677871218f0f2546e8748cf683f4ec73f547fb | from functools import reduce
from math import prod
from sympy.core.numbers import igcdex, igcd
from sympy.ntheory.primetest import isprime
from sympy.polys.domains import ZZ
from sympy.polys.galoistools import gf_crt, gf_crt1, gf_crt2
from sympy.utilities.misc import as_int
def symmetric_residue(a, m):
"""Return... |
11dde6b69f32780554b6bfb22c881d5d6b60b4e2b1fb4bd58aef79559d81698f | """
Integer factorization
"""
from collections import defaultdict
from functools import reduce
import random
import math
from sympy.core import sympify
from sympy.core.containers import Dict
from sympy.core.evalf import bitcount
from sympy.core.expr import Expr
from sympy.core.function import Function
from sympy.core... |
7eee921718f600514a19456ebad9bcd0e5c07d4e1b6c30e1877c7b2e27484ad9 | from mpmath.libmp import (fzero, from_int, from_rational,
fone, fhalf, bitcount, to_int, to_str, mpf_mul, mpf_div, mpf_sub,
mpf_add, mpf_sqrt, mpf_pi, mpf_cosh_sinh, mpf_cos, mpf_sin)
from sympy.core.numbers import igcd
from .residue_ntheory import (_sqrt_mod_prime_power,
legendre_symbol, jacobi_symbol, is_... |
86a6c7ffcce2ef555311af87c8b7ea8b27e43a24eb852483532c8e2457d138d4 | from math import factorial as _factorial, log, prod
from itertools import chain, islice, product
from sympy.combinatorics import Permutation
from sympy.combinatorics.permutations import (_af_commutes_with, _af_invert,
_af_rmul, _af_rmuln, _af_pow, Cycle)
from sympy.combinatorics.util import (_check_cycles_alt_sym... |
36674ec455782d9d560c300712388ab40f667cc5bc6e7a2319bebcb0001d9a2c | from collections import deque
from sympy.combinatorics.rewritingsystem_fsm import StateMachine
class RewritingSystem:
'''
A class implementing rewriting systems for `FpGroup`s.
References
==========
.. [1] Epstein, D., Holt, D. and Rees, S. (1991).
The use of Knuth-Bendix methods to sol... |
6a75cca1b52b4f7835f3d2784a2c185705eadf37366c80e2a7560131df7c9aa7 | """
The Schur number S(k) is the largest integer n for which the interval [1,n]
can be partitioned into k sum-free sets.(http://mathworld.wolfram.com/SchurNumber.html)
"""
import math
from sympy.core import S
from sympy.core.basic import Basic
from sympy.core.function import Function
from sympy.core.numbers import Inte... |
17c5eb502dc27fcb6431cb1d2c7c4ef784a16ee159778c6c50e6b44dfb3a8997 | from sympy.combinatorics.permutations import Permutation, _af_rmul, \
_af_invert, _af_new
from sympy.combinatorics.perm_groups import PermutationGroup, _orbit, \
_orbit_transversal
from sympy.combinatorics.util import _distribute_gens_by_base, \
_orbits_transversals_from_bsgs
"""
References for tensor ... |
c856833c519ee58424b8f4e5875406e3885d828f612bfb540ed34b6a5b59a171 | from sympy.core import Basic, Dict, sympify, Tuple
from sympy.core.numbers import Integer
from sympy.core.sorting import default_sort_key
from sympy.core.sympify import _sympify
from sympy.functions.combinatorial.numbers import bell
from sympy.matrices import zeros
from sympy.sets.sets import FiniteSet, Union
from symp... |
0373b9975b64166175984aa269bd3c781711ea501d8aa289dae3daa3751cbe59 | from sympy.combinatorics.free_groups import free_group
from sympy.printing.defaults import DefaultPrinting
from itertools import chain, product
from bisect import bisect_left
###############################################################################
# COSET TABLE ... |
6d9774a5c743ff5148e0770c5ae01bfd91f1c5bcb8b0beb4cffabd693d28a50f | """Various algorithms for helping identifying numbers and sequences."""
from sympy.concrete.products import (Product, product)
from sympy.core import Function, S
from sympy.core.add import Add
from sympy.core.numbers import Integer, Rational
from sympy.core.symbol import Symbol, symbols
from sympy.core.sympify import... |
7120291813699363b49cb86370fc26e7dd0ee6da36f15725ddf57223ffbbfb8b | 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 ... |
fc5e45554cd560ba67e1feb59b760cef0356541523fe0477fd41ea0c8cd91f13 | """
Limits
======
Implemented according to the PhD thesis
http://www.cybertester.com/data/gruntz.pdf, which contains very thorough
descriptions of the algorithm including many examples. We summarize here
the gist of it.
All functions are sorted according to how rapidly varying they are at
infinity using the followin... |
52a58c1c62ede62682f6aa5cd8579a994edf7f6bdd087c1ee99ce3f58f1079f3 | from sympy.calculus.accumulationbounds import AccumBounds
from sympy.core import S, Symbol, Add, sympify, Expr, PoleError, Mul
from sympy.core.exprtools import factor_terms
from sympy.core.numbers import Float, _illegal
from sympy.functions.combinatorial.factorials import factorial
from sympy.functions.elementary.compl... |
773568e1567c3a40fd6126c111842e769707704755306ecb7e72114cc7782f38 | """Fourier Series"""
from sympy.core.numbers import (oo, pi)
from sympy.core.symbol import Wild
from sympy.core.expr import Expr
from sympy.core.add import Add
from sympy.core.containers import Tuple
from sympy.core.singleton import S
from sympy.core.symbol import Dummy, Symbol
from sympy.core.sympify import sympify
f... |
0ad473893508b4077c1bdcfffe327db3b75120700e75e1da8dd3e6341dc74606 | """Formal Power Series"""
from collections import defaultdict
from sympy.core.numbers import (nan, oo, zoo)
from sympy.core.add import Add
from sympy.core.expr import Expr
from sympy.core.function import Derivative, Function, expand
from sympy.core.mul import Mul
from sympy.core.numbers import Rational
from sympy.cor... |
0d6988bd85ad13b4c9279d3f1361752b5c34e9169265412112d962e8f5b55aca | """
Expand Hypergeometric (and Meijer G) functions into named
special functions.
The algorithm for doing this uses a collection of lookup tables of
hypergeometric functions, and various of their properties, to expand
many hypergeometric functions in terms of special functions.
It is based on the following paper:
... |
4e6142c107c291e83a463672f392a400fc1fc996e9bf06cc0fc4afa3ee729a6a | from collections import defaultdict
from sympy import SYMPY_DEBUG
from sympy.core import sympify, S, Mul, Derivative, Pow
from sympy.core.add import _unevaluated_Add, Add
from sympy.core.assumptions import assumptions
from sympy.core.exprtools import Factors, gcd_terms
from sympy.core.function import _mexpand, expand... |
ca7b883f2f458da83975afb8dd61563dc2afb9ab5d0e36d80123c9739947d60d | from sympy.core import Add, Expr, Mul, S, sympify
from sympy.core.function import _mexpand, count_ops, expand_mul
from sympy.core.sorting import default_sort_key
from sympy.core.symbol import Dummy
from sympy.functions import root, sign, sqrt
from sympy.polys import Poly, PolynomialError
def is_sqrt(expr):
"""Ret... |
0448f6e449d832a83ef998403ebdd2169de0decf228acc44f89bc47e94fd860b | 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... |
90ec1ecab3fd5d4315c82ead5d2e2640652a47629dfc710f5214de984be6fdca | from sympy.core import Function, S, Mul, Pow, Add
from sympy.core.sorting import ordered, default_sort_key
from sympy.core.function import expand_func
from sympy.core.symbol import Dummy
from sympy.functions import gamma, sqrt, sin
from sympy.polys import factor, cancel
from sympy.utilities.iterables import sift, uniq
... |
22c406f453b8ebbf2c23f70cc01c4d6fb791ee9effaa24bd5547a11d953857d4 | """ Tools for doing common subexpression elimination.
"""
from collections import defaultdict
from sympy.core import Basic, Mul, Add, Pow, sympify
from sympy.core.containers import Tuple, OrderedSet
from sympy.core.exprtools import factor_terms
from sympy.core.singleton import S
from sympy.core.sorting import ordered
... |
21a74b29aded6e24462031474dfaddb25c3dd19e33bee4af9aefa6802fce22b6 | from sympy.core.numbers import Rational
from sympy.core.singleton import S
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 sympy.functions.elementary.trigonometri... |
e6164b03a923732e7101e6262796c825eb4fb9e1a0d359a577447a5fd6ce03b1 | from typing import Any, Set as tSet
from functools import reduce
from itertools import permutations
from sympy.combinatorics import Permutation
from sympy.core import (
Basic, Expr, Function, diff,
Pow, Mul, Add, Lambda, S, Tuple, Dict
)
from sympy.core.cache import cacheit
from sympy.core.symbol import Symb... |
d79cdde67895e1d68b41b155d2bdb7f99da42c945cf75c53c421650a15ee5ea2 | """
The classes used here are for the internal use of assumptions system
only and should not be used anywhere else as these do not possess the
signatures common to SymPy objects. For general use of logic constructs
please refer to sympy.logic classes And, Or, Not, etc.
"""
from itertools import combinations, product, z... |
731d00f2832dc09c962a73fd90ed8a58ac6996fa55c478203c6c0c26f6c7c26b | from sympy.core.add import Add
from sympy.core.exprtools import factor_terms
from sympy.core.function import expand_log, _mexpand
from sympy.core.power import Pow
from sympy.core.singleton import S
from sympy.core.sorting import ordered
from sympy.core.symbol import Dummy
from sympy.functions.elementary.exponential imp... |
beefa9eef253f7152e05792df7ad1195e58faae551cfe0a24a783c9f03f40158 | r"""
This module is intended for solving recurrences or, in other words,
difference equations. Currently supported are linear, inhomogeneous
equations with polynomial or rational coefficients.
The solutions are obtained among polynomials, rational functions,
hypergeometric terms, or combinations of hypergeometric term... |
66603ccc548a39641bc06352f85df39b08d721e1c0d009e0e412d445f422de65 | """
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... |
15116711b0fb64939ccbcfaad4b67936f611b7816ee00bdfe577ba5e4ea95a8a | """
This module contains pdsolve() and different helper functions that it
uses. It is heavily inspired by the ode module and hence the basic
infrastructure remains the same.
**Functions in this module**
These are the user functions in this module:
- pdsolve() - Solves PDE's
- classify_pde() - Classif... |
e9d088a19a97f26173efb4a94f50ce33f239caf770535b543274db036be360c1 | """Utility functions for classifying and solving
ordinary and partial differential equations.
Contains
========
_preprocess
ode_order
_desolve
"""
from sympy.core import Pow
from sympy.core.function import Derivative, AppliedUndef
from sympy.core.relational import Equality
from sympy.core.symbol import Wild
def _pre... |
46300ad7a8f1ae51221dd1ca1aacf9e1c743e97ece49fa9f772ecc86c85c19fd | """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... |
9e88ba4cb81d06b3619b03e574148549041ad079fa9cfb4adcbc036cece8f3a9 | """Tools for solving inequalities and systems of inequalities. """
import itertools
from sympy.calculus.util import (continuous_domain, periodicity,
function_range)
from sympy.core import Symbol, Dummy, sympify
from sympy.core.exprtools import factor_terms
from sympy.core.relational import Relational, Eq, Ge, Lt
f... |
421379f956893d7db8ac1f0704d69d575406aeace54ec671905ea27b07766bb4 | """
This module contain solvers for all kinds of equations:
- algebraic or transcendental, use solve()
- recurrence, use rsolve()
- differential, use dsolve()
- nonlinear (numerically), use nsolve()
(you will need a good starting point)
"""
from sympy.core import (S, Add, Symbol, Dummy, Expr... |
1b059ce22a65a04ee8812f4b4ce9248ec8a3d666cf310c5b576fe9bcdae261b1 | from .cartan_type import CartanType
from sympy.core.basic import Atom
class RootSystem(Atom):
"""Represent the root system of a simple Lie algebra
Every simple Lie algebra has a unique root system. To find the root
system, we first consider the Cartan subalgebra of g, which is the maximal
abelian sub... |
5fba992791a61e51caa24514305a1a42aaea5f68cb46ae1bed6d86e5a5a7b733 | """
Finite difference weights
=========================
This module implements an algorithm for efficient generation of finite
difference weights for ordinary differentials of functions for
derivatives from 0 (interpolation) up to arbitrary order.
The core algorithm is provided in the finite difference weight generat... |
650ed7a17b794891ffb6b09dc61c1fd1d9d01ee26399a72641b37d8b6ec31909 | 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.relational import Relational
from sym... |
870af5ad92d9eca53d5df91b6790100ffab78a75d25b7f9c7ff3ec53ae01cf81 | """Module for compiling codegen output, and wrap the binary for use in
python.
.. note:: To use the autowrap module it must first be imported
>>> from sympy.utilities.autowrap import autowrap
This module provides a common interface for different external backends, such
as f2py, fwrap, Cython, SWIG(?) etc. (Curren... |
61b298e8270dfb0be3b20e77cd43cbd8199fbf26fad873385b8c63b6f3342f9b | """
This module provides convenient functions to transform SymPy expressions to
lambda functions which can be used to calculate numerical values very fast.
"""
from typing import Any, Dict as tDict
import builtins
import inspect
import keyword
import textwrap
import linecache
# Required despite static analysis claim... |
f8d4217fe45be611d2878aa3f9a57058ce30b9a60c60ad07005261dfc281f600 | 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 the... |
96b2d8e581d3f4d24c621cb149cfe243d641c593de3a52d92070eca65f4c6847 | 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... |
44caeab532cc47f87902b2ecf1421c2b805715f6dfb953b3c1b17bc1abaf9ee5 | """
Python code printers
This module contains Python code printers for plain Python as well as NumPy & SciPy enabled code.
"""
from collections import defaultdict
from itertools import chain
from sympy.core import S
from sympy.core.mod import Mod
from .precedence import precedence
from .codeprinter import CodePrinter
... |
a4ed5f8020ffe12fb90bc5d0248bde0f0be913ffc6ae692276b437f2d25e7ba6 | """
A Printer for generating readable representation of most SymPy classes.
"""
from typing import Any, Dict as tDict
from sympy.core import S, Rational, Pow, Basic, Mul, Number, Add
from sympy.core.mul import _keep_coeff
from sympy.core.relational import Relational
from sympy.core.sorting import default_sort_key
fro... |
c1adf6945e76e7800e3e76d5f45e4ebd04ddd473a4d2b7cdf8751e91c3751e62 | '''
Use llvmlite to create executable functions from SymPy expressions
This module requires llvmlite (https://github.com/numba/llvmlite).
'''
import ctypes
from sympy.external import import_module
from sympy.printing.printer import Printer
from sympy.core.singleton import S
from sympy.tensor.indexed import IndexedBa... |
534b127150e35342e1d521723de47c1a9a0e7b7fd7ad7d0f54cb1f177468316b | """
A Printer which converts an expression into its LaTeX equivalent.
"""
from __future__ import annotations
from typing import Any, Callable, TYPE_CHECKING
import itertools
from sympy.core import Add, Float, Mod, Mul, Number, S, Symbol, Expr
from sympy.core.alphabets import greeks
from sympy.core.containers import T... |
0bfe5c79f8497d3dd1272c31a9e979090be25180a45470c6cd8beeda6238cc78 | """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... |
042c78792746f0c43c652515d655847770b36d9e0888c89df934f13e857a1475 | from .pycode import (
PythonCodePrinter,
MpmathPrinter,
)
from .numpy import NumPyPrinter # NumPyPrinter is imported for backward compatibility
from sympy.core.sorting import default_sort_key
__all__ = [
'PythonCodePrinter',
'MpmathPrinter', # MpmathPrinter is published for backward compatibility
... |
91debb502e4d6085a28a9477cb2a2a8115958041ba3e52332c2a9da5389bc32b | from typing import Any, Dict as tDict, Set as tSet, Tuple as tTuple
from functools import wraps
from sympy.core import Add, Expr, Mul, Pow, S, sympify, Float
from sympy.core.basic import Basic
from sympy.core.expr import UnevaluatedExpr
from sympy.core.function import Lambda
from sympy.core.mul import _keep_coeff
fro... |
8bdd32900c49c7c5787fe6a960ad367c186105686877f212463b2348fe895537 | """
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... |
815887c3bcb9abfe945773184c707732368eea4e621056220f351c1f2a82f27a | from typing import Any, Dict as tDict
from sympy.external import import_module
from sympy.printing.printer import Printer
from sympy.utilities.iterables import is_sequence
import sympy
from functools import partial
aesara = import_module('aesara')
if aesara:
aes = aesara.scalar
aet = aesara.tensor
from ... |
5b427bf7c67105d9497ab71f7c11a73434e9ec9dad31d21842413f2888b28b7b | from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.symbol import Symbol
from sympy.core.numbers import Integer, Rational, Float
from sympy.printing.repr import srepr
__all__ = ['dotprint']
default_styles = (
(Basic, {'color': 'blue', 'shape': 'ellipse'}),
(Expr, {'color': 'bl... |
07e8c20064ef1ffbee1368cf5b75e6e3a98716e0c67f322e57e9a24b5ad1120c | 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 sympy.utilities.misc import debug
from .latex import latex
__doctest_requires__ = {('pre... |
b650e92af44fce269d8e569ddbfae1b88c844d21c0c665f1a89fa54c36f9ceb1 | """
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 as tD... |
3cc0a86a0184244da05c2741d7ea4bec37e51c0a3a9656f7e526718a8f749df7 | """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... |
05e814729516f7a158f5ff189f48c78cad0b8c290cdbc3670958394bd7135b05 | from sympy.functions import SingularityFunction, DiracDelta
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 whenever an
instance of Singularit... |
e199fddb8fef1f36a0905bcc2ca1dde669fb44d73c84103b5d973723b475c4cf | """ 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, Function, Lambda,
... |
49a92f770de6787746b96c8bdf795c5d9a14f979e705d13e5df9151f378d5b8c | """
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 homogene... |
11096cfafd85bd85ccfa969481a734e6d7741f9e6f17597f8f5e46ded5727b20 | from typing import Dict as tDict, List
from itertools import permutations
from functools import reduce
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, Symbol
from sympy.core.basic import sympify
from sympy.core.numbers import ... |
96b4b5d004deba766679f3843c334260f49b0e01087d8145ade1d1f043360331 | """
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... |
ca3321e84065fe9f5c507251bfea9b897074e94c30030cacff8e092ad86da4a1 | """
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... |
590e8057412e57da2abaf499ce2b33db37a4c3b4fb1127156e139701d6f89ed3 | from sympy.core import cacheit, Dummy, Ne, Integer, Rational, S, Wild
from sympy.functions import binomial, sin, cos, Piecewise, Abs
from .integrals import integrate
# 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 sl... |
2d84caadbc4593a4f43f315d891659fbb73159b7bcd533c5e9a3274e50d22b11 | """
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... |
237ee98e5f03220e75e0bf496caf6e8bee0dc8f35d989a3c288174da5c4656d7 | """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 .core import BasicMeta
from .sympify import _symp... |
62824d966b2846f3ade3e399608977bd20331f3286cae7e81568761b7b9b474a | 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, ... |
271eb776d6045b85a1bd6f3f37a18ae4b3c3526fedf2b9056eb16f7312043ed5 | """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 .sympify import sympify
from .numbers import Rational, Integer, Number, I
from .singleton import S
from .sorting import defa... |
16dbeeb638073ed49a33b2fb53ea0b8d68390141d7314902d638e9e52612f48b | 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... |
da96cfc463ad314db4a124b7061fd5d70df8cbf00bfc538f96a4048647a06354 | """
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: `... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.