hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
c3acd61cff7c611530f93e6913e9d075d9def10314ab96d2fc2a25d37b3b53c7 | from sympy.core.mul import Mul
from sympy.core.numbers import (I, Integer, Rational)
from sympy.core.singleton import S
from sympy.core.symbol import symbols
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.physics.quantum.anticommutator import AntiCommutator
from sympy.physics.quantum.commutator i... |
5277208d015e257dc139d1f2f1461b6ff2f08adebb09f36ec0b6856119b22942 | from sympy.core.numbers import I
from sympy.core.symbol import symbols
from sympy.core.expr import unchanged
from sympy.matrices import Matrix, SparseMatrix
from sympy.physics.quantum.commutator import Commutator as Comm
from sympy.physics.quantum.tensorproduct import TensorProduct
from sympy.physics.quantum.tensorpro... |
7e8add501482edc96f293b8a0ad6fe2a1ace194a27305d70fbdd46fa96b0cca9 | from sympy.core.function import expand_mul
from sympy.core.numbers import pi
from sympy.core.singleton import S
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.functions.elementary.trigonometric import (cos, sin)
from sympy.core.backend import Matrix, _simplify_matrix, eye, zeros
from sympy.core.sy... |
8ae1e89ae94117c31a7cb7a8aca19a2c750417c0af1615dcc44b4dd219356a43 | from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, LagrangesMethod, Particle,
inertia, Lagrangian)
from sympy.core.function import (Derivative, Function)
from sympy.core.numbers import pi
from sympy.core.symbol i... |
86bedbcc0503232137e7006aff6fd87362ffd66756fd795d0cc274c53cdcb4bb | from sympy.core.backend import sin, cos, tan, pi, symbols, Matrix, S
from sympy.physics.mechanics import (Particle, Point, ReferenceFrame,
RigidBody)
from sympy.physics.mechanics import (angular_momentum, dynamicsymbols,
inertia, inertia_of_point... |
6d39328f6566c472fb64ecd4d7f9465d06c703a31b80db3b4ce0e393ef898b38 | from sympy import solve
from sympy.core.backend import (cos, expand, Matrix, sin, symbols, tan, sqrt, S,
zeros, eye)
from sympy.simplify.simplify import simplify
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, Ka... |
61e6e9e8c85384810c8d28062d1bac31e95c87ab60a5bbdcbbe1281c00aea0fd | import warnings
from sympy.core.add import Add
from sympy.core.function import (Function, diff)
from sympy.core.numbers import (Number, Rational)
from sympy.core.singleton import S
from sympy.core.symbol import (Symbol, symbols)
from sympy.functions.elementary.complexes import Abs
from sympy.functions.elementary.expon... |
b24e1ab7212b0e58e86bd4386030d6a2e6c13b17e449747798a4e66003bfdaf1 | from sympy.core.numbers import pi
from sympy.core.symbol import symbols
from sympy.functions.elementary.trigonometric import (cos, sin)
from sympy.matrices.dense import (eye, zeros)
from sympy.matrices.immutable import ImmutableDenseMatrix as Matrix
from sympy.simplify.simplify import simplify
from sympy.physics.vector... |
06a3093bc9d1c078cc5b0eec0f82fe457aa035773044cebd9d6bbce564c72408 | from collections import Counter
from sympy.core import Mul, sympify
from sympy.core.add import Add
from sympy.core.expr import ExprBuilder
from sympy.core.sorting import default_sort_key
from sympy.functions.elementary.exponential import log
from sympy.matrices.common import ShapeError
from sympy.matrices.expressions.... |
fad693febef52dc9cfe4d4104236053aab6cdd8c6390d725043a53d7e28421fc | from sympy.matrices.dense import Matrix, eye
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
from sympy.matrices import ShapeError, Matrix... |
4988a289e754a407af4b423680143c2445ab8510661acbce0318c62cf45efe08 | from sympy.core.expr import unchanged
from sympy.core.numbers import oo
from sympy.core.relational import Eq
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.sets.contains import Contains
from sympy.sets.sets import (FiniteSet, Interval)
from sympy.testing.pytest import raises
def tes... |
df3dd68de37b4d3b251c97af86bdd7ffb1d11cf81495e6129e0bbadbce6547a9 | import pyglet.gl as pgl
from sympy.core import S
from sympy.plotting.pygletplot.color_scheme import ColorScheme
from sympy.plotting.pygletplot.plot_mode import PlotMode
from sympy.utilities.iterables import is_sequence
from time import sleep
from threading import Thread, Event, RLock
import warnings
class PlotModeBas... |
8b77e3341ff2145b07f6a2cf458cfecd3c450f3319d8570039cf3470db70bd1b | #!/usr/bin/env python
"""Setup script for SymPy.
This uses Setuptools (https://setuptools.pypa.io/en/latest/) the standard
python mechanism for installing packages.
For the easiest installation just type the command (you'll probably need
root privileges for that):
python setup.py install
This will install the li... |
8390f44277f641dd3408bb428a65ad5cea019d9b8008fe53131f0f71e03d5c1b | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import os
from itertools import chain
import json
import sys
import warnings
import pytest
from sympy.testing.runtests import setup_pprint, _get_doctest_blacklist
durations_path = os.path.join(os.path.dirname(__file__), '.ci', '... |
ff56eb672fc89b5c5d77dfadee6e88e2989b71298da37ac1d1c9e6e499ba6db0 | #!/usr/bin/env python
#
# Tests that a useful message is give in the ImportError when trying to import
# sympy from Python 2. This ensures that we don't get a Py2 SyntaxError from
# sympy/__init__.py
import sys
assert sys.version_info[:2] == (2, 7), "This test is for Python 2.7 only"
import os
thisdir = os.path.dirna... |
5829f68273b205d9f3ad00e7a38952d2f4519a04dd86a85e214980ef6dfbfd55 | #!/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 = [... |
b378b191987640c4450b4eb03c771b8fcb63bb388964673542f5e8073470a016 | #!/usr/bin/env python
"""
Script to generate test coverage reports.
Usage:
$ bin/coverage_report.py
This will create a directory covhtml with the coverage reports. To
restrict the analysis to a directory, you just need to pass its name as
argument. For example:
$ bin/coverage_report.py sympy/logic
runs only the t... |
b9852b33354633c15f5ada85fcebadcd3f69a7031ecf02bda60a6bed42d138c3 | #!/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... |
39adc6520b523c16f09f73cdf207c02d9c806ec6515d8933ed9d94c1201c6f35 | #!/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)
"""
... |
9e504e1620a827c5af9c4aa5100393c5259e5ff924a4c155470c1a5451d9d00d | #! /usr/bin/env python
# Check the plot docstring
from sympy import Symbol, exp, sin, cos
from sympy.plotting import (plot, plot_parametric,
plot3d_parametric_surface, plot3d_parametric_line,
plot3d)
lx = range(5)
ly = [i**2 for i in lx]
x = Symbol('x')
y = Sym... |
8c94299c9e2b4bfea671f933f30b893b32e4aa15a551d5c9965d98a9a0c08f52 | #
# 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... |
3d3662e46b649194d77ebff8e48359bdbc7691ec38b51ddcc61e2729a210bf0e | """
Continuous Random Variables - Prebuilt variables
Contains
========
Arcsin
Benini
Beta
BetaNoncentral
BetaPrime
BoundedPareto
Cauchy
Chi
ChiNoncentral
ChiSquared
Dagum
Erlang
ExGaussian
Exponential
ExponentialPower
FDistribution
FisherZ
Frechet
Gamma
GammaInverse
Gumbel
Gompertz
Kumaraswamy
Laplace
Levy
LogCauchy
L... |
c6a5ddd9f59b108fbf3426a4ad2102bb1236d70aadb302c7f64445ed4edffbc1 | """
Finite Discrete Random Variables - Prebuilt variable types
Contains
========
FiniteRV
DiscreteUniform
Die
Bernoulli
Coin
Binomial
BetaBinomial
Hypergeometric
Rademacher
IdealSoliton
RobustSoliton
"""
from sympy.core.cache import cacheit
from sympy.core.function import Lambda
from sympy.core.numbers import (Integ... |
0410a0b8e1dda6b3d2c2d88c967b679ddbe446838921d0a2b939f0bbabdcb6bc | 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... |
4f57d3046340dc202fa88c5cee59065b3ada576beb001ca69b29389e4690a408 | from sympy.concrete.products import Product
from sympy.concrete.summations import Sum
from sympy.core.add import Add
from sympy.core.function import Lambda
from sympy.core.mul import Mul
from sympy.core.numbers import (Integer, Rational, pi)
from sympy.core.power import Pow
from sympy.core.relational import Eq
from sym... |
19ceb4cd8137bd1da18d3d63fccfc460bcd3da82f5fb89abcb351b6d1e780b55 | from sympy.sets import FiniteSet
from sympy.core.numbers import Rational
from sympy.core.relational import Eq
from sympy.core.symbol import Dummy
from sympy.functions.combinatorial.factorials import FallingFactorial
from sympy.functions.elementary.exponential import (exp, log)
from sympy.functions.elementary.miscellane... |
5cdc32f408d6e010c5bc5644bb3f12c89a654fbe67632bce9298a241d7b16d93 | """
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 __future__ import annotations
fr... |
48ed4a5c9d1a1c66c3e72f5003ca3aa8e1db8a8dee6bcc323b646c8741e7c38f | from sympy.concrete.summations import Sum
from sympy.core.basic import Basic
from sympy.core.function import Lambda
from sympy.core.symbol import Dummy
from sympy.integrals.integrals import Integral
from sympy.stats.rv import (NamedArgsMixin, random_symbols, _symbol_converter,
PSpace, RandomSymb... |
ee2e57014631b7e7a498fe4a0cc6b2b549660afc60944b29a166ecc127fcdad1 | from sympy.concrete.products import Product
from sympy.concrete.summations import Sum
from sympy.core.basic import Basic
from sympy.core.function import Lambda
from sympy.core.numbers import (I, pi)
from sympy.core.singleton import S
from sympy.core.symbol import Dummy
from sympy.functions.elementary.complexes import A... |
4332091478c51b69dc229a09ec218ccc9e87b9d56a07644da76c811c18e44b3f | from sympy.core.numbers import igcd, mod_inverse
from sympy.core.power import integer_nthroot
from sympy.ntheory.residue_ntheory import _sqrt_mod_prime_power
from sympy.ntheory import isprime
from math import log, sqrt
import random
rgen = random.Random()
class SievePolynomial:
def __init__(self, modified_coeff=(... |
370d049fb908f4632371adbceda86dd4735a4e3045bfcba5ab4135ae0b693ba4 | from sympy.combinatorics import Permutation
from sympy.combinatorics.util import _distribute_gens_by_base
rmul = Permutation.rmul
def _cmp_perm_lists(first, second):
"""
Compare two lists of permutations as sets.
Explanation
===========
This is used for testing purposes. Since the array form of... |
7713193daae9257b1cac676f425aad03c56d22f90a144452e0c1afc2760dbe05 | 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... |
05d5b5446d978226d52365849ca6a9331f2bc99fb7c1b834e34ed7fc4ba3e480 | import random
from collections import defaultdict
from collections.abc import Iterable
from functools import reduce
from sympy.core.parameters import global_parameters
from sympy.core.basic import Atom
from sympy.core.expr import Expr
from sympy.core.numbers import Integer
from sympy.core.sympify import _sympify
from ... |
c7a5939021634b3765d8a2b48ccb3b264a9c351261d62510e1c219b48a87a0ec | from __future__ import annotations
from sympy.core import S
from sympy.core.expr import Expr
from sympy.core.symbol import Symbol, symbols as _symbols
from sympy.core.sympify import CantSympify
from sympy.printing.defaults import DefaultPrinting
from sympy.utilities import public
from sympy.utilities.iterables import ... |
689ce656dbfb7b51c4002bfebf68deb4fc4f62b3ed9c0c76d4264d1cbf4afa76 | 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... |
89d8be54bf38afc0a425e888acd7bda5b26cb057b868fba5bcb6ff419420f236 | from sympy.combinatorics.group_constructs import DirectProduct
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.permutations import Permutation
_af_new = Permutation._af_new
def AbelianGroup(*cyclic_orders):
"""
Returns the direct product of cyclic groups with the given o... |
88e3cd4c8efeae17ecfe8306f737690054c2d61058efad40ee59ef23ef231491 | """
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... |
3da79d84b63cb51cd9a69e7c3aab452cffa59b31960de8c925d1187f42abe755 | 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... |
6cabcb3c6d10c0f9776bb430f92310123929c9a4f1c727bba6f0b6efe8efb7cd | from sympy.core import S, sympify, Expr, Dummy, Add, Mul
from sympy.core.cache import cacheit
from sympy.core.containers import Tuple
from sympy.core.function import Function, PoleError, expand_power_base, expand_log
from sympy.core.sorting import default_sort_key
from sympy.functions.elementary.exponential import exp,... |
22e5c01a1478f8d340e8516d64868996a66a874f0bee36ca09ea0ac6ced2f4e9 | 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,
... |
40f898bab4a798abdaba0c082eaffdfa61749769766edf04b127e94651c8cfce | import warnings
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 ... |
92f82d87aacd256b7de24cd5a2ca59c221f9dc2face154a2a2b92d40d98ca1b4 | """Predefined R^n manifolds together with common coord. systems.
Coordinate systems are predefined as well as the transformation laws between
them.
Coordinate functions can be accessed as attributes of the manifold (eg `R2.x`),
as attributes of the coordinate systems (eg `R2_r.x` and `R2_p.theta`), or by
using the us... |
dcd6e88d1315a1c4ebe4ec0593c9c117b4da4b300384009df8a7f8616d143d3d | from __future__ import annotations
from typing import Any
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.c... |
858971b46c9333467ae0d6b39b54de319dd8f1d32c883fc736136f6d4f5e8906 | from sympy.core.function import Add, ArgumentIndexError, Function
from sympy.core.power import Pow
from sympy.core.singleton import S
from sympy.functions.elementary.exponential import log
from sympy.functions.elementary.trigonometric import cos, sin
def _cosm1(x, *, evaluate=True):
return Add(cos(x, evaluate=eva... |
3fb23e4c3fb81f80ebe1bc45352ee9e3a383f5b8b7da5f12a4511ecd55aeb526 | """
AST nodes specific to Fortran.
The functions defined in this module allows the user to express functions such as ``dsign``
as a SymPy function for symbolic manipulation.
"""
from sympy.codegen.ast import (
Attribute, CodeBlock, FunctionCall, Node, none, String,
Token, _mk_Tuple, Variable
)
from sympy.core... |
11e48e0be7dac13c458ae78c22e3254853ee112ffdee18710b6863a19ffaa4f4 | """
Classes and functions useful for rewriting expressions for optimized code
generation. Some languages (or standards thereof), e.g. C99, offer specialized
math functions for better performance and/or precision.
Using the ``optimize`` function in this module, together with a collection of
rules (represented as instan... |
0749d93637c1a63f59bf5912c2ae5c05abf968622faf5eb966dac8a0f6fe51d1 | """
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
... |
cea70b9676fa2dad55af73241433b84ea548b3b108ef11cc038aea1cd64ad1a4 | """
This file contains some classical ciphers and routines
implementing a linear-feedback shift register (LFSR)
and the Diffie-Hellman key exchange.
.. warning::
This module is intended for educational purposes only. Do not use the
functions in this module for real cryptographic applications. If you wish
to ... |
1a50b5e870b754db421c564dba5d6d9c308d3f2fa238f2990468e94db4e56e1e | from __future__ import annotations
from typing import Callable
from sympy.core import S, Add, Expr, Basic, Mul, Pow, Rational
from sympy.core.logic import fuzzy_not
from sympy.logic.boolalg import Boolean
from sympy.assumptions import ask, Q # type: ignore
def refine(expr, assumptions=True):
"""
Simplify a... |
0c4c819d0027eb649039a6ba6fdfbc4c3caff32337d5cef3ef75151699fe0139 | """
Functions and wrapper object to call assumption property and predicate
query with same syntax.
In SymPy, there are two assumption systems. Old assumption system is
defined in sympy/core/assumptions, and it can be accessed by attribute
such as ``x.is_even``. New assumption system is defined in
sympy/assumptions, an... |
95dfd959097187d4771253140639ea55fc042768ab3d8b49eaf5799967734acd | """
Module to evaluate the proposition with assumptions using SAT algorithm.
"""
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.assumptions.ask_generated import get_all_known_facts
from sympy.assumptions.assume import global_assumptions, AppliedPredicate
from sympy.assumptions.satha... |
ef8ffaf267791719e0b41d2c737f8db7534d91c730cb32303e2f5e08c98865f0 | """A module which implements predicates and assumption context."""
from contextlib import contextmanager
import inspect
from sympy.core.assumptions import ManagedProperties
from sympy.core.symbol import Str
from sympy.core.sympify import _sympify
from sympy.logic.boolalg import Boolean, false, true
from sympy.multiple... |
cab968d00a18fccb571cfd63d2a295e148008525c1069bc71d19c326e085b02f | 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... |
0ac6d81d4cc98f8aa75f8e4a4f49916f012dda76c208337cc427671a8e6feb59 | """
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... |
1aec47736fc2cafc07445237869c25a532241acc96a21d378af82abd8304afd3 | """
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... |
077f7f02ad8e794e8a722d854e096f09b67b098fe85fbc0d6c85281b8a474db3 | """
module for generating C, C++, Fortran77, Fortran90, Julia, Rust
and Octave/Matlab routines that evaluate SymPy expressions.
This module is work in progress.
Only the milestones with a '+' character in the list below have been completed.
--- How is sympy.utilities.codegen different from sympy.printing.ccode? ---
W... |
c70769c3da556d36f5992fa2b052a7375e0b7bf0d142ddb5394e18767f5a4080 | """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... |
23c82de7e34d442a9ed152d5fca3e7369a91d1ebc52a3e191e1d9068c0bdd550 | """
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... |
15d37b5390d849d0312bd6e22d4fb5585d5f862f7be389ba2abd5bf3a0bcf96e | 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... |
bceed77adfda8432cf491fe3e3afc0164ff5c8258d57a38d912bf20c3049c8bf | """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... |
785887ce724025c22a7e34314d25aae67404a509b1f9f4c8ab3289f3869c4fe7 | 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... |
ff029f9c3ab36c6a9dec55f825b61c58f6a834d2e92fc791885fa21a68bca18d | """
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
... |
0049d91a37708ac3bc7eb0b8dcf7044aa080cf7b9eea3c351f51ce76cdc06377 | """
A Printer for generating readable representation of most SymPy classes.
"""
from __future__ import annotations
from typing import Any
from sympy.core import S, Rational, Pow, Basic, Mul, Number
from sympy.core.mul import _keep_coeff
from sympy.core.relational import Relational
from sympy.core.sorting import defau... |
befc00393fa7c27b3efba3d5c69be82fd0ff251abb306bc956c918700f857ef9 | """
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 ... |
e9ce68389834f3145fe91b4a20c0b11873b85a7461472757e0009f70e7c800f1 | """
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... |
f512357cee0f2f8bc70b5363e43230bc1df12914a69527ee749c1ba3d368fdf1 | """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... |
711a66b445f05fa0a650236656ed71bf717416b0182916c299a243b4dce046fb | """
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... |
f51fb05eed5247b469e610c51ddad103408fa400c8e7ca9e1a84b16c032960fd | """
Mathematica code printer
"""
from __future__ import annotations
from typing import Any
from sympy.core import Basic, Expr, Float
from sympy.core.sorting import default_sort_key
from sympy.printing.codeprinter import CodePrinter
from sympy.printing.precedence import precedence
# Used in MCodePrinter._print_Funct... |
2fe0a8a4f477119151fa9a3fb7c88998deb94c1f7b7aa55d55f159d943a2524d | """
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 "... |
af7f497e320d5c97e44bab30cbe5165f10b2d3c3ae6832508a9d4b7adca08af8 | """
A MathML printer.
"""
from __future__ import annotations
from typing import Any
from sympy.core.mul import Mul
from sympy.core.singleton import S
from sympy.core.sorting import default_sort_key
from sympy.core.sympify import sympify
from sympy.printing.conventions import split_super_sub, requires_partial
from sym... |
7cd3cf18dfb63b941031e2887380ade0d68e9839012c4b944755dfcd49c87be5 | """
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.printing.codeprinter import CodePrinter
from sympy.printing.precedence import precedence, ... |
526e4876860a165c7a7d1f1c633498b01f7a8dc04e1c03da9ba5825afed2bace | """
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... |
39826c935b3dc11118f4cec21582ef9c09b9b19da155bc80d83189d407489c45 | from __future__ import annotations
from typing import Any
from functools import wraps
from sympy.core import Add, 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
from sympy.core.sor... |
9db3ec5c5afa7cffd2a742a6455d5828ebf47c801b33576e7eeb854d2daaa5f3 | from __future__ import annotations
from typing import Any
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 = aes... |
12cd2f7c81d49fa821be8a263ed88ae63f3e488445f92dd3d7b881e782a18700 | 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... |
a4c5167438747338ac3d85ad0f2a29ee1acbaded34eabb51ff8b6633216ee8cd | """
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.printing.codeprinter... |
9bb3017b13e3df55fe7f2ae39017363f831f0efee64ae857af98806067687554 | """
A Printer for generating executable code.
The most important function here is srepr that returns a string so that the
relation eval(srepr(expr))=expr holds in an appropriate environment.
"""
from __future__ import annotations
from typing import Any
from sympy.core.function import AppliedUndef
from sympy.core.mul... |
b09d3efcdb36bc7e396f9a045c83c9b48386f65bc212a1e52514334288950b8e | import typing
import sympy
from sympy.core import Add, Mul
from sympy.core import Symbol, Expr, Float, Rational, Integer, Basic
from sympy.core.function import UndefinedFunction, Function
from sympy.core.relational import Relational, Unequality, Equality, LessThan, GreaterThan, StrictLessThan, StrictGreaterThan
from s... |
359f9acabce2f2e3fb72acb318479d848ada34581615f519183a2b9e69b9c1e9 | """
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... |
26c59e7c094bb87e308a6878a568121910a4e7cfcd72fff293385fcbab4dda64 | from __future__ import annotations
from sympy.core import Basic, S
from sympy.core.function import Lambda
from sympy.printing.codeprinter import CodePrinter
from sympy.printing.precedence import precedence
from functools import reduce
known_functions = {
'Abs': 'abs',
'sin': 'sin',
'cos': 'cos',
'tan'... |
0b07f0bd2a2beb6614eec473a083d967e43371336d9009d1304f8f692266038e | """
.. deprecated:: 1.8
``sympy.printing.theanocode`` is deprecated. Theano has been renamed to
Aesara. Use ``sympy.printing.aesaracode`` instead. See
:ref:`theanocode-deprecated` for more information.
"""
from __future__ import annotations
from typing import Any
from sympy.external import import_module
from s... |
65d0661e07809faeca34bdc4193e2a8bb771851773417a698a98e8943960443c | """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 ``Rule`` s representing the integration rules used.
Each ``Rule`` class represents a (maybe parametrized)... |
d305dfc9305d9a98383f85376c75358d635d81fe40ddd33ac3b595094b5f8327 | """ 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,
... |
e51a31b4863d53d08ed5e235dd10623e0a262cff441478cdd96fd3750924b608 | 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... |
a5b8d8da9881a447d25908136e2aaa57c2f7d0fa336e96093cfe97ae686f29ad | from __future__ import annotations
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 Rati... |
5db2c9bffd3899009d1389e567c8f3e32b8d44fec0a730a2175ebd8dc509d651 | """ This module cooks up a docstring when imported. Its only purpose is to
be displayed in the sphinx documentation. """
from __future__ import annotations
from typing import Any
from sympy.integrals.meijerint import _create_lookup_table
from sympy.core.add import Add
from sympy.core.relational import Eq
from sym... |
cffe39f0b77254c46caee1df8d790b8533200a308779ba3f728d2ef82c1b3d9d | """
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... |
09319ff8d8cfdca78c01cf06487a52a67df0272c2dfcfcccc2cc70eb07b0c55f | """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... |
0ed6e5dd9d7bf01819f690a4429b515ccad0d6a7ce62b0622c553dac8420f5c2 | """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
from .singl... |
caa88b3ea5147ba14fdf11025b14e6e44c8a6da9852317a4c9aa9315dab2c749 | """
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... |
f6442fb43c66f924911a2fb5e795ec065febb3ea0dffb770edf34d4f7983bb64 | """
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... |
0dbc1e20eb807bb7ae40d7e6d171b6eef5460bfb4af9d13c3196c9198a1df921 | 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... |
540130a1072b5df03d5ed5def68e4048ee9e7f6ada6d0d1f2fa8d77a66f07076 | 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... |
be200e18be74f4f5f36706f018e2ce9bc16e125e4029012742b44d77ee11d68b | from __future__ import annotations
from .basic import Atom, Basic
from .sorting import ordered
from .evalf import EvalfMixin
from .function import AppliedUndef
from .singleton import S
from .sympify import _sympify, SympifyError
from .parameters import global_parameters
from .logic import fuzzy_bool, fuzzy_xor, fuzzy_... |
09cdc11aa02a0cb9f4512015c2809fd0f7899cd5290ff27304e7728bab1f9744 | 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... |
6f14658c71fd5e70dd95c6858729b940f942bd38dc3b89254b2a7d9a6af262e9 | 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... |
9cbd11f1a3b28e01e22817b2f5e5998a1773f787af1bb7266e9c931de8521614 | 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 .singleton import S
class Mod(Function):
"""Represents a modulo operation on symbolic expressions.
Parameters
==========
... |
630bcabb526220b07e9a357339fcf56a4aee0d9e1dadb28017bc1211fc593c51 | from __future__ import annotations
from .assumptions import StdFactKB, _assume_defined
from .basic import Basic, Atom
from .cache import cacheit
from .containers import Tuple
from .expr import Expr, AtomicExpr
from .function import AppliedUndef, FunctionClass
from .kind import NumberKind, UndefinedKind
from .logic imp... |
a59b845af1fe91c50636ad1ea5a566d751bc7265d942d332a1ea32c0155c6d85 | """sympify -- convert objects SymPy internal format"""
from __future__ import annotations
from typing import Any, Callable
from inspect import getmro
import string
from sympy.core.random import choice
from .parameters import global_parameters
from sympy.utilities.exceptions import sympy_deprecation_warning
from sym... |
1ee8d32a029c5f4aca99fefc882984803ec392605a88c9a0503862de27970a16 | """
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.